[mlpack-git] master, mlpack-1.0.x: Refactor MinDistance(), MaxDistance(), and RangeDistance() to accept any Armadillo vector type. (eb44a20)

gitdub at big.cc.gt.atl.ga.us gitdub at big.cc.gt.atl.ga.us
Thu Mar 5 21:44:18 EST 2015


Repository : https://github.com/mlpack/mlpack

On branches: master,mlpack-1.0.x
Link       : https://github.com/mlpack/mlpack/compare/904762495c039e345beba14c1142fd719b3bd50e...f94823c800ad6f7266995c700b1b630d5ffdcf40

>---------------------------------------------------------------

commit eb44a20b4b4672e06d9ecbedcb6819882c28c946
Author: Ryan Curtin <ryan at ratml.org>
Date:   Thu Feb 20 00:21:29 2014 +0000

    Refactor MinDistance(), MaxDistance(), and RangeDistance() to accept any
    Armadillo vector type.


>---------------------------------------------------------------

eb44a20b4b4672e06d9ecbedcb6819882c28c946
 .../core/tree/binary_space_tree/binary_space_tree.hpp     | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/src/mlpack/core/tree/binary_space_tree/binary_space_tree.hpp b/src/mlpack/core/tree/binary_space_tree/binary_space_tree.hpp
index 1fcaa0c..b169d86 100644
--- a/src/mlpack/core/tree/binary_space_tree/binary_space_tree.hpp
+++ b/src/mlpack/core/tree/binary_space_tree/binary_space_tree.hpp
@@ -364,19 +364,28 @@ class BinarySpaceTree
   }
 
   //! Return the minimum distance to another point.
-  double MinDistance(const arma::vec& point) const
+  template<typename VecType>
+  double MinDistance(const VecType& point,
+                     typename boost::enable_if<IsVector<VecType> >::type* = 0)
+      const
   {
     return bound.MinDistance(point);
   }
 
   //! Return the maximum distance to another point.
-  double MaxDistance(const arma::vec& point) const
+  template<typename VecType>
+  double MaxDistance(const VecType& point,
+                     typename boost::enable_if<IsVector<VecType> >::type* = 0)
+      const
   {
     return bound.MaxDistance(point);
   }
 
   //! Return the minimum and maximum distance to another point.
-  math::Range RangeDistance(const arma::vec& point) const
+  template<typename VecType>
+  math::Range
+  RangeDistance(const VecType& point,
+                typename boost::enable_if<IsVector<VecType> >::type* = 0) const
   {
     return bound.RangeDistance(point);
   }



More information about the mlpack-git mailing list