casa
$Rev:20696$
|
MatrixSolver.h: the base class for solvers of linear equations AX=B. More...
#include <MatrixSolver.h>
Public Member Functions | |
MatrixSolver () | |
Default Constructor. | |
MatrixSolver (const MatrixSolver &other) | |
Copy Constructor. | |
MatrixSolver (const Matrix< FType > &A, const Vector< FType > &B) | |
Create a MatrixSolver from a matrix A and a Vector B Warning: A and B are accessed by reference, so do not modify them during the lifetime of the MatrixSolver | |
virtual | ~MatrixSolver () |
Virtual destructor: calls all derived class destructors. | |
MatrixSolver & | operator= (const MatrixSolver &other) |
Assignment operator: uses reference semantics, i.e., it references the internal arrays of other. | |
void | setAB (const Matrix< FType > &A, const Vector< FType > &B) |
Set A matrix and B vector. | |
void | setX (const Vector< FType > &X) |
Set initial value of X. | |
virtual Bool | solve () |
Solve for the X vector. | |
Bool | accurateSolution () |
Is the current solution good enough? | |
const Vector< FType > & | getResidual () |
Return residual vector B-AX. | |
const Vector< FType > & | getSolution () |
Return solution vector. | |
void | setTolerance (FType tol) |
Set the tolerance for solution. | |
FType | Tolerance () |
Return the tolerance for solution. | |
void | setMaxIters (uInt maxiters) |
Set the maximum number of iterations. | |
uInt | MaxIters () |
Return the maximum number of iterations. | |
void | setGain (FType g) |
Set the gain for solution. | |
FType | Gain () |
Return the gain for solution. | |
void | setSolved (Bool s) |
Set status of solution. | |
Bool | Solved () |
Return status of solution. | |
FType | getNorm () |
Return norm of solution i.e. | |
Protected Member Functions | |
virtual LogSink & | logSink () |
Protected Attributes | |
LogSink | logSink_p |
Matrix< FType > | AMatrix |
the A matrix data member | |
Vector< FType > | BVector |
the constraint vector data member | |
Vector< FType > | RVector |
The residual vector data member. | |
Vector< FType > | XVector |
The solution vector data member. | |
FType | RNorm |
The solution norm i.e. | |
FType | BNorm |
The data norm i.e. | |
Private Attributes | |
FType | SolTolerance |
Tolerance for solution i.e. | |
uInt | MaxIterations |
Maximum number of iterations. | |
Bool | solved |
Has a solution been found? | |
FType | gain |
Gain. |
MatrixSolver.h: the base class for solvers of linear equations AX=B.
Internal
The MatrixSolver class name reflects its use as the base class for solving Linear Equations of the form AX=B. This class is purely virtual and provides the essential implementation for derived solvers classes.
The MatrixSolver class is a purely virtual base class. The programmer needs to define the following functions in a class derived from MatrixSolver:
void setImageAndPsf(const Array<FType> & image, const Array<FType> & psf);
Set the image and the Point Spread Function (beam). Setting this should reset the internal state, e.g. CurrentIter()==0. Bool solve();
Perform solution of AX=B. Returns True if algorithm has converged or stop criterium reached. Definition at line 82 of file MatrixSolver.h.
Default Constructor.
casa::MatrixSolver::MatrixSolver | ( | const MatrixSolver & | other | ) |
Copy Constructor.
casa::MatrixSolver::MatrixSolver | ( | const Matrix< FType > & | A, |
const Vector< FType > & | B | ||
) |
Create a MatrixSolver from a matrix A and a Vector B
Warning: A and B are accessed by reference, so do not modify them during the lifetime of the MatrixSolver
virtual casa::MatrixSolver::~MatrixSolver | ( | ) | [virtual] |
Virtual destructor: calls all derived class destructors.
Is the current solution good enough?
FType casa::MatrixSolver::Gain | ( | ) | [inline] |
FType casa::MatrixSolver::getNorm | ( | ) | [inline] |
Return norm of solution i.e.
||B-AX||
Definition at line 211 of file MatrixSolver.h.
References RNorm.
const Vector<FType>& casa::MatrixSolver::getResidual | ( | ) |
Return residual vector B-AX.
const Vector<FType>& casa::MatrixSolver::getSolution | ( | ) |
Return solution vector.
virtual LogSink& casa::MatrixSolver::logSink | ( | ) | [inline, protected, virtual] |
Definition at line 151 of file MatrixSolver.h.
References logSink_p.
uInt casa::MatrixSolver::MaxIters | ( | ) | [inline] |
Return the maximum number of iterations.
Definition at line 196 of file MatrixSolver.h.
References MaxIterations.
MatrixSolver& casa::MatrixSolver::operator= | ( | const MatrixSolver & | other | ) |
Assignment operator: uses reference semantics, i.e., it references the internal arrays of other.
void casa::MatrixSolver::setAB | ( | const Matrix< FType > & | A, |
const Vector< FType > & | B | ||
) |
Set A matrix and B vector.
void casa::MatrixSolver::setGain | ( | FType | g | ) | [inline] |
void casa::MatrixSolver::setMaxIters | ( | uInt | maxiters | ) | [inline] |
Set the maximum number of iterations.
Definition at line 193 of file MatrixSolver.h.
References MaxIterations.
void casa::MatrixSolver::setSolved | ( | Bool | s | ) | [inline] |
void casa::MatrixSolver::setTolerance | ( | FType | tol | ) | [inline] |
Set the tolerance for solution.
Definition at line 187 of file MatrixSolver.h.
References SolTolerance.
void casa::MatrixSolver::setX | ( | const Vector< FType > & | X | ) |
Set initial value of X.
virtual Bool casa::MatrixSolver::solve | ( | ) | [virtual] |
Solve for the X vector.
Reimplemented in casa::NNLSMatrixSolver.
Bool casa::MatrixSolver::Solved | ( | ) | [inline] |
FType casa::MatrixSolver::Tolerance | ( | ) | [inline] |
Return the tolerance for solution.
Definition at line 190 of file MatrixSolver.h.
References SolTolerance.
Matrix<FType> casa::MatrixSolver::AMatrix [protected] |
the A matrix data member
Definition at line 154 of file MatrixSolver.h.
FType casa::MatrixSolver::BNorm [protected] |
Vector<FType> casa::MatrixSolver::BVector [protected] |
the constraint vector data member
Definition at line 157 of file MatrixSolver.h.
FType casa::MatrixSolver::gain [private] |
LogSink casa::MatrixSolver::logSink_p [protected] |
Definition at line 150 of file MatrixSolver.h.
Referenced by logSink().
uInt casa::MatrixSolver::MaxIterations [private] |
Maximum number of iterations.
Definition at line 177 of file MatrixSolver.h.
Referenced by MaxIters(), and setMaxIters().
FType casa::MatrixSolver::RNorm [protected] |
The solution norm i.e.
||B-AX||
Definition at line 166 of file MatrixSolver.h.
Referenced by getNorm().
Vector<FType> casa::MatrixSolver::RVector [protected] |
The residual vector data member.
Definition at line 160 of file MatrixSolver.h.
FType casa::MatrixSolver::SolTolerance [private] |
Tolerance for solution i.e.
||B-AX||/||B|| must be less than this
Definition at line 174 of file MatrixSolver.h.
Referenced by setTolerance(), and Tolerance().
Bool casa::MatrixSolver::solved [private] |
Has a solution been found?
Definition at line 180 of file MatrixSolver.h.
Referenced by setSolved(), and Solved().
Vector<FType> casa::MatrixSolver::XVector [protected] |
The solution vector data member.
Definition at line 163 of file MatrixSolver.h.