The basic operations provided are referencing and indexing of cells,
rows, columns and diagonal of the triangular matrix.
The class is a private structure, with explicit friends.
The contents can be saved in a record (toRecord<src>),
and an object can be created from a record (<src>fromRecord).
The record identifier is 'tmat'.
Index an element in the triangularised matrix
Reset all data to zero
Save or restore using AipsIO.
Prerequisite
Etymology
From Least SQuares and Matrix
Synopsis
The LSQMatrix class contains the handling of the basic container used
in the LSQFit class and its derivatives.
This basic container is a triangular matrix.
Example
See the LSQFit class for its use.
Motivation
The class was written to isolate the handling of the normal equations
used in the LSQ classes.
To Do
Member Description
LSQMatrix()
Default constructor (empty, only usable after a set(n))
explicit LSQMatrix(uInt n)
Construct an object with the number of rows and columns indicated.
If a Bool argument is present, the number
will be taken as double the number given (assumes complex).
LSQMatrix(uInt n, Bool)
LSQMatrix(const LSQMatrix &other)
Copy constructor (deep copy)
LSQMatrix &operator=(const LSQMatrix &other)
Assignment (deep copy)
~LSQMatrix()
Double &operator[](uInt index)
const Double operator[](uInt index) const
void reset()
void set(uInt n)
Set new sizes (default is for Real, a Bool argument will make it complex)
void set(uInt n, Bool)
Double *row(uInt i) const
Get row pointer in normal equation (points to element [i][0])
void incRow(Double *&row, uInt i) const
Get next row or previous row pointer in normal equation if the pointer
row is at row i.
void decRow(Double *&row, uInt i) const
Double *diag(uInt i) const
Get diagonal element pointer [i][i]
uInt nelements() const
Get length of triangular array
uInt nrows() const
Get number of rows
void copy(const LSQMatrix &other)
Copy data.
void init()
Initialise matrix
void clear()
Clear matrix
void deinit()
De-initialise matrix
void doDiagonal(uInt n)
Make diagonal element 1 if zero (Note that this is always called when
invert() is called). Only n-length sub-matrix is done.
void mulDiagonal(uInt n, Double fac)
Multiply n-length of diagonal with 1+fac
void addDiagonal(uInt n, Double fac)
Add fac to n-length of diagonal
Double maxDiagonal(uInt n)
Determine max of abs values of n-length of diagonal
Bool fromRecord(String &error, const RecordInterface &in)
Create a Matrix from a record. An error message is generated, and False
returned if an invalid record is given. A valid record will return True.
Error messages are postfixed to error.
Bool toRecord(String &error, RecordInterface &out) const
Create a record from an LSQMatrix. The return will be False and an error
message generated only if the object does not contain a valid Matrix.
Error messages are postfixed to error.
const String &ident() const
Get identification of record
static Bool putCArray(String &error, RecordInterface &out, const String &fname, uInt len, const Double * const in)
Convert a carray to/from a record. Field only written if
non-zero length. No carray created if field does not exist on input.
False returned if unexpectedly no data available for non-zero length
(put), or a field has zero length vector(get).
static Bool getCArray(String &error, const RecordInterface &in, const String &fname, uInt len, Double *&out)
static Bool putCArray(String &error, RecordInterface &out, const String &fname, uInt len, const uInt * const in)
static Bool getCArray(String &error, const RecordInterface &in, const String &fname, uInt len, uInt *&out)
void fromAipsIO (AipsIO& in)
void toAipsIO (AipsIO& out) const
static void putCArray (AipsIO& out, uInt len, const Double* const in)
static void getCArray (AipsIO& in, uInt len, Double*& out)
static void putCArray (AipsIO& out, uInt len, const uInt* const in)
static void getCArray (AipsIO& in, uInt len, uInt*& out)