[mlpack-git] master: use SquaredEuclideanDistance (22ef07f)

gitdub at big.cc.gt.atl.ga.us gitdub at big.cc.gt.atl.ga.us
Wed Apr 29 14:43:32 EDT 2015


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

On branch  : master
Link       : https://github.com/mlpack/mlpack/compare/ee384655c4462e422e343e9725437fd772ca4449...182d4a629c1b23f683dff7b284844e4e3e9f5cc4

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

commit 22ef07ff7abdb8d8c00e547c2842cd3aabaf7d81
Author: HurricaneTong <HurricaneTong at HurricaneTong.local>
Date:   Thu Feb 26 15:16:38 2015 +0800

    use SquaredEuclideanDistance
    
    avoid duplicate calculation


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

22ef07ff7abdb8d8c00e547c2842cd3aabaf7d81
 src/mlpack/methods/mean_shift/mean_shift_impl.hpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/mlpack/methods/mean_shift/mean_shift_impl.hpp b/src/mlpack/methods/mean_shift/mean_shift_impl.hpp
index 480252d..c0ef683 100644
--- a/src/mlpack/methods/mean_shift/mean_shift_impl.hpp
+++ b/src/mlpack/methods/mean_shift/mean_shift_impl.hpp
@@ -111,7 +111,8 @@ MeanShift<
 CalcWeight(const arma::colvec& centroid, const arma::colvec& point,
            double& weight) {
 
-  double squaredDist = std::pow(metric.Evaluate(centroid, point), 2);
+  double squaredDist = metric::SquaredEuclideanDistance::
+                       Evaluate(centroid, point);
   if (squaredDist >= squaredRadius || squaredDist == 0) {
     return false;
   }



More information about the mlpack-git mailing list