[mlpack-git] master: arma::prod is faster, in this case. (64324ff)
gitdub at big.cc.gt.atl.ga.us
gitdub at big.cc.gt.atl.ga.us
Thu Mar 5 21:58:45 EST 2015
Repository : https://github.com/mlpack/mlpack
On branch : master
Link : https://github.com/mlpack/mlpack/compare/904762495c039e345beba14c1142fd719b3bd50e...f94823c800ad6f7266995c700b1b630d5ffdcf40
>---------------------------------------------------------------
commit 64324ff74a3e52f9458eeb1ebd4289b80284520d
Author: Ryan Curtin <ryan at ratml.org>
Date: Tue Aug 19 01:00:30 2014 +0000
arma::prod is faster, in this case.
>---------------------------------------------------------------
64324ff74a3e52f9458eeb1ebd4289b80284520d
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)
{
More information about the mlpack-git
mailing list