org.apache.commons.math3.linear

## Class IterativeLinearSolverEvent

- java.lang.Object
- - java.util.EventObject
  - - org.apache.commons.math3.util.IterationEvent
    - - org.apache.commons.math3.linear.IterativeLinearSolverEvent

- All Implemented Interfaces:
    Serializable
  Direct Known Subclasses:
    DefaultIterativeLinearSolverEvent

      public abstract class IterativeLinearSolverEvent
      extends IterationEvent

  This is the base class for all events occurring during the iterations of a `IterativeLinearSolver`.
  Since:
    3.0
  Version:
    $Id: IterativeLinearSolverEvent.java 1505934 2013-07-23 08:38:03Z luc $
  See Also:
    Serialized Form

- - ### Field Summary

    - ### Fields inherited from class java.util.EventObject

      `source`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `IterativeLinearSolverEvent(Object source, int iterations)` Creates a new instance of this class.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `abstract double` | `getNormOfResidual()` Returns the norm of the residual.
    `RealVector` | `getResidual()` Returns the residual.
    `abstract RealVector` | `getRightHandSideVector()` Returns the current right-hand side of the linear system to be solved.
    `abstract RealVector` | `getSolution()` Returns the current estimate of the solution to the linear system to be solved.
    `boolean` | `providesResidual()` Returns `true` if `getResidual()` is supported.

    - ### Methods inherited from class org.apache.commons.math3.util.IterationEvent

      `getIterations`

    - ### Methods inherited from class java.util.EventObject

      `getSource, toString`

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

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### IterativeLinearSolverEvent

          public IterativeLinearSolverEvent(Object source,
                                    int iterations)

      Creates a new instance of this class.
      Parameters:
        `source` - the iterative algorithm on which the event initially occurred
        `iterations` - the number of iterations performed at the time `this` event is created

  - ### Method Detail

    - #### getRightHandSideVector

          public abstract RealVector getRightHandSideVector()

      Returns the current right-hand side of the linear system to be solved. This method should return an unmodifiable view, or a deep copy of the actual right-hand side vector, in order not to compromise subsequent iterations of the source `IterativeLinearSolver`.
      Returns:
        the right-hand side vector, b

    - #### getNormOfResidual

          public abstract double getNormOfResidual()

      Returns the norm of the residual. The returned value is not required to be exact. Instead, the norm of the so-called updated residual (if available) should be returned. For example, the `conjugate gradient` method computes a sequence of residuals, the norm of which is cheap to compute. However, due to accumulation of round-off errors, this residual might differ from the true residual after some iterations. See e.g. A. Greenbaum and Z. Strakos, Predicting the Behavior of Finite Precision Lanzos and Conjugate Gradient Computations, Technical Report 538, Department of Computer Science, New York University, 1991 (available here).
      Returns:
        the norm of the residual, ||r||

    - #### getResidual

          public RealVector getResidual()

      Returns the residual. This is an optional operation, as all iterative linear solvers do not provide cheap estimate of the updated residual vector, in which case

      - this method should throw a `MathUnsupportedOperationException`,
      - `providesResidual()` returns `false`.

      The default implementation throws a `MathUnsupportedOperationException`. If this method is overriden, then `providesResidual()` should be overriden as well.

      Returns:
        the updated residual, r

    - #### getSolution

          public abstract RealVector getSolution()

      Returns the current estimate of the solution to the linear system to be solved. This method should return an unmodifiable view, or a deep copy of the actual current solution, in order not to compromise subsequent iterations of the source `IterativeLinearSolver`.
      Returns:
        the solution, x

    - #### providesResidual

          public boolean providesResidual()

      Returns `true` if `getResidual()` is supported. The default implementation returns `false`.
      Returns:
        `false` if `getResidual()` throws a `MathUnsupportedOperationException`

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