[mlpack-git] master: Serialize all search preferences, not just some. (a9dcd68)

gitdub at big.cc.gt.atl.ga.us gitdub at big.cc.gt.atl.ga.us
Tue Nov 10 18:23:23 EST 2015


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

On branch  : master
Link       : https://github.com/mlpack/mlpack/compare/78cc694a4fd50a68a24f5ab9af7531873566b3ba...0f4e83dc9cc4dcdc315d2cceee32b23ebab114c2

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

commit a9dcd684f67012c6f1e7b7e84f3b3f419c9af2ca
Author: Ryan Curtin <ryan at ratml.org>
Date:   Tue Nov 10 18:22:10 2015 -0500

    Serialize all search preferences, not just some.


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

a9dcd684f67012c6f1e7b7e84f3b3f419c9af2ca
 src/mlpack/methods/rann/ra_search_impl.hpp | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/src/mlpack/methods/rann/ra_search_impl.hpp b/src/mlpack/methods/rann/ra_search_impl.hpp
index 27ec5fa..58f4217 100644
--- a/src/mlpack/methods/rann/ra_search_impl.hpp
+++ b/src/mlpack/methods/rann/ra_search_impl.hpp
@@ -540,6 +540,12 @@ void RASearch<SortPolicy, MetricType, MatType, TreeType>::Serialize(
   ar & CreateNVP(naive, "naive");
   ar & CreateNVP(singleMode, "singleMode");
 
+  ar & CreateNVP(tau, "tau");
+  ar & CreateNVP(alpha, "alpha");
+  ar & CreateNVP(sampleAtLeaves, "sampleAtLeaves");
+  ar & CreateNVP(firstLeafExact, "firstLeafExact");
+  ar & CreateNVP(singleSampleLimit, "singleSampleLimit");
+
   // If we are doing naive search, we serialize the dataset.  Otherwise we
   // serialize the tree.
   if (naive)
@@ -561,6 +567,19 @@ void RASearch<SortPolicy, MetricType, MatType, TreeType>::Serialize(
       if (treeOwner && referenceTree)
         delete referenceTree;
 
+      referenceTree = NULL;
+      oldFromNewReferences.clear();
+      treeOwner = false;
+    }
+  }
+  else
+  {
+    // Delete the current reference tree, if necessary and if we are loading.
+    if (Archive::is_loading::value)
+    {
+      if (treeOwner && referenceTree)
+        delete referenceTree;
+
       // After we load the tree, we will own it.
       treeOwner = true;
     }



More information about the mlpack-git mailing list