Package no.uib.cipr.matrix.sparse
Class DefaultIterationMonitor
- java.lang.Object
-
- no.uib.cipr.matrix.sparse.AbstractIterationMonitor
-
- 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
Constructors Constructor Description DefaultIterationMonitor()
Constructor for DefaultIterationMonitor.DefaultIterationMonitor(int maxIter, double rtol, double atol, double dtol)
Constructor for DefaultIterationMonitor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
convergedI(double r)
protected boolean
convergedI(double r, Vector x)
void
setAbsoluteTolerance(double atol)
Sets the absolute tolerancevoid
setDivergenceTolerance(double dtol)
Sets the divergence tolerancevoid
setMaxIterations(int maxIter)
Sets maximum number of iterations to permitvoid
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
-
-
-
-
Constructor Detail
-
DefaultIterationMonitor
public DefaultIterationMonitor(int maxIter, double rtol, double atol, double dtol)
Constructor for DefaultIterationMonitor- Parameters:
maxIter
- Maximum number of iterationsrtol
- Relative convergence tolerance (to initial residual)atol
- Absolute convergence tolerancedtol
- 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 classAbstractIterationMonitor
- Throws:
IterativeSolverNotConvergedException
-
convergedI
protected boolean convergedI(double r, Vector x) throws IterativeSolverNotConvergedException
- Specified by:
convergedI
in classAbstractIterationMonitor
- Throws:
IterativeSolverNotConvergedException
-
-