commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From er...@apache.org
Subject svn commit: r1414441 - /commons/proper/math/trunk/src/main/java/org/apache/commons/math3/linear/JacobiPreconditioner.java
Date Tue, 27 Nov 2012 22:27:20 GMT
Author: erans
Date: Tue Nov 27 22:27:17 2012
New Revision: 1414441

URL: http://svn.apache.org/viewvc?rev=1414441&view=rev
Log:
MATH-895
Replaced deprecated method with alternative from "MathArrays".

Modified:
    commons/proper/math/trunk/src/main/java/org/apache/commons/math3/linear/JacobiPreconditioner.java

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/linear/JacobiPreconditioner.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/linear/JacobiPreconditioner.java?rev=1414441&r1=1414440&r2=1414441&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math3/linear/JacobiPreconditioner.java
(original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math3/linear/JacobiPreconditioner.java
Tue Nov 27 22:27:17 2012
@@ -17,6 +17,7 @@
 package org.apache.commons.math3.linear;
 
 import org.apache.commons.math3.analysis.function.Sqrt;
+import org.apache.commons.math3.util.MathArrays;
 
 /**
  * This class implements the standard Jacobi (diagonal) preconditioner. For a
@@ -95,7 +96,9 @@ public class JacobiPreconditioner extend
     @Override
     public RealVector operate(final RealVector x) {
         // Dimension check is carried out by ebeDivide
-        return x.ebeDivide(diag);
+        return new ArrayRealVector(MathArrays.ebeDivide(x.toArray(),
+                                                        diag.toArray()),
+                                   false);
     }
 
     /**
@@ -105,13 +108,15 @@ public class JacobiPreconditioner extend
      *
      * @return the square root of {@code this} preconditioner
      */
-    public RealLinearOperator sqrt(){
+    public RealLinearOperator sqrt() {
         final RealVector sqrtDiag = diag.map(new Sqrt());
         return new RealLinearOperator() {
             /** {@inheritDoc} */
             @Override
             public RealVector operate(final RealVector x) {
-                return x.ebeDivide(sqrtDiag);
+                return new ArrayRealVector(MathArrays.ebeDivide(x.toArray(),
+                                                                sqrtDiag.toArray()),
+                                           false);
             }
 
             /** {@inheritDoc} */



Mime
View raw message