[mlpack-svn] r14234 - mlpack/branches/mlpack-1.x/src/mlpack/core/math

fastlab-svn at coffeetalk-1.cc.gatech.edu fastlab-svn at coffeetalk-1.cc.gatech.edu
Fri Feb 8 15:26:04 EST 2013


Author: rcurtin
Date: 2013-02-08 15:26:03 -0500 (Fri, 08 Feb 2013)
New Revision: 14234

Modified:
   mlpack/branches/mlpack-1.x/src/mlpack/core/math/
   mlpack/branches/mlpack-1.x/src/mlpack/core/math/range.hpp
   mlpack/branches/mlpack-1.x/src/mlpack/core/math/range_impl.hpp
Log:
Output for Range.



Property changes on: mlpack/branches/mlpack-1.x/src/mlpack/core/math
___________________________________________________________________
Added: svn:mergeinfo
   + /mlpack/trunk/src/mlpack/core/math:13981-14233

Modified: mlpack/branches/mlpack-1.x/src/mlpack/core/math/range.hpp
===================================================================
--- mlpack/branches/mlpack-1.x/src/mlpack/core/math/range.hpp	2013-02-08 20:25:46 UTC (rev 14233)
+++ mlpack/branches/mlpack-1.x/src/mlpack/core/math/range.hpp	2013-02-08 20:26:03 UTC (rev 14234)
@@ -156,6 +156,11 @@
    */
   inline bool Contains(const Range& r) const;
 
+  /**
+   * Returns a string representation of an object.
+   */
+  inline std::string ToString() const;
+
 };
 
 }; // namespace math

Modified: mlpack/branches/mlpack-1.x/src/mlpack/core/math/range_impl.hpp
===================================================================
--- mlpack/branches/mlpack-1.x/src/mlpack/core/math/range_impl.hpp	2013-02-08 20:25:46 UTC (rev 14233)
+++ mlpack/branches/mlpack-1.x/src/mlpack/core/math/range_impl.hpp	2013-02-08 20:26:03 UTC (rev 14234)
@@ -8,6 +8,7 @@
 
 #include "range.hpp"
 #include <float.h>
+#include <sstream>
 
 namespace mlpack {
 namespace math {
@@ -172,6 +173,15 @@
 {
   return lo <= r.hi;
 }
+/**
+ * Returns a string representation of an object.
+ */
+std::string Range::ToString() const
+{
+  std::ostringstream convert;
+  convert << "[" << lo << ", " << hi << "]";
+  return convert.str();
+}
 
 }; // namesapce math
 }; // namespace mlpack




More information about the mlpack-svn mailing list