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.


git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@1353141 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Sebastien Brisard 2012-06-23 15:12:34 +00:00
parent 1977d4d968
commit 2881c10609
5 changed files with 28 additions and 12 deletions

View File

@ -52,6 +52,11 @@ If the output is not quite correct, check for invisible trailing spaces!
<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

View File

@ -115,7 +115,7 @@ public abstract class IterativeLinearSolver {
* @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 IterativeLinearSolver {
* @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 IterativeLinearSolver {
* @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,

View File

@ -88,7 +88,7 @@ public abstract class PreconditionedIterativeLinearSolver
* @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 PreconditionedIterativeLinearSolver
* @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 PreconditionedIterativeLinearSolver
* @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

View File

@ -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

View File

@ -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>();
}