[mlpack-git] master, mlpack-1.0.x: Minor fixes to ToString(). (9fa36cf)

gitdub at big.cc.gt.atl.ga.us gitdub at big.cc.gt.atl.ga.us
Thu Mar 5 21:42:58 EST 2015


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

On branches: master,mlpack-1.0.x
Link       : https://github.com/mlpack/mlpack/compare/904762495c039e345beba14c1142fd719b3bd50e...f94823c800ad6f7266995c700b1b630d5ffdcf40

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

commit 9fa36cf132c49e4671f4443d229f188cc48edd78
Author: Ryan Curtin <ryan at ratml.org>
Date:   Mon Feb 10 14:10:55 2014 +0000

    Minor fixes to ToString().


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

9fa36cf132c49e4671f4443d229f188cc48edd78
 src/mlpack/core/metrics/lmetric_impl.hpp              |  8 +++++---
 src/mlpack/core/metrics/mahalanobis_distance_impl.hpp | 18 +++++++++---------
 2 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/src/mlpack/core/metrics/lmetric_impl.hpp b/src/mlpack/core/metrics/lmetric_impl.hpp
index 14b8db4..8cc81c5 100644
--- a/src/mlpack/core/metrics/lmetric_impl.hpp
+++ b/src/mlpack/core/metrics/lmetric_impl.hpp
@@ -29,12 +29,14 @@ double LMetric<Power, TakeRoot>::Evaluate(const VecType1& a,
   return pow(sum, (1.0 / Power));
 }
 
-// String Conversion
+// String conversion.
 template<int Power, bool TakeRoot>
-std::string LMetric<Power,TakeRoot>::ToString() const
+std::string LMetric<Power, TakeRoot>::ToString() const
 {
   std::ostringstream convert;
-  convert << "LMetric [" << this << "]" << std::endl;;
+  convert << "LMetric [" << this << "]" << std::endl;
+  convert << "  Power: " << Power << std::endl;
+  convert << "  TakeRoot: " << (TakeRoot ? "true" : "false") << std::endl;
   return convert.str();
 }
 
diff --git a/src/mlpack/core/metrics/mahalanobis_distance_impl.hpp b/src/mlpack/core/metrics/mahalanobis_distance_impl.hpp
index 73d93e2..9ca3510 100644
--- a/src/mlpack/core/metrics/mahalanobis_distance_impl.hpp
+++ b/src/mlpack/core/metrics/mahalanobis_distance_impl.hpp
@@ -12,15 +12,6 @@
 namespace mlpack {
 namespace metric {
 
-
-// Convert Object into String
-template<bool TakeRoot>
-std::string MahalanobisDistance<TakeRoot>::ToString() const{
-  std::ostringstream convert;
-  convert << "MahalanobisDistance [" << this << "]" << std::endl;
-  return convert.str();
-}
-
 /**
  * Specialization for non-rooted case.
  */
@@ -51,6 +42,15 @@ double MahalanobisDistance<true>::Evaluate(const VecType1& a,
   return sqrt(out[0]);
 }
 
+// Convert object into string.
+template<bool TakeRoot>
+std::string MahalanobisDistance<TakeRoot>::ToString() const
+{
+  std::ostringstream convert;
+  convert << "MahalanobisDistance [" << this << "]" << std::endl;
+  return convert.str();
+}
+
 }; // namespace metric
 }; // namespace mlpack
 



More information about the mlpack-git mailing list