[mlpack] 37/53: Add error checking to constructor.
Barak A. Pearlmutter
barak+git at pearlmutter.net
Mon Nov 14 00:46:49 UTC 2016
This is an automated email from the git hooks/post-receive script.
bap pushed a commit to branch master
in repository mlpack.
commit 86e5edf60e2066a464f9e8862278ffd63af75741
Author: Ryan Curtin <ryan at ratml.org>
Date: Sun Oct 30 21:50:06 2016 +0900
Add error checking to constructor.
---
src/mlpack/methods/approx_kfn/qdafn_impl.hpp | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/src/mlpack/methods/approx_kfn/qdafn_impl.hpp b/src/mlpack/methods/approx_kfn/qdafn_impl.hpp
index 4e2104e..8d64f95 100644
--- a/src/mlpack/methods/approx_kfn/qdafn_impl.hpp
+++ b/src/mlpack/methods/approx_kfn/qdafn_impl.hpp
@@ -18,7 +18,13 @@ namespace neighbor {
// Non-training constructor.
template<typename MatType>
-QDAFN<MatType>::QDAFN(const size_t l, const size_t m) : l(l), m(m) { }
+QDAFN<MatType>::QDAFN(const size_t l, const size_t m) : l(l), m(m)
+{
+ if (l > 0)
+ throw std::invalid_argument("QDAFN::QDAFN(): l must be greater than 0!");
+ if (m > 0)
+ throw std::invalid_argument("QDAFN::QDAFN(): m must be greater than 0!");
+}
// Constructor.
template<typename MatType>
@@ -28,6 +34,11 @@ QDAFN<MatType>::QDAFN(const MatType& referenceSet,
l(l),
m(m)
{
+ if (l > 0)
+ throw std::invalid_argument("QDAFN::QDAFN(): l must be greater than 0!");
+ if (m > 0)
+ throw std::invalid_argument("QDAFN::QDAFN(): m must be greater than 0!");
+
Train(referenceSet);
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/mlpack.git
More information about the debian-science-commits
mailing list