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

public abstract Class IterativeLinearSolver

extends Object
Class Inheritance
Known Direct Subclasses
org.apache.commons.math3.linear.PreconditionedIterativeLinearSolver
Imports
org.apache.commons.math3.exception.DimensionMismatchException, .MaxCountExceededException, .NullArgumentException, org.apache.commons.math3.util.IterationManager, .MathUtils

This abstract class defines an iterative solver for the linear system A · x = b. In what follows, the residual r is defined as r = b - A · x, where A is the linear operator of the linear system, b is the right-hand side vector, and x the current estimate of the solution.
Since
3.0

Field Summary

Modifier and TypeField and Description
private final IterationManager
manager

The object in charge of managing the iterations.

Constructor Summary

AccessConstructor and Description
public
IterativeLinearSolver(final int
the maximum number of iterations
maxIterations
)

Creates a new instance of this class, with default iteration manager.

public
IterativeLinearSolver(final IterationManager
the custom iteration manager
manager
)

Creates a new instance of this class, with custom iteration manager.

Method Summary

Modifier and TypeMethod and Description
protected static void
checkParameters(final RealLinearOperator
the linear operator A of the system
a
,
final RealVector
the right-hand side vector
b
,
final RealVector
the initial guess of the solution
x0
)

Performs all dimension checks on the parameters of solve and solveInPlace, and throws an exception if one of the checks fails.

public IterationManager

Returns:

the manager
getIterationManager
()

Returns the iteration manager attached to this solver.

public RealVector

Returns:

a new vector containing the solution
solve
(final RealLinearOperator
the linear operator A of the system
a
,
final RealVector
the right-hand side vector
b
)

Returns an estimate of the solution to the linear system A · x = b.

public RealVector

Returns:

a new vector containing the solution
solve
(RealLinearOperator
the linear operator A of the system
a
,
RealVector
the right-hand side vector
b
,
RealVector
the initial guess of the solution
x0
)

Returns an estimate of the solution to the linear system A · x = b.

public abstract RealVector

Returns:

a reference to x0 (shallow copy) updated with the solution
solveInPlace
(RealLinearOperator
the linear operator A of the system
a
,
RealVector
the right-hand side vector
b
,
RealVector
initial guess of the solution
x0
)

Returns an estimate of the solution to the linear system A · x = b.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

managerback to summary
private final IterationManager manager

The object in charge of managing the iterations.

Constructor Detail

IterativeLinearSolverback to summary
public IterativeLinearSolver(final int maxIterations)

Creates a new instance of this class, with default iteration manager.

Parameters
maxIterations:int

the maximum number of iterations

IterativeLinearSolverback to summary
public IterativeLinearSolver(final IterationManager manager) throws NullArgumentException

Creates a new instance of this class, with custom iteration manager.

Parameters
manager:IterationManager

the custom iteration manager

Exceptions
NullArgumentException:
if manager is null

Method Detail

checkParametersback to summary
protected static void checkParameters(final RealLinearOperator a, final RealVector b, final RealVector x0) throws NullArgumentException, NonSquareOperatorException, DimensionMismatchException

Performs all dimension checks on the parameters of solve and solveInPlace, and throws an exception if one of the checks fails.

Parameters
a:RealLinearOperator

the linear operator A of the system

b:RealVector

the right-hand side vector

x0:RealVector

the initial guess of the solution

Exceptions
NullArgumentException:
if one of the parameters is null
NonSquareOperatorException:
if a is not square
DimensionMismatchException:
if b or x0 have dimensions inconsistent with a
getIterationManagerback to summary
public IterationManager getIterationManager()

Returns the iteration manager attached to this solver.

Returns:IterationManager

the manager

solveback to summary
public RealVector solve(final RealLinearOperator a, final RealVector b) throws NullArgumentException, NonSquareOperatorException, DimensionMismatchException, MaxCountExceededException

Returns an estimate of the solution to the linear system A · x = b.

Parameters
a:RealLinearOperator

the linear operator A of the system

b:RealVector

the right-hand side vector

Returns:RealVector

a new vector containing the solution

Exceptions
NullArgumentException:
if one of the parameters is null
NonSquareOperatorException:
if a is not square
DimensionMismatchException:
if b has dimensions inconsistent with a
MaxCountExceededException:
at exhaustion of the iteration count, unless a custom callback has been set at construction of the IterationManager
solveback to summary
public RealVector solve(RealLinearOperator a, RealVector b, RealVector x0) throws NullArgumentException, NonSquareOperatorException, DimensionMismatchException, MaxCountExceededException

Returns an estimate of the solution to the linear system A · x = b.

Parameters
a:RealLinearOperator

the linear operator A of the system

b:RealVector

the right-hand side vector

x0:RealVector

the initial guess of the solution

Returns:RealVector

a new vector containing the solution

Exceptions
NullArgumentException:
if one of the parameters is null
NonSquareOperatorException:
if a is not square
DimensionMismatchException:
if b or x0 have dimensions inconsistent with a
MaxCountExceededException:
at exhaustion of the iteration count, unless a custom callback has been set at construction of the IterationManager
solveInPlaceback to summary
public abstract RealVector solveInPlace(RealLinearOperator a, RealVector b, RealVector x0) throws NullArgumentException, NonSquareOperatorException, DimensionMismatchException, MaxCountExceededException

Returns an estimate of the solution to the linear system A · x = b. The solution is computed in-place (initial guess is modified).

Parameters
a:RealLinearOperator

the linear operator A of the system

b:RealVector

the right-hand side vector

x0:RealVector

initial guess of the solution

Returns:RealVector

a reference to x0 (shallow copy) updated with the solution

Exceptions
NullArgumentException:
if one of the parameters is null
NonSquareOperatorException:
if a is not square
DimensionMismatchException:
if b or x0 have dimensions inconsistent with a
MaxCountExceededException:
at exhaustion of the iteration count, unless a custom callback has been set at construction of the IterationManager