You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by lu...@apache.org on 2014/02/20 17:16:19 UTC

svn commit: r1570254 - in /commons/proper/math/trunk/src: changes/ main/java/org/apache/commons/math3/linear/ test/java/org/apache/commons/math3/linear/

Author: luc
Date: Thu Feb 20 16:16:19 2014
New Revision: 1570254

URL: http://svn.apache.org/r1570254
Log:
Relaxed specification for function mapping on vectors.

JIRA: MATH-821

Modified:
    commons/proper/math/trunk/src/changes/changes.xml
    commons/proper/math/trunk/src/main/java/org/apache/commons/math3/linear/OpenMapRealVector.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math3/linear/SparseRealVector.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math3/linear/RealVectorAbstractTest.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math3/linear/SparseRealVectorTest.java

Modified: commons/proper/math/trunk/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/changes/changes.xml?rev=1570254&r1=1570253&r2=1570254&view=diff
==============================================================================
--- commons/proper/math/trunk/src/changes/changes.xml (original)
+++ commons/proper/math/trunk/src/changes/changes.xml Thu Feb 20 16:16:19 2014
@@ -51,9 +51,13 @@ If the output is not quite correct, chec
   </properties>
   <body>
     <release version="3.3" date="TBD" description="TBD">
+      <action dev="luc" type="fix" issue="MATH-821">
+        Relaxed specification for function mapping on vectors, thus allowing straightforward
+        implementation for sparse vectors.
+      </action>
       <action dev="luc" type="update" issue="MATH-1099" due-to="Evan Ward">
-	    Make QR the default in GaussNewtonOptimizer.
-	  </action>
+        Make QR the default in GaussNewtonOptimizer.
+      </action>
       <action dev="luc" type="update" issue="MATH-1099" due-to="Evan Ward">
 	    Add Cholesky option to GaussNewtonOptimizer.
 	  </action>

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/linear/OpenMapRealVector.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/linear/OpenMapRealVector.java?rev=1570254&r1=1570253&r2=1570254&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math3/linear/OpenMapRealVector.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math3/linear/OpenMapRealVector.java Thu Feb 20 16:16:19 2014
@@ -35,7 +35,8 @@ import org.apache.commons.math3.util.Ope
  *  the equality {@code x * 0d == 0d} holds. But it is is not true for
  *  {@code NaN}. Moreover, zero entries will lose their sign.
  *  Some operations (that involve {@code NaN} and/or infinities) may
- *  thus give incorrect results.
+ *  thus give incorrect results, like multiplications, divisions or
+ *  functions mapping.
  * </p>
  * @version $Id$
  * @since 2.0

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/linear/SparseRealVector.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/linear/SparseRealVector.java?rev=1570254&r1=1570253&r2=1570254&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math3/linear/SparseRealVector.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math3/linear/SparseRealVector.java Thu Feb 20 16:16:19 2014
@@ -23,7 +23,8 @@ package org.apache.commons.math3.linear;
  *  the equality {@code x * 0d == 0d} holds. But it is is not true for
  *  {@code NaN}. Moreover, zero entries will lose their sign.
  *  Some operations (that involve {@code NaN} and/or infinities) may
- *  thus give incorrect results.
+ *  thus give incorrect results, like multiplications, divisions or
+ *  functions mapping.
  * </p>
  * @version $Id$
  * @since 2.0

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=1570254&r1=1570253&r2=1570254&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 Thu Feb 20 16:16:19 2014
@@ -871,7 +871,7 @@ public abstract class RealVectorAbstract
         TestUtils.assertEquals(f.getClass().getSimpleName(), expected, actual, 1E-16);
     }
 
-    private UnivariateFunction[] createFunctions() {
+    protected UnivariateFunction[] createFunctions() {
         return new UnivariateFunction[] {
             new Power(2.0), new Exp(), new Expm1(), new Log(), new Log10(),
             new Log1p(), new Cosh(), new Sinh(), new Tanh(), new Cos(),

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math3/linear/SparseRealVectorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math3/linear/SparseRealVectorTest.java?rev=1570254&r1=1570253&r2=1570254&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math3/linear/SparseRealVectorTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math3/linear/SparseRealVectorTest.java Thu Feb 20 16:16:19 2014
@@ -16,9 +16,28 @@
  */
 package org.apache.commons.math3.linear;
 
-import org.apache.commons.math3.linear.RealVectorAbstractTest.BinaryOperation;
+import org.apache.commons.math3.analysis.UnivariateFunction;
+import org.apache.commons.math3.analysis.function.Abs;
+import org.apache.commons.math3.analysis.function.Acos;
+import org.apache.commons.math3.analysis.function.Asin;
+import org.apache.commons.math3.analysis.function.Atan;
+import org.apache.commons.math3.analysis.function.Cbrt;
+import org.apache.commons.math3.analysis.function.Ceil;
+import org.apache.commons.math3.analysis.function.Cos;
+import org.apache.commons.math3.analysis.function.Cosh;
+import org.apache.commons.math3.analysis.function.Exp;
+import org.apache.commons.math3.analysis.function.Expm1;
+import org.apache.commons.math3.analysis.function.Floor;
+import org.apache.commons.math3.analysis.function.Log1p;
+import org.apache.commons.math3.analysis.function.Power;
+import org.apache.commons.math3.analysis.function.Rint;
+import org.apache.commons.math3.analysis.function.Signum;
+import org.apache.commons.math3.analysis.function.Sin;
+import org.apache.commons.math3.analysis.function.Sinh;
+import org.apache.commons.math3.analysis.function.Sqrt;
+import org.apache.commons.math3.analysis.function.Tan;
+import org.apache.commons.math3.analysis.function.Tanh;
 import org.junit.Assert;
-import org.junit.Ignore;
 import org.junit.Test;
 
 /**
@@ -118,23 +137,15 @@ public class SparseRealVectorTest extend
         doTestEbeBinaryOperation(BinaryOperation.DIV, false, true);
     }
 
-    /**
-     * XXX This test is disabled because it currently fails.
-     * The bug must still be fixed in the sparse vector implementation.
-     * When this is done, this override should be deleted.
-     */
-    @Test
     @Override
-    @Ignore("This test is skipped until MATH-821 is fixed")
-    public void testMap() {}
+    protected UnivariateFunction[] createFunctions() {
+        return new UnivariateFunction[] {
+            new Power(2.0), new Exp(), new Expm1(),
+            new Log1p(), new Cosh(), new Sinh(), new Tanh(), new Cos(),
+            new Sin(), new Tan(), new Acos(), new Asin(), new Atan(),
+            new Abs(), new Sqrt(), new Cbrt(), new Ceil(),
+            new Floor(), new Rint(), new Signum()
+        };
+    }
 
-    /**
-     * XXX This test is disabled because it currently fails.
-     * The bug must still be fixed in the sparse vector implementation.
-     * When this is done, this override should be deleted.
-     */
-    @Test
-    @Override
-    @Ignore("This test is skipped until MATH-821 is fixed")
-    public void testMapToSelf() {}
 }