no.uib.cipr.matrix.sparse
Class DefaultIterationMonitor

java.lang.Object
  extended by no.uib.cipr.matrix.sparse.AbstractIterationMonitor
      extended by no.uib.cipr.matrix.sparse.DefaultIterationMonitor
All Implemented Interfaces:
IterationMonitor
Direct Known Subclasses:
MatrixIterationMonitor

public class DefaultIterationMonitor
extends AbstractIterationMonitor

Default iteration monitor. This tester checks declares convergence if the absolute value of the residual norm is sufficiently small, or if the relative decrease is small. Divergence is decleared if too many iterations are spent, or the residual has grown too much. NaNs will also cause divergence to be flagged.


Field Summary
 
Fields inherited from class no.uib.cipr.matrix.sparse.AbstractIterationMonitor
iter, normType, reporter, residual
 
Constructor Summary
DefaultIterationMonitor()
          Constructor for DefaultIterationMonitor.
DefaultIterationMonitor(int maxIter, double rtol, double atol, double dtol)
          Constructor for DefaultIterationMonitor
 
Method Summary
protected  boolean convergedI(double r)
           
protected  boolean convergedI(double r, Vector x)
           
 void setAbsoluteTolerance(double atol)
          Sets the absolute tolerance
 void setDivergenceTolerance(double dtol)
          Sets the divergence tolerance
 void setMaxIterations(int maxIter)
          Sets maximum number of iterations to permit
 void setRelativeTolerance(double rtol)
          Sets the relative tolerance
 
Methods inherited from class no.uib.cipr.matrix.sparse.AbstractIterationMonitor
converged, converged, converged, converged, getIterationReporter, getNormType, isFirst, iterations, next, residual, setFirst, setIterationReporter, setNormType
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultIterationMonitor

public DefaultIterationMonitor(int maxIter,
                               double rtol,
                               double atol,
                               double dtol)
Constructor for DefaultIterationMonitor

Parameters:
maxIter - Maximum number of iterations
rtol - Relative convergence tolerance (to initial residual)
atol - Absolute convergence tolerance
dtol - Relative divergence tolerance (to initial residual)

DefaultIterationMonitor

public DefaultIterationMonitor()
Constructor for DefaultIterationMonitor. Default is 100000 iterations at most, relative tolerance of 1e-5, absolute tolerance of 1e-50 and a divergence tolerance of 1e+5.

Method Detail

setMaxIterations

public void setMaxIterations(int maxIter)
Sets maximum number of iterations to permit

Parameters:
maxIter - Maximum number of iterations

setRelativeTolerance

public void setRelativeTolerance(double rtol)
Sets the relative tolerance

Parameters:
rtol - Relative convergence tolerance (to initial residual)

setAbsoluteTolerance

public void setAbsoluteTolerance(double atol)
Sets the absolute tolerance

Parameters:
atol - Absolute convergence tolerance

setDivergenceTolerance

public void setDivergenceTolerance(double dtol)
Sets the divergence tolerance

Parameters:
dtol - Relative divergence tolerance (to initial residual)

convergedI

protected boolean convergedI(double r)
                      throws IterativeSolverNotConvergedException
Specified by:
convergedI in class AbstractIterationMonitor
Throws:
IterativeSolverNotConvergedException

convergedI

protected boolean convergedI(double r,
                             Vector x)
                      throws IterativeSolverNotConvergedException
Specified by:
convergedI in class AbstractIterationMonitor
Throws:
IterativeSolverNotConvergedException