[mlpack-git] master: Add empty constructor. (2dbeb4e)
gitdub at big.cc.gt.atl.ga.us
gitdub at big.cc.gt.atl.ga.us
Fri Nov 20 17:33:30 EST 2015
Repository : https://github.com/mlpack/mlpack
On branch : master
Link : https://github.com/mlpack/mlpack/compare/962a37fe8374913c435054aa50e12d912bdfa01c...a7d8231fe7526dcfaadae0bf37d67b50d286e45d
>---------------------------------------------------------------
commit 2dbeb4e226d9fb501d99088d931688578032aaf1
Author: Ryan Curtin <ryan at ratml.org>
Date: Fri Nov 20 21:37:04 2015 +0000
Add empty constructor.
>---------------------------------------------------------------
2dbeb4e226d9fb501d99088d931688578032aaf1
src/mlpack/methods/lsh/lsh_search.hpp | 6 ++++++
src/mlpack/methods/lsh/lsh_search_impl.hpp | 15 +++++++++++++++
2 files changed, 21 insertions(+)
diff --git a/src/mlpack/methods/lsh/lsh_search.hpp b/src/mlpack/methods/lsh/lsh_search.hpp
index 2832b87..a490e5d 100644
--- a/src/mlpack/methods/lsh/lsh_search.hpp
+++ b/src/mlpack/methods/lsh/lsh_search.hpp
@@ -72,6 +72,12 @@ class LSHSearch
const size_t bucketSize = 500);
/**
+ * Create an untrained LSH model. Be sure to call Train() before calling
+ * Search(); otherwise, an exception will be thrown when Search() is called.
+ */
+ LSHSearch();
+
+ /**
* Clean memory.
*/
~LSHSearch();
diff --git a/src/mlpack/methods/lsh/lsh_search_impl.hpp b/src/mlpack/methods/lsh/lsh_search_impl.hpp
index 8f6d167..66a78be 100644
--- a/src/mlpack/methods/lsh/lsh_search_impl.hpp
+++ b/src/mlpack/methods/lsh/lsh_search_impl.hpp
@@ -35,6 +35,21 @@ LSHSearch(const arma::mat& referenceSet,
bucketSize);
}
+// Empty constructor.
+template<typename SortPolicy>
+LSHSearch<SortPolicy>::LSHSearch() :
+ referenceSet(new arma::mat()), // empty dataset
+ ownsSet(true),
+ numProj(0),
+ numTables(0),
+ hashWidth(0),
+ secondHashSize(99901),
+ bucketSize(500),
+ distanceEvaluations(0)
+{
+ // Nothing to do.
+}
+
// Destructor.
template<typename SortPolicy>
LSHSearch<SortPolicy>::~LSHSearch()
More information about the mlpack-git
mailing list