public class DefaultIterativeLinearSolverEvent extends IterativeLinearSolverEvent
IterativeLinearSolverEvent
.source
Constructor and Description |
---|
DefaultIterativeLinearSolverEvent(Object source,
int iterations,
RealVector xIn,
RealVector bIn,
double rnormIn)
Creates a new instance of this class.
|
DefaultIterativeLinearSolverEvent(Object source,
int iterations,
RealVector xIn,
RealVector bIn,
RealVector rIn,
double rnormIn)
Creates a new instance of this class.
|
Modifier and Type | Method and Description |
---|---|
double |
getNormOfResidual()
Returns the norm of the residual.
|
RealVector |
getResidual()
Returns the residual.
|
RealVector |
getRightHandSideVector()
Returns the current right-hand side of the linear system to be solved.
|
RealVector |
getSolution()
Returns the current estimate of the solution to the linear system to be
solved.
|
boolean |
providesResidual()
Returns
true if IterativeLinearSolverEvent.getResidual() is supported. |
getIterations
getSource, toString
public DefaultIterativeLinearSolverEvent(Object source, int iterations, RealVector xIn, RealVector bIn, RealVector rIn, double rnormIn)
x
, b
, r
. Therefore the user must make sure that these vectors are
either unmodifiable views or deep copies of the same vectors actually
used by the source
. Failure to do so may compromise subsequent
iterations of the source
. If the residual vector r
is null
, then getResidual()
throws a MathUnsupportedOperationException
, and providesResidual()
returns false
.source
- the iterative solver which fired this eventiterations
- the number of iterations performed at the time this
event is createdxIn
- the current estimate of the solutionbIn
- the right-hand side vectorrIn
- the current estimate of the residual (can be null
)rnormIn
- the norm of the current estimate of the residualpublic DefaultIterativeLinearSolverEvent(Object source, int iterations, RealVector xIn, RealVector bIn, double rnormIn)
x
, b
.
Therefore the user must make sure that these vectors are either
unmodifiable views or deep copies of the same vectors actually used by
the source
. Failure to do so may compromise subsequent iterations
of the source
. Callling getResidual()
on instances
returned by this constructor throws a MathUnsupportedOperationException
, while
providesResidual()
returns false
.source
- the iterative solver which fired this eventiterations
- the number of iterations performed at the time this
event is createdxIn
- the current estimate of the solutionbIn
- the right-hand side vectorrnormIn
- the norm of the current estimate of the residualpublic double getNormOfResidual()
conjugate gradient
method computes a sequence
of residuals, the norm of which is cheap to compute. However, due to
accumulation of round-off errors, this residual might differ from the
true residual after some iterations. See e.g. A. Greenbaum and
Z. Strakos, Predicting the Behavior of Finite Precision Lanzos and
Conjugate Gradient Computations, Technical Report 538, Department of
Computer Science, New York University, 1991 (available
here).getNormOfResidual
in class IterativeLinearSolverEvent
public RealVector getResidual()
Returns the residual. This is an optional operation, as all iterative linear solvers do not provide cheap estimate of the updated residual vector, in which case
MathUnsupportedOperationException
,IterativeLinearSolverEvent.providesResidual()
returns false
.
The default implementation throws a MathUnsupportedOperationException
. If this method is overriden, then
IterativeLinearSolverEvent.providesResidual()
should be overriden as well.
MathUnsupportedOperationException
if no residual vector r
was
provided at construction time.getResidual
in class IterativeLinearSolverEvent
public RealVector getRightHandSideVector()
IterativeLinearSolver
.getRightHandSideVector
in class IterativeLinearSolverEvent
public RealVector getSolution()
IterativeLinearSolver
.getSolution
in class IterativeLinearSolverEvent
public boolean providesResidual()
true
if IterativeLinearSolverEvent.getResidual()
is supported. The default
implementation returns false
.
This implementation returns true
if a non-null
value was
specified for the residual vector r
at construction time.providesResidual
in class IterativeLinearSolverEvent
true
if r != null
Copyright © 2019 CNES. All rights reserved.