[mlpack-git] master: Allow Centroid() with sparse vectors. (4da2228)

gitdub at big.cc.gt.atl.ga.us gitdub at big.cc.gt.atl.ga.us
Sun Apr 5 18:48:21 EDT 2015


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

On branch  : master
Link       : https://github.com/mlpack/mlpack/compare/c41bc8d54695f1a20b3de551bc80fe7221dd3cd1...81fe638aa0c8d9592bbf7b434110140eb9bb86e7

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

commit 4da222815815d577995154779ee65acf54275120
Author: ryan <ryan at ratml.org>
Date:   Sun Apr 5 18:46:32 2015 -0400

    Allow Centroid() with sparse vectors.


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

4da222815815d577995154779ee65acf54275120
 src/mlpack/core/tree/cover_tree/cover_tree.hpp | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/mlpack/core/tree/cover_tree/cover_tree.hpp b/src/mlpack/core/tree/cover_tree/cover_tree.hpp
index 547d3f7..07e3fb0 100644
--- a/src/mlpack/core/tree/cover_tree/cover_tree.hpp
+++ b/src/mlpack/core/tree/cover_tree/cover_tree.hpp
@@ -333,7 +333,10 @@ class CoverTree
   double MinimumBoundDistance() const { return furthestDescendantDistance; }
 
   //! Get the centroid of the node and store it in the given vector.
-  void Centroid(arma::vec& centroid) const { centroid = dataset.col(point); }
+  void Centroid(arma::vec& centroid) const
+  {
+    centroid = arma::vec(dataset.col(point));
+  }
 
   //! Get the instantiated metric.
   MetricType& Metric() const { return *metric; }



More information about the mlpack-git mailing list