Class RelativeTolerance

  • All Implemented Interfaces:
    Tolerance

    public class RelativeTolerance
    extends Object
    implements Tolerance
    The stopping criteria is that the norm of the residual r relative to the input base is equal to or smaller than the specified tolerance, that is,
    ||r||2/base ≤ tolerance
    • Field Detail

      • DEFAULT_TOLERANCE

        public static final double DEFAULT_TOLERANCE
        default tolerance
        See Also:
        Constant Field Values
    • Constructor Detail

      • RelativeTolerance

        public RelativeTolerance​(double base)
        Construct an instance with DEFAULT_TOLERANCE.
        Parameters:
        base - the base value for computing the relative residual
      • RelativeTolerance

        public RelativeTolerance​(double base,
                                 double tolerance)
        Construct an instance with specified tolerance.
        Parameters:
        base - the base value for computing the relative residual
        tolerance - the residual norm criteria
    • Method Detail

      • isResidualSmall

        public boolean isResidualSmall​(double norm)
        Description copied from interface: Tolerance
        Checks if the updated residual satisfies the tolerance criteria.
        Specified by:
        isResidualSmall in interface Tolerance
        Parameters:
        norm - the norm of the updated residual
        Returns:
        true if the residual norm is small enough