[mlpack-git] master: Some Hilbert R tree fixes (05fbd27)

gitdub at mlpack.org gitdub at mlpack.org
Tue Jun 28 10:37:17 EDT 2016


Repository : https://github.com/mlpack/mlpack
On branch  : master
Link       : https://github.com/mlpack/mlpack/compare/9dd66c7312ffcce6bc7b51aff00d38b75263f4b0...6077f120935e10ffa01d80a8398e28a90a8d011a

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

commit 05fbd27221931f20975e139f4984e5e05a11487f
Author: Mikhail Lozhnikov <lozhnikovma at gmail.com>
Date:   Tue Jun 28 17:37:17 2016 +0300

    Some Hilbert R tree fixes


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

05fbd27221931f20975e139f4984e5e05a11487f
 src/mlpack/core/tree/rectangle_tree/discrete_hilbert_value.hpp   | 9 ---------
 .../core/tree/rectangle_tree/discrete_hilbert_value_impl.hpp     | 4 ++--
 .../tree/rectangle_tree/hilbert_r_tree_auxiliary_information.hpp | 8 --------
 .../rectangle_tree/hilbert_r_tree_auxiliary_information_impl.hpp | 4 ++--
 4 files changed, 4 insertions(+), 21 deletions(-)

diff --git a/src/mlpack/core/tree/rectangle_tree/discrete_hilbert_value.hpp b/src/mlpack/core/tree/rectangle_tree/discrete_hilbert_value.hpp
index 715bc82..3ce0788 100644
--- a/src/mlpack/core/tree/rectangle_tree/discrete_hilbert_value.hpp
+++ b/src/mlpack/core/tree/rectangle_tree/discrete_hilbert_value.hpp
@@ -155,15 +155,6 @@ class DiscreteHilbertValue
   void RemoveNode(TreeType* node, const size_t nodeIndex);
 
   /**
-   * Copy the largest Hilbert value and the local dataset.
-   *
-   * @param dst The node to which the information is being copied.
-   * @param src The node from which the information is being copied.
-   */
-  template<typename TreeType>
-  void Copy(TreeType* dst, TreeType* src);
-
-  /**
    * Copy the local Hilbert value's pointer.
    *
    * @param val The DiscreteHilbertValue object from which the dataset
diff --git a/src/mlpack/core/tree/rectangle_tree/discrete_hilbert_value_impl.hpp b/src/mlpack/core/tree/rectangle_tree/discrete_hilbert_value_impl.hpp
index 22e2b13..8f06578 100644
--- a/src/mlpack/core/tree/rectangle_tree/discrete_hilbert_value_impl.hpp
+++ b/src/mlpack/core/tree/rectangle_tree/discrete_hilbert_value_impl.hpp
@@ -101,8 +101,8 @@ CalculateValue(const VecType& pt,typename boost::enable_if<IsVector<VecType>>*)
 
     if (e < std::numeric_limits<VecElemType>::min_exponent)
     {
-      HilbertElemType tmp =
-          1 << (std::numeric_limits<VecElemType>::min_exponent - e);
+      HilbertElemType tmp = (HilbertElemType) 1 <<
+          (std::numeric_limits<VecElemType>::min_exponent - e);
 
       e = std::numeric_limits<VecElemType>::min_exponent;
       normalizedVal /= tmp;
diff --git a/src/mlpack/core/tree/rectangle_tree/hilbert_r_tree_auxiliary_information.hpp b/src/mlpack/core/tree/rectangle_tree/hilbert_r_tree_auxiliary_information.hpp
index 2477f9b..8c0b4ae 100644
--- a/src/mlpack/core/tree/rectangle_tree/hilbert_r_tree_auxiliary_information.hpp
+++ b/src/mlpack/core/tree/rectangle_tree/hilbert_r_tree_auxiliary_information.hpp
@@ -91,14 +91,6 @@ class HilbertRTreeAuxiliaryInformation
    */
   bool UpdateAuxiliaryInfo(TreeType* node);
 
-  /**
-   * Copy the auxiliary information from one node to another.
-   *
-   * @param dst The node to which the information is being copied.
-   * @param src The node from which the information is being copied.
-   */
-  void Copy(TreeType* dst, TreeType* src);
-
   //! Clear memory.
   void NullifyData();
 
diff --git a/src/mlpack/core/tree/rectangle_tree/hilbert_r_tree_auxiliary_information_impl.hpp b/src/mlpack/core/tree/rectangle_tree/hilbert_r_tree_auxiliary_information_impl.hpp
index 11d9e2b..b01d3d1 100644
--- a/src/mlpack/core/tree/rectangle_tree/hilbert_r_tree_auxiliary_information_impl.hpp
+++ b/src/mlpack/core/tree/rectangle_tree/hilbert_r_tree_auxiliary_information_impl.hpp
@@ -135,9 +135,9 @@ UpdateAuxiliaryInfo(TreeType* node)
     return true;
 
   TreeType* child = node->Children()[node->NumChildren() - 1];
-  if (hilbertValue.CompareWith(child->AuxiliaryInfo().hilbertValue()) < 0)
+  if (hilbertValue.CompareWith(child->AuxiliaryInfo().HilbertValue()) < 0)
   {
-    hilbertValue.Copy(node,child);
+    hilbertValue = node->AuxiliaryInfo().HilbertValue();
     return true;
   }
   return false;




More information about the mlpack-git mailing list