org.apache.commons.math.linear
Class JacobiPreconditioner

java.lang.Object
  extended by org.apache.commons.math.linear.RealLinearOperator
      extended by org.apache.commons.math.linear.InvertibleRealLinearOperator
          extended by org.apache.commons.math.linear.JacobiPreconditioner

public class JacobiPreconditioner
extends InvertibleRealLinearOperator

This class implements the standard Jacobi (diagonal) preconditioner.

Since:
3.0
Version:
$Id: JacobiPreconditioner.java 1178306 2011-10-03 06:33:21Z celestin $

Constructor Summary
JacobiPreconditioner(double[] diag, boolean deep)
          Creates a new instance of this class.
 
Method Summary
static JacobiPreconditioner create(RealLinearOperator a)
          Creates a new instance of this class.
 int getColumnDimension()
          Returns the dimension of the domain of this operator.
 int getRowDimension()
          Returns the dimension of the codomain of this operator.
 RealVector operate(RealVector x)
          Returns the result of multiplying this by the vector x.
 RealVector solve(RealVector b)
          Computes the matrix-vector product of the inverse of this instance with b and returns the result.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JacobiPreconditioner

public JacobiPreconditioner(double[] diag,
                            boolean deep)
Creates a new instance of this class.

Parameters:
diag - Diagonal coefficients of the preconditioner.
deep - true if a deep copy of the above array should be performed.
Method Detail

create

public static JacobiPreconditioner create(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 - Linear operator for which the preconditioner should be built.
Returns:
Preconditioner made of the diagonal coefficients of the specified linear operator.
Throws:
NonSquareOperatorException - if a is not square.

getColumnDimension

public int getColumnDimension()
Returns the dimension of the domain of this operator.

Specified by:
getColumnDimension in class RealLinearOperator
Returns:
the number of columns of the underlying matrix.

getRowDimension

public int getRowDimension()
Returns the dimension of the codomain of this operator.

Specified by:
getRowDimension in class RealLinearOperator
Returns:
the number of rows of the underlying matrix.

operate

public RealVector operate(RealVector x)
Returns the result of multiplying this by the vector x.

Specified by:
operate in class RealLinearOperator
Parameters:
x - Vector to operate on.
Returns:
the product of this instance with x.

solve

public RealVector solve(RealVector b)
Computes the matrix-vector product of the inverse of this instance with b and returns the result.

Specified by:
solve in class InvertibleRealLinearOperator
Parameters:
b - Right-hand side vector.
Returns:
the left-hand side vector.


Copyright © 2003-2011 The Apache Software Foundation. All Rights Reserved.