Package org.hipparchus.linear
Class JacobiPreconditioner
java.lang.Object
org.hipparchus.linear.JacobiPreconditioner
- All Implemented Interfaces:
RealLinearOperator
This class implements the standard Jacobi (diagonal) preconditioner. For a
matrix Aij, this preconditioner is
M = diag(1 / A11, 1 / A22, …).
-
Constructor Summary
ConstructorsConstructorDescriptionJacobiPreconditioner(double[] diag, boolean deep) Creates a new instance of this class. -
Method Summary
Modifier and TypeMethodDescriptionstatic JacobiPreconditionerCreates a new instance of this class.intReturns the dimension of the domain of this operator.intReturns the dimension of the codomain of this operator.Returns the result of multiplyingthisby the vectorx.sqrt()Returns the square root ofthisdiagonal operator.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.hipparchus.linear.RealLinearOperator
isTransposable, operateTranspose
-
Constructor Details
-
JacobiPreconditioner
public JacobiPreconditioner(double[] diag, boolean deep) Creates a new instance of this class.- Parameters:
diag- the diagonal coefficients of the linear operator to be preconditioneddeep-trueif a deep copy of the above array should be performed
-
-
Method Details
-
create
Creates a new instance of this class. This method extracts the diagonal coefficients of the specified linear operator. Ifadoes not extendAbstractRealMatrix, 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- the linear operator for which the preconditioner should be built- Returns:
- the diagonal preconditioner made of the inverse of the diagonal coefficients of the specified linear operator
- Throws:
MathIllegalArgumentException- ifais not square
-
getColumnDimension
public int getColumnDimension()Returns the dimension of the domain of this operator.- Specified by:
getColumnDimensionin interfaceRealLinearOperator- Returns:
- the number of columns of the underlying matrix
-
getRowDimension
public int getRowDimension()Returns the dimension of the codomain of this operator.- Specified by:
getRowDimensionin interfaceRealLinearOperator- Returns:
- the number of rows of the underlying matrix
-
operate
Returns the result of multiplyingthisby the vectorx.- Specified by:
operatein interfaceRealLinearOperator- Parameters:
x- the vector to operate on- Returns:
- the product of
thisinstance withx
-
sqrt
Returns the square root ofthisdiagonal operator. More precisely, this method returns P = diag(1 / √A11, 1 / √A22, …).- Returns:
- the square root of
thispreconditioner
-