casacore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes | List of all members
casacore::MatrixSolver Class Reference

MatrixSolver.h: the base class for solvers of linear equations AX=B. More...

#include <MatrixSolver.h>

Inheritance diagram for casacore::MatrixSolver:
casacore::NNLSMatrixSolver

Public Member Functions

 MatrixSolver ()
 Default Constructor. More...
 
 MatrixSolver (const MatrixSolver &other)
 Copy Constructor. More...
 
 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
More...
 
virtual ~MatrixSolver ()
 Virtual destructor: calls all derived class destructors. More...
 
MatrixSolveroperator= (const MatrixSolver &other)
 Assignment operator: uses reference semantics, i.e., it references the internal arrays of other. More...
 
void setAB (const Matrix< FType > &A, const Vector< FType > &B)
 Set A matrix and B vector. More...
 
void setX (const Vector< FType > &X)
 Set initial value of X. More...
 
virtual Bool solve ()
 Solve for the X vector. More...
 
Bool accurateSolution ()
 Is the current solution good enough? More...
 
const Vector< FType > & getResidual ()
 Return residual vector B-AX. More...
 
const Vector< FType > & getSolution ()
 Return solution vector. More...
 
void setTolerance (FType tol)
 Set the tolerance for solution. More...
 
FType Tolerance ()
 Return the tolerance for solution. More...
 
void setMaxIters (uInt maxiters)
 Set the maximum number of iterations. More...
 
uInt MaxIters ()
 Return the maximum number of iterations. More...
 
void setGain (FType g)
 Set the gain for solution. More...
 
FType Gain ()
 Return the gain for solution. More...
 
void setSolved (Bool s)
 Set status of solution. More...
 
Bool Solved ()
 Return status of solution. More...
 
FType getNorm ()
 Return norm of solution i.e. More...
 

Protected Member Functions

virtual LogSinklogSink ()
 

Protected Attributes

LogSink logSink_p
 
Matrix< FTypeAMatrix
 the A matrix data member More...
 
Vector< FTypeBVector
 the constraint vector data member More...
 
Vector< FTypeRVector
 The residual vector data member. More...
 
Vector< FTypeXVector
 The solution vector data member. More...
 
FType RNorm
 The solution norm i.e. More...
 
FType BNorm
 The data norm i.e. More...
 

Private Attributes

FType SolTolerance
 Tolerance for solution i.e. More...
 
uInt MaxIterations
 Maximum number of iterations. More...
 
Bool solved
 Has a solution been found? More...
 
FType gain
 Gain. More...
 

Detailed Description

MatrixSolver.h: the base class for solvers of linear equations AX=B.

Intended use:

Internal

Review Status

Date Reviewed:
",

Prerequisite

Etymology

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.

Synopsis

The MatrixSolver class is a purely virtual base class. The programmer needs to define the following functions in a class derived from MatrixSolver:

  1. the derived destructor.
  2. 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.
  3. 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.

Constructor & Destructor Documentation

casacore::MatrixSolver::MatrixSolver ( )

Default Constructor.

casacore::MatrixSolver::MatrixSolver ( const MatrixSolver other)

Copy Constructor.

casacore::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 casacore::MatrixSolver::~MatrixSolver ( )
virtual

Virtual destructor: calls all derived class destructors.

Member Function Documentation

Bool casacore::MatrixSolver::accurateSolution ( )

Is the current solution good enough?

FType casacore::MatrixSolver::Gain ( )
inline

Return the gain for solution.

Definition at line 202 of file MatrixSolver.h.

References gain.

FType casacore::MatrixSolver::getNorm ( )
inline

Return norm of solution i.e.

||B-AX||

Definition at line 211 of file MatrixSolver.h.

References RNorm.

const Vector<FType>& casacore::MatrixSolver::getResidual ( )

Return residual vector B-AX.

const Vector<FType>& casacore::MatrixSolver::getSolution ( )

Return solution vector.

virtual LogSink& casacore::MatrixSolver::logSink ( )
inlineprotectedvirtual

Definition at line 151 of file MatrixSolver.h.

References logSink_p.

uInt casacore::MatrixSolver::MaxIters ( )
inline

Return the maximum number of iterations.

Definition at line 196 of file MatrixSolver.h.

References MaxIterations.

MatrixSolver& casacore::MatrixSolver::operator= ( const MatrixSolver other)

Assignment operator: uses reference semantics, i.e., it references the internal arrays of other.

void casacore::MatrixSolver::setAB ( const Matrix< FType > &  A,
const Vector< FType > &  B 
)

Set A matrix and B vector.

void casacore::MatrixSolver::setGain ( FType  g)
inline

Set the gain for solution.

Definition at line 199 of file MatrixSolver.h.

References gain.

void casacore::MatrixSolver::setMaxIters ( uInt  maxiters)
inline

Set the maximum number of iterations.

Definition at line 193 of file MatrixSolver.h.

References MaxIterations.

void casacore::MatrixSolver::setSolved ( Bool  s)
inline

Set status of solution.

Definition at line 205 of file MatrixSolver.h.

References solved.

void casacore::MatrixSolver::setTolerance ( FType  tol)
inline

Set the tolerance for solution.

Definition at line 187 of file MatrixSolver.h.

References SolTolerance.

void casacore::MatrixSolver::setX ( const Vector< FType > &  X)

Set initial value of X.

virtual Bool casacore::MatrixSolver::solve ( )
virtual

Solve for the X vector.

Reimplemented in casacore::NNLSMatrixSolver.

Bool casacore::MatrixSolver::Solved ( )
inline

Return status of solution.

Definition at line 208 of file MatrixSolver.h.

References solved.

FType casacore::MatrixSolver::Tolerance ( )
inline

Return the tolerance for solution.

Definition at line 190 of file MatrixSolver.h.

References SolTolerance.

Member Data Documentation

Matrix<FType> casacore::MatrixSolver::AMatrix
protected

the A matrix data member

Definition at line 154 of file MatrixSolver.h.

FType casacore::MatrixSolver::BNorm
protected

The data norm i.e.

||B||

Definition at line 169 of file MatrixSolver.h.

Vector<FType> casacore::MatrixSolver::BVector
protected

the constraint vector data member

Definition at line 157 of file MatrixSolver.h.

FType casacore::MatrixSolver::gain
private

Gain.

Definition at line 183 of file MatrixSolver.h.

Referenced by Gain(), and setGain().

LogSink casacore::MatrixSolver::logSink_p
protected

Definition at line 150 of file MatrixSolver.h.

Referenced by logSink().

uInt casacore::MatrixSolver::MaxIterations
private

Maximum number of iterations.

Definition at line 177 of file MatrixSolver.h.

Referenced by MaxIters(), and setMaxIters().

FType casacore::MatrixSolver::RNorm
protected

The solution norm i.e.

||B-AX||

Definition at line 166 of file MatrixSolver.h.

Referenced by getNorm().

Vector<FType> casacore::MatrixSolver::RVector
protected

The residual vector data member.

Definition at line 160 of file MatrixSolver.h.

FType casacore::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 casacore::MatrixSolver::solved
private

Has a solution been found?

Definition at line 180 of file MatrixSolver.h.

Referenced by setSolved(), and Solved().

Vector<FType> casacore::MatrixSolver::XVector
protected

The solution vector data member.

Definition at line 163 of file MatrixSolver.h.


The documentation for this class was generated from the following file: