commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From celes...@apache.org
Subject svn commit: r1348438 - /commons/proper/math/trunk/src/main/java/org/apache/commons/math3/linear/RealVector.java
Date Sat, 09 Jun 2012 16:00:06 GMT
Author: celestin
Date: Sat Jun  9 16:00:05 2012
New Revision: 1348438

URL: http://svn.apache.org/viewvc?rev=1348438&view=rev
Log:
MATH-795: in RealVector.add(RealVector) and RealVector.subtract(RealVector)
(default implementation), exceptional cases were not handled properly.

Modified:
    commons/proper/math/trunk/src/main/java/org/apache/commons/math3/linear/RealVector.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=1348438&r1=1348437&r2=1348438&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
Sat Jun  9 16:00:05 2012
@@ -228,6 +228,7 @@ public abstract class RealVector {
      * if {@code v} is not the same size as this vector.
      */
     public RealVector add(RealVector v) {
+        checkVectorDimensions(v);
         RealVector result = v.copy();
         Iterator<Entry> it = sparseIterator();
         while (it.hasNext()) {
@@ -248,6 +249,7 @@ public abstract class RealVector {
      * if {@code v} is not the same size as this vector.
      */
     public RealVector subtract(RealVector v) {
+        checkVectorDimensions(v);
         RealVector result = v.mapMultiply(-1d);
         Iterator<Entry> it = sparseIterator();
         while (it.hasNext()) {



Mime
View raw message