[mlpack-svn] r16991 - mlpack/trunk/src/mlpack/core/dists

fastlab-svn at coffeetalk-1.cc.gatech.edu fastlab-svn at coffeetalk-1.cc.gatech.edu
Sat Aug 9 14:56:43 EDT 2014


Author: michaelfox99
Date: Sat Aug  9 14:56:43 2014
New Revision: 16991

Log:
added Save(), Load(), Type() to LaplaceDistribution

Modified:
   mlpack/trunk/src/mlpack/core/dists/laplace_distribution.cpp
   mlpack/trunk/src/mlpack/core/dists/laplace_distribution.hpp

Modified: mlpack/trunk/src/mlpack/core/dists/laplace_distribution.cpp
==============================================================================
--- mlpack/trunk/src/mlpack/core/dists/laplace_distribution.cpp	(original)
+++ mlpack/trunk/src/mlpack/core/dists/laplace_distribution.cpp	Sat Aug  9 14:56:43 2014
@@ -89,3 +89,16 @@
   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

Modified: mlpack/trunk/src/mlpack/core/dists/laplace_distribution.hpp
==============================================================================
--- mlpack/trunk/src/mlpack/core/dists/laplace_distribution.hpp	(original)
+++ mlpack/trunk/src/mlpack/core/dists/laplace_distribution.hpp	Sat Aug  9 14:56:43 2014
@@ -130,6 +130,13 @@
   //! 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;



More information about the mlpack-svn mailing list