[mlpack] 21/58: arma::prod is faster, in this case.

Barak A. Pearlmutter barak+git at cs.nuim.ie
Tue Sep 9 13:19:40 UTC 2014


This is an automated email from the git hooks/post-receive script.

bap pushed a commit to branch svn-trunk
in repository mlpack.

commit 66a46c1c939d5d199b7a0683cac298db8cfd9308
Author: rcurtin <rcurtin at 9d5b8971-822b-0410-80eb-d18c1038ef23>
Date:   Tue Aug 19 01:00:30 2014 +0000

    arma::prod is faster, in this case.
    
    
    git-svn-id: http://svn.cc.gatech.edu/fastlab/mlpack/trunk@17069 9d5b8971-822b-0410-80eb-d18c1038ef23
---
 src/mlpack/core/tree/rectangle_tree/r_tree_split_impl.hpp | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/src/mlpack/core/tree/rectangle_tree/r_tree_split_impl.hpp b/src/mlpack/core/tree/rectangle_tree/r_tree_split_impl.hpp
index 99bfa96..75e5a1b 100644
--- a/src/mlpack/core/tree/rectangle_tree/r_tree_split_impl.hpp
+++ b/src/mlpack/core/tree/rectangle_tree/r_tree_split_impl.hpp
@@ -182,14 +182,8 @@ void RTreeSplit<DescentType, StatisticType, MatType>::GetPointSeeds(
   {
     for (int j = i + 1; j < tree.Count(); j++)
     {
-      double score = 1.0;
-      for (int k = 0; k < tree.Bound().Dim(); k++)
-      {
-        // Points (in the dataset) are stored by column, but this function takes
-        // (row, col).
-        score *= std::abs(tree.LocalDataset().at(k, i) -
-            tree.LocalDataset().at(k, j));
-      }
+      const double score = arma::prod(arma::abs(tree.LocalDataset().col(i) -
+          tree.LocalDataset().col(j)));
 
       if (score > worstPairScore)
       {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/mlpack.git



More information about the debian-science-commits mailing list