## org.apache.commons.math3.linear
Class SymmLQ.State

    java.lang.Object
      org.apache.commons.math3.linear.SymmLQ.State

Enclosing class:
  SymmLQ

    private class SymmLQ.State

extends Object

A simple container holding the non-final variables used in the iterations. Making the current state of the solver visible from the outside is necessary, because during the iterations, `x` does not exactly hold the current estimate of the solution. Indeed, `x` needs in general to be moved from the LQ point to the CG point. Besides, additional upudates must be carried out in case `goodb` is set to `true`.

In all subsequent comments, the description of the state variables refer to their value after a call to `update()`. In these comments, k is the current number of evaluations of matrix-vector products.

Field Summary
`private RealLinearOperator` `a` Reference to the linear operator.
`private RealVector` `b` Reference to the right-hand side vector.
`private double` `beta` The value of beta[k+1].
`private double` `beta1` The value of beta[1].
`private double` `bstep` The value of bstep[k-1].
`private double` `cgnorm` The estimate of the norm of P * rC[k].
`private double` `dbar` The value of dbar[k+1] = -beta[k+1] * c[k-1].
`private double` `gammaZeta` The value of gamma[k] * zeta[k].
`private double` `gbar` The value of gbar[k].
`private double` `gmax` The value of max(|alpha[1]|, gamma[1], ..., gamma[k-1]).
`private double` `gmin` The value of min(|alpha[1]|, gamma[1], ..., gamma[k-1]).
`private boolean` `goodb` Copy of the `goodb` parameter.
`private boolean` `hasConverged` `true` if the default convergence criterion is verified.
`private double` `lqnorm` The estimate of the norm of P * rL[k-1].
`private double` `minusEpsZeta` The value of (-eps[k+1] * zeta[k-1]).
`private RealLinearOperator` `minv` Reference to the inverse of the preconditioner, M-1.
`private RealVector` `minvb` The value of M^(-1) * b.
`private double` `oldb` The value of beta[k].
`private RealVector` `r1` The value of beta[k] * M * P' * v[k].
`private RealVector` `r2` The value of beta[k+1] * M * P' * v[k+1].
`private double` `shift` Copy of the `shift` parameter.
`private double` `snprod` The value of s[1] * ...
`private double` `tnorm` An estimate of the square of the norm of A * V[k], based on Paige and Saunders (1975), equation (3.3).
`private RealVector` `wbar` The value of P' * wbar[k] or P' * (wbar[k] - s[1] * ...
`private RealVector` `x` A reference to the vector to be updated with the solution.
`private RealVector` `y` The value of beta[k+1] * P' * v[k+1].
`private double` `ynorm2` The value of zeta[1]^2 + ...

Constructor Summary
`SymmLQ.State(RealLinearOperator a, RealLinearOperator minv, RealVector b, RealVector x, boolean goodb, double shift)` Creates and inits to k = 1 a new instance of this class.

Method Summary
`private void` `init()` Performs the initial phase of the SYMMLQ algorithm.
`void` `refine(RealVector xRefined)` Move to the CG point if it seems better.
`private void` `update()` Performs the next iteration of the algorithm.
`private void` `updateNorms()` Computes the norms of the residuals, and checks for convergence.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### a

    private final RealLinearOperator a

  Reference to the linear operator.

### b

    private final RealVector b

  Reference to the right-hand side vector.

### beta

    private double beta

  The value of beta[k+1].

### beta1

    private double beta1

  The value of beta[1].

### bstep

    private double bstep

  The value of bstep[k-1].

### cgnorm

    private double cgnorm

  The estimate of the norm of P * rC[k].

### dbar

    private double dbar

  The value of dbar[k+1] = -beta[k+1] * c[k-1].

### gammaZeta

    private double gammaZeta

  The value of gamma[k] * zeta[k]. Was called `rhs1` in the initial code.

### gbar

    private double gbar

  The value of gbar[k].

### gmax

    private double gmax

  The value of max(|alpha[1]|, gamma[1], ..., gamma[k-1]).

### gmin

    private double gmin

  The value of min(|alpha[1]|, gamma[1], ..., gamma[k-1]).

### goodb

    private final boolean goodb

  Copy of the `goodb` parameter.

### hasConverged

    private boolean hasConverged

  `true` if the default convergence criterion is verified.

### lqnorm

    private double lqnorm

  The estimate of the norm of P * rL[k-1].

### minv

    private final RealLinearOperator minv

  Reference to the inverse of the preconditioner, M-1.

### minusEpsZeta

    private double minusEpsZeta

  The value of (-eps[k+1] * zeta[k-1]). Was called `rhs2` in the initial code.

### minvb

    private final RealVector minvb

  The value of M^(-1) * b.

### oldb

    private double oldb

  The value of beta[k].

### r1

    private RealVector r1

  The value of beta[k] * M * P' * v[k].

### r2

    private RealVector r2

  The value of beta[k+1] * M * P' * v[k+1].

### shift

    private final double shift

  Copy of the `shift` parameter.

### snprod

    private double snprod

  The value of s[1] * ... * s[k-1].

### tnorm

    private double tnorm

  An estimate of the square of the norm of A * V[k], based on Paige and Saunders (1975), equation (3.3).

### wbar

    private RealVector wbar

  The value of P' * wbar[k] or P' * (wbar[k] - s[1] * ... * s[k-1] * v[1]) if `goodb` is `true`. Was called `w` in the initial code.

### x

    private final RealVector x

  A reference to the vector to be updated with the solution. Contains the value of xL[k-1] if `goodb` is `false`, (xL[k-1] - bstep[k-1] * v[1]) otherwise.

### y

    private RealVector y

  The value of beta[k+1] * P' * v[k+1].

### ynorm2

    private double ynorm2

  The value of zeta[1]^2 + ... + zeta[k-1]^2.

Constructor Detail

### SymmLQ.State

    public SymmLQ.State(RealLinearOperator a,
                        RealLinearOperator minv,
                        RealVector b,
                        RealVector x,
                        boolean goodb,
                        double shift)

  Creates and inits to k = 1 a new instance of this class.

  Parameters:
    `a` - the linear operator A of the system
    `minv` - the inverse of the preconditioner, M-1 (can be `null`)
    `b` - the right-hand side vector
    `x` - the vector to be updated with the solution; `x` should not be considered as an initial guess (more)
    `goodb` - usually `false`, except if `x` is expected to contain a large multiple of `b`
    `shift` - the amount to be subtracted to all diagonal elements of A

Method Detail

### refine

    public void refine(RealVector xRefined)

  Move to the CG point if it seems better. In this version of SYMMLQ, the convergence tests involve only cgnorm, so we're unlikely to stop at an LQ point, except if the iteration limit interferes.

  Parameters:
    `xRefined` - the vector to be updated with the refined value of x

### init

    private void init()

  Performs the initial phase of the SYMMLQ algorithm. On return, the value of the state variables of `this` object correspond to k = 1.

### update

    private void update()

  Performs the next iteration of the algorithm. The iteration count should be incremented prior to calling this method. On return, the value of the state variables of `this` object correspond to the current iteration count `k`.

### updateNorms

    private void updateNorms()

  Computes the norms of the residuals, and checks for convergence. Updates `lqnorm` and `cgnorm`.

Copyright (c) 2003-2013 Apache Software Foundation