commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From celes...@apache.org
Subject svn commit: r1353141 - in /commons/proper/math/trunk/src: changes/ main/java/org/apache/commons/math3/linear/ main/java/org/apache/commons/math3/util/
Date Sat, 23 Jun 2012 15:12:36 GMT
Author: celestin
Date: Sat Jun 23 15:12:34 2012
New Revision: 1353141

URL: http://svn.apache.org/viewvc?rev=1353141&view=rev
Log:
MATH-807: in o.a.c.m3.util.IterationManager, created a new constructor which allows for the
specification of a o.a.c.m3.util.Incrementor.MaxCountExceededCallback, to be called when the
maximum number of iterations is reached.
Updated the javadoc of iterative linear solvers accordingly.

Modified:
    commons/proper/math/trunk/src/changes/changes.xml
    commons/proper/math/trunk/src/main/java/org/apache/commons/math3/linear/IterativeLinearSolver.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math3/linear/PreconditionedIterativeLinearSolver.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math3/linear/SymmLQ.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math3/util/IterationManager.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=1353141&r1=1353140&r2=1353141&view=diff
==============================================================================
--- commons/proper/math/trunk/src/changes/changes.xml (original)
+++ commons/proper/math/trunk/src/changes/changes.xml Sat Jun 23 15:12:34 2012
@@ -52,6 +52,11 @@ If the output is not quite correct, chec
   <body>
     <release version="3.1" date="TBD" description="
 ">
+      <action dev="celestin" type="add" issue="MATH-807">
+        Added a new constructor to o.a.c.m.utils.IterationManager, allowing
+        for the specification of a callback function in case the maximum
+        number of iteration is reached.
+      </action>
       <action dev="luc" type="add">
         A new HermiteInterpolator class allow interpolation of vector-valued
         functions using both values and derivatives of the function at sample

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/linear/IterativeLinearSolver.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/linear/IterativeLinearSolver.java?rev=1353141&r1=1353140&r2=1353141&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math3/linear/IterativeLinearSolver.java
(original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math3/linear/IterativeLinearSolver.java
Sat Jun 23 15:12:34 2012
@@ -115,7 +115,7 @@ public abstract class IterativeLinearSol
      * @throws MaxCountExceededException at exhaustion of the iteration count,
      * unless a custom
      * {@link org.apache.commons.math3.util.Incrementor.MaxCountExceededCallback callback}
-     * has been set at construction
+     * has been set at construction of the {@link IterationManager}
      */
     public RealVector solve(final RealLinearOperator a, final RealVector b)
         throws NullArgumentException, NonSquareOperatorException,
@@ -141,7 +141,7 @@ public abstract class IterativeLinearSol
      * @throws MaxCountExceededException at exhaustion of the iteration count,
      * unless a custom
      * {@link org.apache.commons.math3.util.Incrementor.MaxCountExceededCallback callback}
-     * has been set at construction
+     * has been set at construction of the {@link IterationManager}
      */
     public RealVector solve(RealLinearOperator a, RealVector b, RealVector x0)
         throws NullArgumentException, NonSquareOperatorException,
@@ -166,7 +166,7 @@ public abstract class IterativeLinearSol
      * @throws MaxCountExceededException at exhaustion of the iteration count,
      * unless a custom
      * {@link org.apache.commons.math3.util.Incrementor.MaxCountExceededCallback callback}
-     * has been set at construction
+     * has been set at construction of the {@link IterationManager}
      */
     public abstract RealVector solveInPlace(RealLinearOperator a, RealVector b,
         RealVector x0) throws NullArgumentException, NonSquareOperatorException,

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/linear/PreconditionedIterativeLinearSolver.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/linear/PreconditionedIterativeLinearSolver.java?rev=1353141&r1=1353140&r2=1353141&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math3/linear/PreconditionedIterativeLinearSolver.java
(original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math3/linear/PreconditionedIterativeLinearSolver.java
Sat Jun 23 15:12:34 2012
@@ -88,7 +88,7 @@ public abstract class PreconditionedIter
      * @throws MaxCountExceededException at exhaustion of the iteration count,
      * unless a custom
      * {@link org.apache.commons.math3.util.Incrementor.MaxCountExceededCallback callback}
-     * has been set at construction
+     * has been set at construction of the {@link IterationManager}
      */
     public RealVector solve(final RealLinearOperator a,
         final RealLinearOperator m, final RealVector b, final RealVector x0)
@@ -169,7 +169,7 @@ public abstract class PreconditionedIter
      * @throws MaxCountExceededException at exhaustion of the iteration count,
      * unless a custom
      * {@link org.apache.commons.math3.util.Incrementor.MaxCountExceededCallback callback}
-     * has been set at construction
+     * has been set at construction of the {@link IterationManager}
      */
     public RealVector solve(RealLinearOperator a, RealLinearOperator m,
         RealVector b) throws NullArgumentException, NonSquareOperatorException,
@@ -197,7 +197,7 @@ public abstract class PreconditionedIter
      * @throws MaxCountExceededException at exhaustion of the iteration count,
      * unless a custom
      * {@link org.apache.commons.math3.util.Incrementor.MaxCountExceededCallback callback}
-     * has been set at construction.
+     * has been set at construction of the {@link IterationManager}
      */
     public abstract RealVector solveInPlace(RealLinearOperator a,
         RealLinearOperator m, RealVector b, RealVector x0) throws

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/linear/SymmLQ.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/linear/SymmLQ.java?rev=1353141&r1=1353140&r2=1353141&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math3/linear/SymmLQ.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math3/linear/SymmLQ.java Sat
Jun 23 15:12:34 2012
@@ -956,7 +956,7 @@ public class SymmLQ
      * @throws MaxCountExceededException at exhaustion of the iteration count,
      * unless a custom
      * {@link org.apache.commons.math3.util.Incrementor.MaxCountExceededCallback callback}
-     * has been set at construction
+     * has been set at construction of the {@link IterationManager}
      * @throws NonSelfAdjointOperatorException if {@link #getCheck()} is
      * {@code true}, and {@code a} or {@code m} is not self-adjoint
      * @throws NonPositiveDefiniteOperatorException if {@code m} is not
@@ -1044,7 +1044,7 @@ public class SymmLQ
      * @throws MaxCountExceededException at exhaustion of the iteration count,
      * unless a custom
      * {@link org.apache.commons.math3.util.Incrementor.MaxCountExceededCallback callback}
-     * has been set at construction
+     * has been set at construction of the {@link IterationManager}
      * @throws NonSelfAdjointOperatorException if {@link #getCheck()} is
      * {@code true}, and {@code a} is not self-adjoint
      * @throws IllConditionedOperatorException if {@code a} is ill-conditioned
@@ -1134,7 +1134,7 @@ public class SymmLQ
      * @throws MaxCountExceededException at exhaustion of the iteration count,
      * unless a custom
      * {@link org.apache.commons.math3.util.Incrementor.MaxCountExceededCallback callback}
-     * has been set at construction
+     * has been set at construction of the {@link IterationManager}
      * @throws NonSelfAdjointOperatorException if {@link #getCheck()} is
      * {@code true}, and {@code a} or {@code m} is not self-adjoint
      * @throws NonPositiveDefiniteOperatorException if {@code m} is not positive

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/util/IterationManager.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/util/IterationManager.java?rev=1353141&r1=1353140&r2=1353141&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math3/util/IterationManager.java
(original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math3/util/IterationManager.java
Sat Jun 23 15:12:34 2012
@@ -40,11 +40,22 @@ public class IterationManager {
     /**
      * Creates a new instance of this class.
      *
-     * @param maxIterations Maximum number of iterations.
+     * @param maxIterations the maximum number of iterations
      */
     public IterationManager(final int maxIterations) {
-        this.iterations = new Incrementor();
-        this.iterations.setMaximalCount(maxIterations);
+        this(maxIterations, null);
+    }
+
+    /**
+     * Creates a new instance of this class.
+     *
+     * @param maxIterations the maximum number of iterations
+     * @param callBack the function to be called when the maximum number of
+     * iterations has been reached (can be {@code null})
+     */
+    public IterationManager(final int maxIterations,
+                            final Incrementor.MaxCountExceededCallback callBack) {
+        this.iterations = new Incrementor(maxIterations, callBack);
         this.listeners = new CopyOnWriteArrayList<IterationListener>();
     }
 



Mime
View raw message