[mlpack-git] master: Add Serialize(); remove unnecessary LastDistanceNode(). (5611e1f)

gitdub at big.cc.gt.atl.ga.us gitdub at big.cc.gt.atl.ga.us
Fri Jul 10 19:00:28 EDT 2015


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

On branch  : master
Link       : https://github.com/mlpack/mlpack/compare/4a97187bbba7ce8a6191b714949dd818ef0f37d2...e5905e62c15d1bcff21e6359b11efcd7ab6d7ca0

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

commit 5611e1f109127f5e9cd013f04ccc664d8c1dc77b
Author: ryan <ryan at ratml.org>
Date:   Tue Apr 28 15:16:21 2015 -0400

    Add Serialize(); remove unnecessary LastDistanceNode().


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

5611e1f109127f5e9cd013f04ccc664d8c1dc77b
 .../methods/neighbor_search/neighbor_search_stat.hpp   | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/src/mlpack/methods/neighbor_search/neighbor_search_stat.hpp b/src/mlpack/methods/neighbor_search/neighbor_search_stat.hpp
index 195c72f..bfb9149 100644
--- a/src/mlpack/methods/neighbor_search/neighbor_search_stat.hpp
+++ b/src/mlpack/methods/neighbor_search/neighbor_search_stat.hpp
@@ -46,7 +46,6 @@ class NeighborSearchStat
       firstBound(SortPolicy::WorstDistance()),
       secondBound(SortPolicy::WorstDistance()),
       bound(SortPolicy::WorstDistance()),
-      lastDistanceNode(NULL),
       lastDistance(0.0) { }
 
   /**
@@ -58,7 +57,6 @@ class NeighborSearchStat
       firstBound(SortPolicy::WorstDistance()),
       secondBound(SortPolicy::WorstDistance()),
       bound(SortPolicy::WorstDistance()),
-      lastDistanceNode(NULL),
       lastDistance(0.0) { }
 
   //! Get the first bound.
@@ -73,14 +71,22 @@ class NeighborSearchStat
   double Bound() const { return bound; }
   //! Modify the overall bound (it should be the better of the two bounds).
   double& Bound() { return bound; }
-  //! Get the last distance evaluation node.
-  void* LastDistanceNode() const { return lastDistanceNode; }
-  //! Modify the last distance evaluation node.
-  void*& LastDistanceNode() { return lastDistanceNode; }
   //! Get the last distance calculation.
   double LastDistance() const { return lastDistance; }
   //! Modify the last distance calculation.
   double& LastDistance() { return lastDistance; }
+
+  //! Serialize the statistic to/from an archive.
+  template<typename Archive>
+  void Serialize(Archive& ar, const unsigned int /* version */)
+  {
+    using data::CreateNVP;
+
+    ar & CreateNVP(firstBound, "firstBound");
+    ar & CreateNVP(secondBound, "secondBound");
+    ar & CreateNVP(bound, "bound");
+    ar & CreateNVP(lastDistance, "lastDistance");
+  }
 };
 
 }; // namespace neighbor



More information about the mlpack-git mailing list