public class DefaultIterativeLinearSolverEvent extends IterativeLinearSolverEvent
IterativeLinearSolverEvent
.source
Constructor and Description |
---|
DefaultIterativeLinearSolverEvent(Object source,
int iterations,
RealVector x,
RealVector b,
double rnorm)
Creates a new instance of this class.
|
DefaultIterativeLinearSolverEvent(Object source,
int iterations,
RealVector x,
RealVector b,
RealVector r,
double rnorm)
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 x, RealVector b, RealVector r, double rnorm)
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
MathRuntimeException
, and
providesResidual()
returns false
.source
- the iterative solver which fired this eventiterations
- the number of iterations performed at the time
this
event is createdx
- the current estimate of the solutionb
- the right-hand side vectorr
- the current estimate of the residual (can be null
)rnorm
- the norm of the current estimate of the residualpublic DefaultIterativeLinearSolverEvent(Object source, int iterations, RealVector x, RealVector b, double rnorm)
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
MathRuntimeException
, while
providesResidual()
returns false
.source
- the iterative solver which fired this eventiterations
- the number of iterations performed at the time
this
event is createdx
- the current estimate of the solutionb
- the right-hand side vectorrnorm
- 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
MathRuntimeException
,IterativeLinearSolverEvent.providesResidual()
returns false
.
The default implementation throws a
MathRuntimeException
. If this method is overriden,
then IterativeLinearSolverEvent.providesResidual()
should be overriden as well.
MathRuntimeException
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 © 2016–2020 Hipparchus.org. All rights reserved.