jvx.numeric

## Class PnConjugateGradientMatrix

- java.lang.Object
- - jvx.numeric.PnConjugateGradientMatrix

- Direct Known Subclasses:
    PnBiconjugateGradient

      public class PnConjugateGradientMatrix
      extends java.lang.Object

  Solve symmetric sparse linear equation systems using preconditioned conjugate gradient method.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `PnConjugateGradientMatrix()` Constructor.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `converged()` Returns whether the residual norm is within the tolerance.
    `double` | `getActualEstimatedError()` Get estimated error of last solve call.
    `int` | `getActualNumOfTakenIterations()` Get number of iterations used in last solve call.
    `double` | `getConvergenceTest()` There are four different methods measure the convergence of the solution of the linear equation used in solve.
    `int` | `getDimension()` Get dimension.
    `int` | `getMaxNumIterations()` Get maximum number of allowed iterations.
    `PnPreconditioner` | `getPreconditioner()` Set the preconditioner to use for the conjugate gradient.
    `double` | `getTolerance()` Get desired convergence tolerance of solve.
    `void` | `setConvergenceTest(int aTest)` There are four different methods measure the convergence of the solution of the linear equation used in solve.
    `void` | `setDimension(int dim)` Set dimension of surface matrix is based on.
    `void` | `setMaxNumIterations(int itmax)` Set maximum number of allowed iterations.
    `void` | `setPreconditioner(PnPreconditioner prec)` Set the preconditioner to use for the conjugate gradient.
    `void` | `setTolerance(double tol)` Set desired convergence tolerance of solve.
    `double` | `solve(PnSparseMatrix smat, PdVector x, PdVector b)` Performs a conjugate gradient on a sparse matrix to solve the linear system Ax = b.
    `void` | `updatePreconditioner(PnSparseMatrix smat)` When the sparse matrix to solve has changed update the preconditioner with this method.

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### PnConjugateGradientMatrix

          public PnConjugateGradientMatrix()

      Constructor.

  - ### Method Detail

    - #### converged

          public boolean converged()

      Returns whether the residual norm is within the tolerance.
      Returns:
        `true` if convergence happened within tolerance.

    - #### setPreconditioner

          public void setPreconditioner(PnPreconditioner prec)

      Set the preconditioner to use for the conjugate gradient.
      Parameters:
        `prec` -

    - #### getPreconditioner

          public PnPreconditioner getPreconditioner()

      Set the preconditioner to use for the conjugate gradient.

    - #### getActualEstimatedError

          public double getActualEstimatedError()

      Get estimated error of last solve call.

    - #### getActualNumOfTakenIterations

          public int getActualNumOfTakenIterations()

      Get number of iterations used in last solve call.

    - #### setMaxNumIterations

          public void setMaxNumIterations(int itmax)

      Set maximum number of allowed iterations. Default value is 10000.

    - #### getMaxNumIterations

          public int getMaxNumIterations()

      Get maximum number of allowed iterations.

    - #### setTolerance

          public void setTolerance(double tol)

      Set desired convergence tolerance of solve.

    - #### getTolerance

          public double getTolerance()

      Get desired convergence tolerance of solve.

    - #### setDimension

          public void setDimension(int dim)

      Set dimension of surface matrix is based on. Coordinate vectors must have length equal dim*(dim of sparseMatrix).

    - #### getDimension

          public int getDimension()

      Get dimension.

    - #### setConvergenceTest

          public void setConvergenceTest(int aTest)

      There are four different methods measure the convergence of the solution of the linear equation used in solve. The default is 1.
      1. |A*x-b|/|b| 2. |Diag(A)^-1*x-b|/|Diag(A)^-1*b| With Diag(A) denoting the diagonal part of A.
      3. This routine uses its own estimate of error in x, and requires its magnitude, divided by the magnitude of x, to be less than tol.
      4. Same as 3., except that the largest (in absolute value) component of the error and the largest component of x are used instead of the vector magnitude.

    - #### getConvergenceTest

          public double getConvergenceTest()

      There are four different methods measure the convergence of the solution of the linear equation used in solve. Get the index of the method actually used.
      See Also:
        `setConvergenceTest(int)`

    - #### updatePreconditioner

          public void updatePreconditioner(PnSparseMatrix smat)

      When the sparse matrix to solve has changed update the preconditioner with this method.

    - #### solve

          public double solve(PnSparseMatrix smat,
                     PdVector x,
                     PdVector b)

      Performs a conjugate gradient on a sparse matrix to solve the linear system Ax = b. The matrix has to be square.
      Returns:
        size of residual

"

The software JavaView? is copyright protected. All Rights Reserved.
"