[mlpack-git] master: Avoid math::Range copy, although realistically gcc should be avoiding that anyway when it recognizes that the variable is effectively const. (bbb271c)

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


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

On branch  : master
Link       : https://github.com/mlpack/mlpack/compare/904762495c039e345beba14c1142fd719b3bd50e...f94823c800ad6f7266995c700b1b630d5ffdcf40

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

commit bbb271cec5090cb9e58e0227e65596d688a96e2e
Author: Ryan Curtin <ryan at ratml.org>
Date:   Tue Aug 19 01:01:35 2014 +0000

    Avoid math::Range copy, although realistically gcc should be avoiding that
    anyway when it recognizes that the variable is effectively const.


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

bbb271cec5090cb9e58e0227e65596d688a96e2e
 src/mlpack/core/tree/rectangle_tree/r_tree_split_impl.hpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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 75e5a1b..126f232 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
@@ -461,7 +461,7 @@ void RTreeSplit<DescentType, StatisticType, MatType>::AssignNodeDestNode(
       {
         // For each of the new rectangles, find the width in this dimension if
         // we add the rectangle at index to the new rectangle.
-        math::Range range = oldTree->Children()[index]->Bound()[i];
+        const math::Range& range = oldTree->Children()[index]->Bound()[i];
         newVolOne *= treeOne->Bound()[i].Contains(range) ?
             treeOne->Bound()[i].Width() : (range.Contains(treeOne->Bound()[i]) ?
             range.Width() : (range.Lo() < treeOne->Bound()[i].Lo() ?



More information about the mlpack-git mailing list