Loading...
Searching...
No Matches
casacore::MatrixSolver Class Reference
scimath package (libcasa_scimath) » Mathematics_module » Mathematics_module_internal_classes

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.

## Detailed Description

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

### Intended use:

Internal

### Review Status

Date Reviewed:
  ",

### Prerequisite

- Matrix, Vector

### 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 80 of file MatrixSolver.h.

## Constructor & Destructor Documentation

## MatrixSolver() [1/3]

casacore::MatrixSolver::MatrixSolver | ( |  | ) |

Default Constructor.

Referenced by MatrixSolver(), and operator=().

## MatrixSolver() [2/3]

casacore::MatrixSolver::MatrixSolver | ( | const MatrixSolver & | other | ) |

Copy Constructor.

References MatrixSolver().

## MatrixSolver() [3/3]

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
.

## ~MatrixSolver()

virtual casacore::MatrixSolver::~MatrixSolver | ( |  | ) |

virtual

Virtual destructor: calls all derived class destructors.

## Member Function Documentation

## accurateSolution()

Bool casacore::MatrixSolver::accurateSolution | ( |  | ) |

Is the current solution good enough?

## Gain()

FType casacore::MatrixSolver::Gain | ( |  | ) |

inline

Return the gain for solution.

Definition at line 200 of file MatrixSolver.h.

References gain.

## getNorm()

FType casacore::MatrixSolver::getNorm | ( |  | ) |

inline

Return norm of solution i.e.

||B-AX||

Definition at line 209 of file MatrixSolver.h.

References RNorm.

## getResidual()

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

Return residual vector B-AX.

## getSolution()

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

Return solution vector.

## logSink()

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

inline protected virtual

Definition at line 149 of file MatrixSolver.h.

References logSink_p.

## MaxIters()

uInt casacore::MatrixSolver::MaxIters | ( |  | ) |

inline

Return the maximum number of iterations.

Definition at line 194 of file MatrixSolver.h.

References MaxIterations.

## operator=()

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

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

References MatrixSolver().

## setAB()

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

Set A matrix and B vector.

## setGain()

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

inline

Set the gain for solution.

Definition at line 197 of file MatrixSolver.h.

References gain.

## setMaxIters()

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

inline

Set the maximum number of iterations.

Definition at line 191 of file MatrixSolver.h.

References MaxIterations.

## setSolved()

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

inline

Set status of solution.

Definition at line 203 of file MatrixSolver.h.

References solved.

## setTolerance()

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

inline

Set the tolerance for solution.

Definition at line 185 of file MatrixSolver.h.

References SolTolerance.

## setX()

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

Set initial value of X.

## solve()

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

virtual

Solve for the X vector.

Reimplemented in casacore::NNLSMatrixSolver.

## Solved()

Bool casacore::MatrixSolver::Solved | ( |  | ) |

inline

Return status of solution.

Definition at line 206 of file MatrixSolver.h.

References solved.

## Tolerance()

FType casacore::MatrixSolver::Tolerance | ( |  | ) |

inline

Return the tolerance for solution.

Definition at line 188 of file MatrixSolver.h.

References SolTolerance.

## Member Data Documentation

## AMatrix

Matrix<FType> casacore::MatrixSolver::AMatrix

protected

the A matrix data member

Definition at line 152 of file MatrixSolver.h.

## BNorm

FType casacore::MatrixSolver::BNorm

protected

The data norm i.e.

||B||

Definition at line 167 of file MatrixSolver.h.

## BVector

Vector<FType> casacore::MatrixSolver::BVector

protected

the constraint vector data member

Definition at line 155 of file MatrixSolver.h.

## gain

FType casacore::MatrixSolver::gain

private

Gain.

Definition at line 181 of file MatrixSolver.h.

Referenced by Gain(), and setGain().

## logSink_p

LogSink casacore::MatrixSolver::logSink_p

protected

Definition at line 148 of file MatrixSolver.h.

Referenced by logSink().

## MaxIterations

uInt casacore::MatrixSolver::MaxIterations

private

Maximum number of iterations.

Definition at line 175 of file MatrixSolver.h.

Referenced by MaxIters(), and setMaxIters().

## RNorm

FType casacore::MatrixSolver::RNorm

protected

The solution norm i.e.

||B-AX||

Definition at line 164 of file MatrixSolver.h.

Referenced by getNorm().

## RVector

Vector<FType> casacore::MatrixSolver::RVector

protected

The residual vector data member.

Definition at line 158 of file MatrixSolver.h.

## SolTolerance

FType casacore::MatrixSolver::SolTolerance

private

Tolerance for solution i.e.

||B-AX||/||B|| must be less than this

Definition at line 172 of file MatrixSolver.h.

Referenced by setTolerance(), and Tolerance().

## solved

Bool casacore::MatrixSolver::solved

private

Has a solution been found?

Definition at line 178 of file MatrixSolver.h.

Referenced by setSolved(), and Solved().

## XVector

Vector<FType> casacore::MatrixSolver::XVector

protected

The solution vector data member.

Definition at line 161 of file MatrixSolver.h.

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

- scimath/Mathematics/MatrixSolver.h