You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ce...@apache.org on 2012/06/06 05:56:02 UTC

svn commit: r1346729 - /commons/proper/math/trunk/src/test/java/org/apache/commons/math3/linear/RealVectorAbstractTest.java

Author: celestin
Date: Wed Jun  6 03:56:02 2012
New Revision: 1346729

URL: http://svn.apache.org/viewvc?rev=1346729&view=rev
Log:
MATH-795: in RealVectorAbstractTest, added method getPreferredEntryValue()
which allows testing vectors with some entries set to a preferred value (e.g. 0
for sparse vectors).

Modified:
    commons/proper/math/trunk/src/test/java/org/apache/commons/math3/linear/RealVectorAbstractTest.java

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math3/linear/RealVectorAbstractTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math3/linear/RealVectorAbstractTest.java?rev=1346729&r1=1346728&r2=1346729&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math3/linear/RealVectorAbstractTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math3/linear/RealVectorAbstractTest.java Wed Jun  6 03:56:02 2012
@@ -80,6 +80,21 @@ public abstract class RealVectorAbstract
      */
     public abstract RealVector createAlien(double[] data);
 
+    /**
+     * Returns a preferred value of the entries, to be tested specifically. Some
+     * implementations of {@link RealVector} (e.g. {@link OpenMapRealVector}) do
+     * not store specific values of entries. In order to ensure that all tests
+     * take into account this specific value, some entries of the vectors to be
+     * tested are deliberately set to the value returned by the present method.
+     * The default implementation returns {@code 0.0}.
+     *
+     * @return a value which <em>should</em> be present in all vectors to be
+     * tested
+     */
+    public double getPreferredEntryValue() {
+        return 0.0;
+    }
+
     /** verifies that two vectors are close (sup norm) */
     protected void assertClose(String msg, double[] m, double[] n,
             double tolerance) {