org.apache.commons.math3.linear

## Class JacobiPreconditioner

- java.lang.Object
- - org.apache.commons.math3.linear.RealLinearOperator
  - - org.apache.commons.math3.linear.JacobiPreconditioner

-     public class JacobiPreconditioner
      extends RealLinearOperator

  This class implements the standard Jacobi (diagonal) preconditioner. For a matrix Aij, this preconditioner is M = diag(1 / A11, 1 / A22, …).
  Since:
    3.0
  Version:
    $Id: JacobiPreconditioner.java 1422195 2012-12-15 06:45:18Z psteitz $

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `JacobiPreconditioner(double[] diag, boolean deep)` Creates a new instance of this class.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `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`.
    `RealLinearOperator` | `sqrt()` Returns the square root of `this` diagonal operator.

    - ### Methods inherited from class org.apache.commons.math3.linear.RealLinearOperator

      `isTransposable, operateTranspose`

    - ### 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` - the diagonal coefficients of the linear operator to be preconditioned
        `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` - 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:
        `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` - the vector to operate on
      Returns:
        the product of `this` instance with `x`

    - #### sqrt

          public RealLinearOperator sqrt()

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

Copyright © 2003–2014 The Apache Software Foundation. All rights reserved.