Top Description Fields Constructors Methods
org.apache.commons.math3.linear

public Class DefaultIterativeLinearSolverEvent

extends IterativeLinearSolverEvent
Class Inheritance
Imports
org.apache.commons.math3.exception.MathUnsupportedOperationException

A default concrete implementation of the abstract class IterativeLinearSolverEvent.

Field Summary

Modifier and TypeField and Description
private final RealVector
b

The right-hand side vector.

private final RealVector
r

The current estimate of the residual.

private final double
rnorm

The current estimate of the norm of the residual.

private static final long
private final RealVector
x

The current estimate of the solution.

Constructor Summary

AccessConstructor and Description
public
DefaultIterativeLinearSolverEvent(final Object
the iterative solver which fired this event
source
,
final int
the number of iterations performed at the time this event is created
iterations
,
final RealVector
the current estimate of the solution
x
,
final RealVector
the right-hand side vector
b
,
final RealVector
the current estimate of the residual (can be null)
r
,
final double
the norm of the current estimate of the residual
rnorm
)

Creates a new instance of this class.

public
DefaultIterativeLinearSolverEvent(final Object
the iterative solver which fired this event
source
,
final int
the number of iterations performed at the time this event is created
iterations
,
final RealVector
the current estimate of the solution
x
,
final RealVector
the right-hand side vector
b
,
final double
the norm of the current estimate of the residual
rnorm
)

Creates a new instance of this class.

Method Summary

Modifier and TypeMethod and Description
public double
public RealVector
public RealVector
getRightHandSideVector()

Implements abstract org.apache.commons.math3.linear.IterativeLinearSolverEvent.getRightHandSideVector.

Returns the current right-hand side of the linear system to be solved.

public RealVector
getSolution()

Implements abstract org.apache.commons.math3.linear.IterativeLinearSolverEvent.getSolution.

Returns the current estimate of the solution to the linear system to be solved.

public boolean

Returns:

true if r != null
providesResidual
()

Overrides org.apache.commons.math3.linear.IterativeLinearSolverEvent.providesResidual.

Returns true if getResidual() is supported.

Field Detail

bback to summary
private final RealVector b

The right-hand side vector.

rback to summary
private final RealVector r

The current estimate of the residual.

rnormback to summary
private final double rnorm

The current estimate of the norm of the residual.

serialVersionUIDback to summary
private static final long serialVersionUID

Hides org.apache.commons.math3.linear.IterativeLinearSolverEvent.serialVersionUID.

xback to summary
private final RealVector x

The current estimate of the solution.

Constructor Detail

DefaultIterativeLinearSolverEventback to summary
public DefaultIterativeLinearSolverEvent(final Object source, final int iterations, final RealVector x, final RealVector b, final RealVector r, final double rnorm)

Creates a new instance of this class. This implementation does not deep copy the specified vectors 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.

Parameters
source:Object

the iterative solver which fired this event

iterations:int

the number of iterations performed at the time this event is created

x:RealVector

the current estimate of the solution

b:RealVector

the right-hand side vector

r:RealVector

the current estimate of the residual (can be null)

rnorm:double

the norm of the current estimate of the residual

DefaultIterativeLinearSolverEventback to summary
public DefaultIterativeLinearSolverEvent(final Object source, final int iterations, final RealVector x, final RealVector b, final double rnorm)

Creates a new instance of this class. This implementation does not deep copy the specified vectors 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.

Parameters
source:Object

the iterative solver which fired this event

iterations:int

the number of iterations performed at the time this event is created

x:RealVector

the current estimate of the solution

b:RealVector

the right-hand side vector

rnorm:double

the norm of the current estimate of the residual

Method Detail

getNormOfResidualback to summary
public double getNormOfResidual()

Implements abstract org.apache.commons.math3.linear.IterativeLinearSolverEvent.getNormOfResidual.

Doc from org.apache.commons.math3.linear.IterativeLinearSolverEvent.getNormOfResidual.

Returns the norm of the residual. The returned value is not required to be exact. Instead, the norm of the so-called updated residual (if available) should be returned. For example, the 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).

Returns:double

the norm of the residual, ||r||

Annotations
@Override
getResidualback to summary
public RealVector getResidual()

Overrides org.apache.commons.math3.linear.IterativeLinearSolverEvent.getResidual.

Doc from org.apache.commons.math3.linear.IterativeLinearSolverEvent.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

The default implementation throws a MathUnsupportedOperationException. If this method is overriden, then providesResidual() should be overriden as well.

This implementation throws an MathUnsupportedOperationException if no residual vector r was provided at construction time.
Returns:RealVector

the updated residual, r

Annotations
@Override
getRightHandSideVectorback to summary
public RealVector getRightHandSideVector()

Implements abstract org.apache.commons.math3.linear.IterativeLinearSolverEvent.getRightHandSideVector.

Doc from org.apache.commons.math3.linear.IterativeLinearSolverEvent.getRightHandSideVector.

Returns the current right-hand side of the linear system to be solved. This method should return an unmodifiable view, or a deep copy of the actual right-hand side vector, in order not to compromise subsequent iterations of the source IterativeLinearSolver.

Returns:RealVector

the right-hand side vector, b

Annotations
@Override
getSolutionback to summary
public RealVector getSolution()

Implements abstract org.apache.commons.math3.linear.IterativeLinearSolverEvent.getSolution.

Doc from org.apache.commons.math3.linear.IterativeLinearSolverEvent.getSolution.

Returns the current estimate of the solution to the linear system to be solved. This method should return an unmodifiable view, or a deep copy of the actual current solution, in order not to compromise subsequent iterations of the source IterativeLinearSolver.

Returns:RealVector

the solution, x

Annotations
@Override
providesResidualback to summary
public boolean providesResidual()

Overrides org.apache.commons.math3.linear.IterativeLinearSolverEvent.providesResidual.

Doc from org.apache.commons.math3.linear.IterativeLinearSolverEvent.providesResidual.

Returns true if 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.

Returns:boolean

true if r != null

Annotations
@Override