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/22 09:06:30 UTC
svn commit: r1352782 - in /commons/proper/math/trunk/src:
main/java/org/apache/commons/math3/linear/
test/java/org/apache/commons/math3/linear/
Author: celestin
Date: Fri Jun 22 07:06:28 2012
New Revision: 1352782
URL: http://svn.apache.org/viewvc?rev=1352782&view=rev
Log:
MATH-803 : deprecated RealVector.ebeMultiply() and RealVector.ebeDivide(), and
updated unit tests accordingly.
Modified:
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/linear/RealVector.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/UnmodifiableRealVectorAbstractTest.java
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/linear/RealVector.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/linear/RealVector.java?rev=1352782&r1=1352781&r2=1352782&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math3/linear/RealVector.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math3/linear/RealVector.java Fri Jun 22 07:06:28 2012
@@ -336,7 +336,17 @@ public abstract class RealVector {
* @return a vector containing this[i] / v[i] for all i.
* @throws org.apache.commons.math3.exception.DimensionMismatchException
* if {@code v} is not the same size as this vector.
+ * @deprecated As of version 3.1, this method is deprecated, and will be
+ * removed in version 4.0. This decision follows the discussion reported in
+ * <a href="https://issues.apache.org/jira/browse/MATH-803?focusedCommentId=13399150#comment-13399150">MATH-803</a>.
+ * Uses of this method involving sparse implementations of
+ * {@link RealVector} might lead to wrong results. Since there is no
+ * satisfactory correction to this bug, this method is deprecated. Users who
+ * want to preserve this feature are advised to implement
+ * {@link RealVectorPreservingVisitor} (possibly ignoring corner cases for
+ * the sake of efficiency).
*/
+ @Deprecated
public abstract RealVector ebeDivide(RealVector v);
/**
@@ -346,7 +356,17 @@ public abstract class RealVector {
* @return a vector containing this[i] * v[i] for all i.
* @throws org.apache.commons.math3.exception.DimensionMismatchException
* if {@code v} is not the same size as this vector.
+ * @deprecated As of version 3.1, this method is deprecated, and will be
+ * removed in version 4.0. This decision follows the discussion reported in
+ * <a href="https://issues.apache.org/jira/browse/MATH-803?focusedCommentId=13399150#comment-13399150">MATH-803</a>.
+ * Uses of this method involving sparse implementations of
+ * {@link RealVector} might lead to wrong results. Since there is no
+ * satisfactory correction to this bug, this method is deprecated. Users who
+ * want to preserve this feature are advised to implement
+ * {@link RealVectorPreservingVisitor} (possibly ignoring corner cases for
+ * the sake of efficiency).
*/
+ @Deprecated
public abstract RealVector ebeMultiply(RealVector v);
/**
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=1352782&r1=1352781&r2=1352782&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 Fri Jun 22 07:06:28 2012
@@ -53,6 +53,7 @@ import org.apache.commons.math3.exceptio
import org.apache.commons.math3.util.FastMath;
import org.apache.commons.math3.util.MathArrays;
import org.junit.Assert;
+import org.junit.Ignore;
import org.junit.Test;
@@ -463,9 +464,14 @@ public abstract class RealVectorAbstract
*
* The values to be considered are: x, y, z, x * x.
*
- * Also to be considered NaN, POSITIVE_INFINITY, NEGATIVE_INFINITY.
+ * Also to be considered NaN, POSITIVE_INFINITY, NEGATIVE_INFINITY,
+ * +0.0, -0.0.
*/
- final double[] values = {x, y, z, 2 * x, -x, 1 / x, x * x, x + y, x - y, y - x};
+ final double[] values =
+ {
+ Double.NaN, Double.POSITIVE_INFINITY, Double.NEGATIVE_INFINITY,
+ 0d, -0d, x, y, z, 2 * x, -x, 1 / x, x * x, x + y, x - y, y - x
+ };
final double[] data1 = new double[values.length * values.length];
final double[] data2 = new double[values.length * values.length];
int k = 0;
@@ -570,31 +576,37 @@ public abstract class RealVectorAbstract
doTestEbeBinaryOperationDimensionMismatch(BinaryOperation.SUB);
}
+ @Ignore("ebeMultiply(RealVector) is known to be faulty (MATH-803) and is deprecated.")
@Test
public void testEbeMultiplySameType() {
doTestEbeBinaryOperation(BinaryOperation.MUL, false);
}
+ @Ignore("ebeMultiply(RealVector) is known to be faulty (MATH-803) and is deprecated.")
@Test
public void testEbeMultiplyMixedTypes() {
doTestEbeBinaryOperation(BinaryOperation.MUL, true);
}
+ @Ignore("ebeMultiply(RealVector) is known to be faulty (MATH-803) and is deprecated.")
@Test(expected = DimensionMismatchException.class)
public void testEbeMultiplyDimensionMismatch() {
doTestEbeBinaryOperationDimensionMismatch(BinaryOperation.MUL);
}
+ @Ignore("ebeDivide(RealVector) is known to be faulty (MATH-803) and is deprecated.")
@Test
public void testEbeDivideSameType() {
doTestEbeBinaryOperation(BinaryOperation.DIV, false);
}
+ @Ignore("ebeDivide(RealVector) is known to be faulty (MATH-803) and is deprecated.")
@Test
public void testEbeDivideMixedTypes() {
doTestEbeBinaryOperation(BinaryOperation.DIV, true);
}
+ @Ignore("ebeDivide(RealVector) is known to be faulty (MATH-803) and is deprecated.")
@Test(expected = DimensionMismatchException.class)
public void testEbeDivideDimensionMismatch() {
doTestEbeBinaryOperationDimensionMismatch(BinaryOperation.DIV);
Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math3/linear/UnmodifiableRealVectorAbstractTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math3/linear/UnmodifiableRealVectorAbstractTest.java?rev=1352782&r1=1352781&r2=1352782&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math3/linear/UnmodifiableRealVectorAbstractTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math3/linear/UnmodifiableRealVectorAbstractTest.java Fri Jun 22 07:06:28 2012
@@ -64,6 +64,8 @@ public abstract class UnmodifiableRealVe
EXCLUDE.add("sparseIterator");
EXCLUDE.add("walkInDefaultOrder");
EXCLUDE.add("walkInOptimizedOrder");
+ EXCLUDE.add("ebeDivide");
+ EXCLUDE.add("ebeMultiply");
// Excluded because they are inherited from "Object".
for (Method m : Object.class.getMethods()) {