[mlpack] 306/324: added Save(), Load(), Type() to LaplaceDistribution
Barak A. Pearlmutter
barak+git at cs.nuim.ie
Sun Aug 17 08:22:21 UTC 2014
This is an automated email from the git hooks/post-receive script.
bap pushed a commit to branch svn-trunk
in repository mlpack.
commit 4397d067ade8b9c2a8afbd2bd9d985a5a08826d3
Author: michaelfox99 <michaelfox99 at 9d5b8971-822b-0410-80eb-d18c1038ef23>
Date: Sat Aug 9 18:56:43 2014 +0000
added Save(), Load(), Type() to LaplaceDistribution
git-svn-id: http://svn.cc.gatech.edu/fastlab/mlpack/trunk@16991 9d5b8971-822b-0410-80eb-d18c1038ef23
---
src/mlpack/core/dists/laplace_distribution.cpp | 13 +++++++++++++
src/mlpack/core/dists/laplace_distribution.hpp | 7 +++++++
2 files changed, 20 insertions(+)
diff --git a/src/mlpack/core/dists/laplace_distribution.cpp b/src/mlpack/core/dists/laplace_distribution.cpp
index ef9b4af..992b00f 100644
--- a/src/mlpack/core/dists/laplace_distribution.cpp
+++ b/src/mlpack/core/dists/laplace_distribution.cpp
@@ -89,3 +89,16 @@ std::string LaplaceDistribution::ToString() const
convert << util::Indent(data.str());
return convert.str();
}
+
+/*
+ * Save to or Load from SaveRestoreUtility
+ */
+void LaplaceDistribution::Save(util::SaveRestoreUtility& sr) const {
+ sr.SaveParameter(Type(), "type");
+ sr.SaveParameter(mean, "mean");
+ sr.SaveParameter(scale, "scale");
+}
+void LaplaceDistribution::Load(const util::SaveRestoreUtility& sr) {
+ sr.LoadParameter(mean, "mean");
+ sr.LoadParameter(scale, "scale");
+}
\ No newline at end of file
diff --git a/src/mlpack/core/dists/laplace_distribution.hpp b/src/mlpack/core/dists/laplace_distribution.hpp
index 59fa17f..83e1980 100644
--- a/src/mlpack/core/dists/laplace_distribution.hpp
+++ b/src/mlpack/core/dists/laplace_distribution.hpp
@@ -130,6 +130,13 @@ class LaplaceDistribution
//! Return a string representation of the object.
std::string ToString() const;
+ /*
+ * Save to or Load from SaveRestoreUtility
+ */
+ void Save(util::SaveRestoreUtility& n) const;
+ void Load(const util::SaveRestoreUtility& n);
+ static std::string const Type() { return "LaplaceDistribution"; }
+
private:
//! Mean of the distribution.
arma::vec mean;
--
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