public abstract class PreconditionedIterativeLinearSolver extends IterativeLinearSolver
This abstract class defines preconditioned iterative solvers. When A is ill-conditioned, instead of solving system A · x = b directly, it is preferable to solve M-1 · A · x = M-1 · b, where M approximates in some way A, while remaining comparatively easier to invert. M (not M-1!) is called the preconditionner.
Concrete implementations of this abstract class must be provided with
M-1, the inverse of the preconditioner, as a
RealLinearOperator.
| Constructor and Description |
|---|
PreconditionedIterativeLinearSolver(int maxIterations)
Creates a new instance of this class, with default iteration manager.
|
PreconditionedIterativeLinearSolver(IterationManager manager)
Creates a new instance of this class, with custom iteration manager.
|
| Modifier and Type | Method and Description |
|---|---|
protected static void |
checkParameters(RealLinearOperator a,
RealLinearOperator minv,
RealVector b,
RealVector x0)
Performs all dimension checks on the parameters of
solve
and
solveInPlace,
and throws an exception if one of the checks fails. |
RealVector |
solve(RealLinearOperator a,
RealLinearOperator minv,
RealVector b)
Returns an estimate of the solution to the linear system A · x =
b.
|
RealVector |
solve(RealLinearOperator a,
RealLinearOperator minv,
RealVector b,
RealVector x0)
Returns an estimate of the solution to the linear system A · x =
b.
|
RealVector |
solve(RealLinearOperator a,
RealVector b)
Returns an estimate of the solution to the linear system A · x =
b.
|
RealVector |
solve(RealLinearOperator a,
RealVector b,
RealVector x0)
Returns an estimate of the solution to the linear system A · x =
b.
|
abstract RealVector |
solveInPlace(RealLinearOperator a,
RealLinearOperator minv,
RealVector b,
RealVector x0)
Returns an estimate of the solution to the linear system A · x =
b.
|
RealVector |
solveInPlace(RealLinearOperator a,
RealVector b,
RealVector x0)
Returns an estimate of the solution to the linear system A · x =
b.
|
checkParameters, getIterationManagerpublic PreconditionedIterativeLinearSolver(int maxIterations)
maxIterations - the maximum number of iterationspublic PreconditionedIterativeLinearSolver(IterationManager manager) throws NullArgumentException
manager - the custom iteration managerNullArgumentException - if manager is nullpublic RealVector solve(RealLinearOperator a, RealLinearOperator minv, RealVector b, RealVector x0) throws NullArgumentException, NonSquareOperatorException, DimensionMismatchException, MaxCountExceededException
a - the linear operator A of the systemminv - the inverse of the preconditioner, M-1
(can be null)b - the right-hand side vectorx0 - the initial guess of the solutionNullArgumentException - if one of the parameters is nullNonSquareOperatorException - if a or minv is not
squareDimensionMismatchException - if minv, b or
x0 have dimensions inconsistent with aMaxCountExceededException - at exhaustion of the iteration count,
unless a custom
callback
has been set at constructionpublic RealVector solve(RealLinearOperator a, RealVector b) throws NullArgumentException, NonSquareOperatorException, DimensionMismatchException, MaxCountExceededException
solve in class IterativeLinearSolvera - the linear operator A of the systemb - the right-hand side vectorNullArgumentException - if one of the parameters is nullNonSquareOperatorException - if a is not squareDimensionMismatchException - if b has dimensions
inconsistent with aMaxCountExceededException - at exhaustion of the iteration count,
unless a custom
callback
has been set at constructionpublic RealVector solve(RealLinearOperator a, RealVector b, RealVector x0) throws NullArgumentException, NonSquareOperatorException, DimensionMismatchException, MaxCountExceededException
solve in class IterativeLinearSolvera - the linear operator A of the systemb - the right-hand side vectorx0 - the initial guess of the solutionNullArgumentException - if one of the parameters is nullNonSquareOperatorException - if a is not squareDimensionMismatchException - if b or x0 have
dimensions inconsistent with aMaxCountExceededException - at exhaustion of the iteration count,
unless a custom
callback
has been set at constructionprotected static void checkParameters(RealLinearOperator a, RealLinearOperator minv, RealVector b, RealVector x0) throws NullArgumentException, NonSquareOperatorException, DimensionMismatchException
solve
and
solveInPlace,
and throws an exception if one of the checks fails.a - the linear operator A of the systemminv - the inverse of the preconditioner, M-1
(can be null)b - the right-hand side vectorx0 - the initial guess of the solutionNullArgumentException - if one of the parameters is nullNonSquareOperatorException - if a or minv is not
squareDimensionMismatchException - if minv, b or
x0 have dimensions inconsistent with apublic RealVector solve(RealLinearOperator a, RealLinearOperator minv, RealVector b) throws NullArgumentException, NonSquareOperatorException, DimensionMismatchException, MaxCountExceededException
a - the linear operator A of the systemminv - the inverse of the preconditioner, M-1
(can be null)b - the right-hand side vectorNullArgumentException - if one of the parameters is nullNonSquareOperatorException - if a or minv is not
squareDimensionMismatchException - if minv or b have
dimensions inconsistent with aMaxCountExceededException - at exhaustion of the iteration count,
unless a custom
callback
has been set at constructionpublic abstract RealVector solveInPlace(RealLinearOperator a, RealLinearOperator minv, RealVector b, RealVector x0) throws NullArgumentException, NonSquareOperatorException, DimensionMismatchException, MaxCountExceededException
a - the linear operator A of the systemminv - the inverse of the preconditioner, M-1
(can be null)b - the right-hand side vectorx0 - the initial guess of the solutionx0 (shallow copy) updated with the
solutionNullArgumentException - if one of the parameters is nullNonSquareOperatorException - if a or minv is not
squareDimensionMismatchException - if minv, b or
x0 have dimensions inconsistent with aMaxCountExceededException - at exhaustion of the iteration count,
unless a custom
callback
has been set at construction.public RealVector solveInPlace(RealLinearOperator a, RealVector b, RealVector x0) throws NullArgumentException, NonSquareOperatorException, DimensionMismatchException, MaxCountExceededException
solveInPlace in class IterativeLinearSolvera - the linear operator A of the systemb - the right-hand side vectorx0 - initial guess of the solutionx0 (shallow copy) updated with the
solutionNullArgumentException - if one of the parameters is nullNonSquareOperatorException - if a is not squareDimensionMismatchException - if b or x0 have
dimensions inconsistent with aMaxCountExceededException - at exhaustion of the iteration count,
unless a custom
callback
has been set at constructionCopyright © 2003-2012 The Apache Software Foundation. All Rights Reserved.