[mlpack-svn] r10518 - mlpack/trunk/src/mlpack/core/math

fastlab-svn at coffeetalk-1.cc.gatech.edu fastlab-svn at coffeetalk-1.cc.gatech.edu
Fri Dec 2 17:18:09 EST 2011


Author: rcurtin
Date: 2011-12-02 17:18:09 -0500 (Fri, 02 Dec 2011)
New Revision: 10518

Modified:
   mlpack/trunk/src/mlpack/core/math/range.cpp
   mlpack/trunk/src/mlpack/core/math/range.hpp
Log:
Add (as-of-yet) untested Range::Contains(const Range&).


Modified: mlpack/trunk/src/mlpack/core/math/range.cpp
===================================================================
--- mlpack/trunk/src/mlpack/core/math/range.cpp	2011-12-02 22:07:57 UTC (rev 10517)
+++ mlpack/trunk/src/mlpack/core/math/range.cpp	2011-12-02 22:18:09 UTC (rev 10518)
@@ -162,5 +162,13 @@
   return d >= lo && d <= hi;
 }
 
+/**
+ * Determines if this range overlaps with another range.
+ */
+bool Range::Contains(const Range& r) const
+{
+  return lo <= r.hi;
+}
+
 }; // namesapce math
 }; // namespace mlpack

Modified: mlpack/trunk/src/mlpack/core/math/range.hpp
===================================================================
--- mlpack/trunk/src/mlpack/core/math/range.hpp	2011-12-02 22:07:57 UTC (rev 10517)
+++ mlpack/trunk/src/mlpack/core/math/range.hpp	2011-12-02 22:18:09 UTC (rev 10518)
@@ -136,6 +136,15 @@
    */
   bool Contains(const double d) const;
 
+  /**
+   * Determines if another range overlaps with this one.
+   *
+   * @param r Other range.
+   *
+   * @return true if ranges overlap at all.
+   */
+  bool Contains(const Range& r) const;
+
 };
 
 }; // namespace math




More information about the mlpack-svn mailing list