no.uib.cipr.matrix.sparse
Class AbstractIterationMonitor

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

public abstract class AbstractIterationMonitor
extends java.lang.Object
implements IterationMonitor

Partial implementation of an iteration reporter


Field Summary
protected  int iter
          Iteration number
protected  Vector.Norm normType
          Vector-norm
protected  IterationReporter reporter
          Iteration reporter
protected  double residual
          Current residual
 
Constructor Summary
AbstractIterationMonitor()
          Constructor for AbstractIterationMonitor.
 
Method Summary
 boolean converged(double r)
          Checks for convergence
 boolean converged(double r, Vector x)
          Checks for convergence
 boolean converged(Vector r)
          Checks for convergence
 boolean converged(Vector r, Vector x)
          Checks for convergence
protected abstract  boolean convergedI(double r)
           
protected abstract  boolean convergedI(double r, Vector x)
           
 IterationReporter getIterationReporter()
          Returns current iteration reporter
 Vector.Norm getNormType()
          Returns the vector-norm in use
 boolean isFirst()
          Returns true for the first iteration
 int iterations()
          Number of iterations performed
 void next()
          Increases iteration counter
 double residual()
          Returns current residual
 void setFirst()
          Resets the iteration
 void setIterationReporter(IterationReporter monitor)
          Sets new iteration reporter
 void setNormType(Vector.Norm normType)
          Sets the vector-norm to calculate with
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

iter

protected int iter
Iteration number


normType

protected Vector.Norm normType
Vector-norm


reporter

protected IterationReporter reporter
Iteration reporter


residual

protected double residual
Current residual

Constructor Detail

AbstractIterationMonitor

public AbstractIterationMonitor()
Constructor for AbstractIterationMonitor. Default norm is the 2-norm with no iteration reporting.

Method Detail

setFirst

public void setFirst()
Description copied from interface: IterationMonitor
Resets the iteration

Specified by:
setFirst in interface IterationMonitor

isFirst

public boolean isFirst()
Description copied from interface: IterationMonitor
Returns true for the first iteration

Specified by:
isFirst in interface IterationMonitor

next

public void next()
Description copied from interface: IterationMonitor
Increases iteration counter

Specified by:
next in interface IterationMonitor

iterations

public int iterations()
Description copied from interface: IterationMonitor
Number of iterations performed

Specified by:
iterations in interface IterationMonitor

converged

public boolean converged(Vector r,
                         Vector x)
                  throws IterativeSolverNotConvergedException
Description copied from interface: IterationMonitor
Checks for convergence

Specified by:
converged in interface IterationMonitor
Parameters:
r - Residual-vector
x - State-vector
Returns:
True if converged
Throws:
IterativeSolverNotConvergedException

converged

public boolean converged(double r,
                         Vector x)
                  throws IterativeSolverNotConvergedException
Description copied from interface: IterationMonitor
Checks for convergence

Specified by:
converged in interface IterationMonitor
Parameters:
r - Residual-norm
x - State-vector
Returns:
True if converged
Throws:
IterativeSolverNotConvergedException

converged

public boolean converged(double r)
                  throws IterativeSolverNotConvergedException
Description copied from interface: IterationMonitor
Checks for convergence

Specified by:
converged in interface IterationMonitor
Parameters:
r - Residual-norm
Returns:
True if converged
Throws:
IterativeSolverNotConvergedException

convergedI

protected abstract boolean convergedI(double r,
                                      Vector x)
                               throws IterativeSolverNotConvergedException
Throws:
IterativeSolverNotConvergedException

convergedI

protected abstract boolean convergedI(double r)
                               throws IterativeSolverNotConvergedException
Throws:
IterativeSolverNotConvergedException

converged

public boolean converged(Vector r)
                  throws IterativeSolverNotConvergedException
Description copied from interface: IterationMonitor
Checks for convergence

Specified by:
converged in interface IterationMonitor
Parameters:
r - Residual-vector
Returns:
True if converged
Throws:
IterativeSolverNotConvergedException

getNormType

public Vector.Norm getNormType()
Description copied from interface: IterationMonitor
Returns the vector-norm in use

Specified by:
getNormType in interface IterationMonitor

setNormType

public void setNormType(Vector.Norm normType)
Description copied from interface: IterationMonitor
Sets the vector-norm to calculate with

Specified by:
setNormType in interface IterationMonitor

getIterationReporter

public IterationReporter getIterationReporter()
Description copied from interface: IterationMonitor
Returns current iteration reporter

Specified by:
getIterationReporter in interface IterationMonitor

setIterationReporter

public void setIterationReporter(IterationReporter monitor)
Description copied from interface: IterationMonitor
Sets new iteration reporter

Specified by:
setIterationReporter in interface IterationMonitor

residual

public double residual()
Description copied from interface: IterationMonitor
Returns current residual

Specified by:
residual in interface IterationMonitor