Class DefaultIterativeLinearSolverEvent

    • Constructor Detail

      • DefaultIterativeLinearSolverEvent

        public DefaultIterativeLinearSolverEvent​(Object source,
                                                 int iterations,
                                                 RealVector x,
                                                 RealVector b,
                                                 RealVector r,
                                                 double rnorm)
        Creates a new instance of this class. This implementation does not deep copy the specified vectors x, b, r. Therefore the user must make sure that these vectors are either unmodifiable views or deep copies of the same vectors actually used by the source. Failure to do so may compromise subsequent iterations of the source. If the residual vector r is null, then getResidual() throws a MathRuntimeException, and providesResidual() returns false.
        Parameters:
        source - the iterative solver which fired this event
        iterations - the number of iterations performed at the time this event is created
        x - the current estimate of the solution
        b - the right-hand side vector
        r - the current estimate of the residual (can be null)
        rnorm - the norm of the current estimate of the residual
      • DefaultIterativeLinearSolverEvent

        public DefaultIterativeLinearSolverEvent​(Object source,
                                                 int iterations,
                                                 RealVector x,
                                                 RealVector b,
                                                 double rnorm)
        Creates a new instance of this class. This implementation does not deep copy the specified vectors x, b. Therefore the user must make sure that these vectors are either unmodifiable views or deep copies of the same vectors actually used by the source. Failure to do so may compromise subsequent iterations of the source. Callling getResidual() on instances returned by this constructor throws a MathRuntimeException, while providesResidual() returns false.
        Parameters:
        source - the iterative solver which fired this event
        iterations - the number of iterations performed at the time this event is created
        x - the current estimate of the solution
        b - the right-hand side vector
        rnorm - the norm of the current estimate of the residual
    • Method Detail

      • getNormOfResidual

        public 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).
        Specified by:
        getNormOfResidual in class IterativeLinearSolverEvent
        Returns:
        the norm of the residual, ||r||
      • getRightHandSideVector

        public 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.
        Specified by:
        getRightHandSideVector in class IterativeLinearSolverEvent
        Returns:
        the right-hand side vector, b
      • getSolution

        public 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.
        Specified by:
        getSolution in class IterativeLinearSolverEvent
        Returns:
        the solution, x