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

public Class JacobiPreconditioner

extends RealLinearOperator
Class Inheritance
Imports
org.apache.commons.math3.analysis.function.Sqrt, org.apache.commons.math3.util.MathArrays

This class implements the standard Jacobi (diagonal) preconditioner. For a matrix Aij, this preconditioner is M = diag(1 / A11, 1 / A22, …).
Since
3.0

Field Summary

Modifier and TypeField and Description
private final ArrayRealVector
diag

The diagonal coefficients of the preconditioner.

Constructor Summary

AccessConstructor and Description
public
JacobiPreconditioner(final double[]
the diagonal coefficients of the linear operator to be preconditioned
diag
,
final boolean
true if a deep copy of the above array should be performed
deep
)

Creates a new instance of this class.

Method Summary

Modifier and TypeMethod and Description
public static JacobiPreconditioner

Returns:

the diagonal preconditioner made of the inverse of the diagonal coefficients of the specified linear operator
create
(final RealLinearOperator
the linear operator for which the preconditioner should be built
a
)

Creates a new instance of this class.

public int
getColumnDimension()

Implements abstract org.apache.commons.math3.linear.RealLinearOperator.getColumnDimension.

Returns the dimension of the domain of this operator.

public int
getRowDimension()

Implements abstract org.apache.commons.math3.linear.RealLinearOperator.getRowDimension.

Returns the dimension of the codomain of this operator.

public RealVector
operate(final RealVector
the vector to operate on
x
)

Implements abstract org.apache.commons.math3.linear.RealLinearOperator.operate.

Returns the result of multiplying this by the vector x.

public RealLinearOperator

Returns:

the square root of this preconditioner
sqrt
()

Returns the square root of this diagonal operator.

Inherited from org.apache.commons.math3.linear.RealLinearOperator:
isTransposableoperateTranspose

Field Detail

diagback to summary
private final ArrayRealVector diag

The diagonal coefficients of the preconditioner.

Constructor Detail

JacobiPreconditionerback to summary
public JacobiPreconditioner(final double[] diag, final boolean deep)

Creates a new instance of this class.

Parameters
diag:double[]

the diagonal coefficients of the linear operator to be preconditioned

deep:boolean

true if a deep copy of the above array should be performed

Method Detail

createback to summary
public static JacobiPreconditioner create(final RealLinearOperator a) throws NonSquareOperatorException

Creates a new instance of this class. This method extracts the diagonal coefficients of the specified linear operator. If a does not extend AbstractRealMatrix, then the coefficients of the underlying matrix are not accessible, coefficient extraction is made by matrix-vector products with the basis vectors (and might therefore take some time). With matrices, direct entry access is carried out.

Parameters
a:RealLinearOperator

the linear operator for which the preconditioner should be built

Returns:JacobiPreconditioner

the diagonal preconditioner made of the inverse of the diagonal coefficients of the specified linear operator

Exceptions
NonSquareOperatorException:
if a is not square
getColumnDimensionback to summary
public int getColumnDimension()

Implements abstract org.apache.commons.math3.linear.RealLinearOperator.getColumnDimension.

Doc from org.apache.commons.math3.linear.RealLinearOperator.getColumnDimension.

Returns the dimension of the domain of this operator.

Returns:int

the number of columns of the underlying matrix

Annotations
@Override
getRowDimensionback to summary
public int getRowDimension()

Implements abstract org.apache.commons.math3.linear.RealLinearOperator.getRowDimension.

Doc from org.apache.commons.math3.linear.RealLinearOperator.getRowDimension.

Returns the dimension of the codomain of this operator.

Returns:int

the number of rows of the underlying matrix

Annotations
@Override
operateback to summary
public RealVector operate(final RealVector x)

Implements abstract org.apache.commons.math3.linear.RealLinearOperator.operate.

Doc from org.apache.commons.math3.linear.RealLinearOperator.operate.

Returns the result of multiplying this by the vector x.

Parameters
x:RealVector

the vector to operate on

Returns:RealVector

the product of this instance with x

Annotations
@Override
sqrtback to summary
public RealLinearOperator sqrt()

Returns the square root of this diagonal operator. More precisely, this method returns P = diag(1 / √A11, 1 / √A22, …).

Returns:RealLinearOperator

the square root of this preconditioner

Since
3.1