casacore
|
#include <LSQMatrix.h>
Public Member Functions | |
Double * | row_pub (uInt i) const |
A set of public interface functions. More... | |
void | incRow_pub (Double *&row, uInt i) const |
Get next row or previous row pointer in normal equation if the pointer row is at row i . More... | |
void | decRow_pub (Double *&row, uInt i) const |
Double * | diag_pub (uInt i) const |
Get diagonal element pointer [i][i] More... | |
uInt | nelements_pub () const |
Get length of triangular array. More... | |
uInt | nrows_pub () const |
Get number of rows. More... | |
void | doDiagonal_pub (uInt n) |
Make diagonal element 1 if zero (Note that this is always called when invert() is called). More... | |
void | mulDiagonal_pub (uInt n, Double fac) |
Multiply n-length of diagonal with 1+fac More... | |
void | addDiagonal_pub (uInt n, Double fac) |
Add fac to n-length of diagonal. More... | |
Double | maxDiagonal_pub (uInt n) |
Determine max of abs values of n-length of diagonal. More... | |
Public Member Functions inherited from casacore::RecordTransformable | |
virtual | ~RecordTransformable () |
The destructor must be virtual so that the destructor of derived classes is actually used. More... | |
virtual Bool | fromString (String &error, const String &inString) |
Initialise the class from a String representation. More... | |
Private Member Functions | |
LSQMatrix () | |
Default constructor (empty, only usable after a set(n) ) More... | |
LSQMatrix (uInt n) | |
Construct an object with the number of rows and columns indicated. More... | |
LSQMatrix (uInt n, Bool) | |
LSQMatrix (const LSQMatrix &other) | |
Copy constructor (deep copy) More... | |
LSQMatrix & | operator= (const LSQMatrix &other) |
Assignment (deep copy) More... | |
~LSQMatrix () | |
Double & | operator[] (uInt index) |
Index an element in the triangularised matrix. More... | |
Double | operator[] (uInt index) const |
void | reset () |
Reset all data to zero. More... | |
void | set (uInt n) |
Set new sizes (default is for Real, a Bool argument will make it complex) More... | |
void | set (uInt n, Bool) |
Double * | row (uInt i) const |
Get row pointer in normal equation (points to element [i][0] ) More... | |
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 . More... | |
void | decRow (Double *&row, uInt i) const |
Double * | diag (uInt i) const |
Get diagonal element pointer [i][i] More... | |
uInt | nelements () const |
Get length of triangular array. More... | |
uInt | nrows () const |
Get number of rows. More... | |
void | copy (const LSQMatrix &other) |
Copy data. More... | |
void | init () |
Initialise matrix. More... | |
void | clear () |
Clear matrix. More... | |
void | deinit () |
De-initialise matrix. More... | |
void | doDiagonal (uInt n) |
Make diagonal element 1 if zero (Note that this is always called when invert() is called). More... | |
void | mulDiagonal (uInt n, Double fac) |
Multiply n-length of diagonal with 1+fac More... | |
void | addDiagonal (uInt n, Double fac) |
Add fac to n-length of diagonal. More... | |
Double | maxDiagonal (uInt n) |
Determine max of abs values of n-length of diagonal. More... | |
Bool | fromRecord (String &error, const RecordInterface &in) |
Create a Matrix from a record. More... | |
Bool | toRecord (String &error, RecordInterface &out) const |
Create a record from an LSQMatrix. More... | |
const String & | ident () const |
Get identification of record. More... | |
void | fromAipsIO (AipsIO &in) |
Save or restore using AipsIO. More... | |
void | toAipsIO (AipsIO &out) const |
Static Private Member Functions | |
static Bool | putCArray (String &error, RecordInterface &out, const String &fname, uInt len, const Double *const in) |
Convert a carray to/from a record. More... | |
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) |
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) |
Private Attributes | |
uInt | n_p |
Matrix size (linear size) More... | |
uInt | len_p |
Derived sizes (all 0 if n_p equals 0) More... | |
uInt | nm1_p |
n-1 More... | |
Int | n2m1_p |
2n-1 More... | |
Int | n2p1_p |
2n+1 More... | |
Double * | trian_p |
Matrix (triangular n_p * n_p) More... | |
Static Private Attributes | |
static const String | tmatsiz |
Record field names. More... | |
static const String | tmatdat |
Friends | |
class | LSQFit |
Support class for the LSQ package
From Least SQuares and Matrix
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.
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 class contains a number of public methods (with _pub in name) that can be used anywhere, and which perform index range checking.
The contents can be saved in a record (toRecord
), and an object can be created from a record (fromRecord
). The record identifier is 'tmat'.
See the LSQFit class for its use.
The class was written to isolate the handling of the normal equations used in the LSQ
classes.
Definition at line 85 of file LSQMatrix.h.
|
private |
Default constructor (empty, only usable after a set(n)
)
|
explicitprivate |
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).
|
private |
Copy constructor (deep copy)
|
private |
Add fac
to n-length of diagonal.
Referenced by addDiagonal_pub().
Add fac
to n-length of diagonal.
Definition at line 113 of file LSQMatrix.h.
References addDiagonal(), and n_p.
|
private |
Clear matrix.
Referenced by reset().
|
private |
Copy data.
Definition at line 99 of file LSQMatrix.h.
|
private |
De-initialise matrix.
Get diagonal element pointer [i][i]
Definition at line 161 of file LSQMatrix.h.
References n2p1_p, and trian_p.
Referenced by diag_pub().
Get diagonal element pointer [i][i]
Definition at line 102 of file LSQMatrix.h.
|
private |
Make diagonal element 1 if zero (Note that this is always called when invert()
is called).
Only n-length sub-matrix is done.
Referenced by doDiagonal_pub().
|
inline |
Make diagonal element 1 if zero (Note that this is always called when invert()
is called).
Only n-length sub-matrix is done.
Definition at line 109 of file LSQMatrix.h.
References doDiagonal(), and n_p.
|
privatevirtual |
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.
Implements casacore::RecordTransformable.
|
staticprivate |
|
staticprivate |
|
privatevirtual |
Get identification of record.
Reimplemented from casacore::RecordTransformable.
Get next row or previous row pointer in normal equation if the pointer row
is at row i
.
Definition at line 157 of file LSQMatrix.h.
Referenced by incRow_pub().
Get next row or previous row pointer in normal equation if the pointer row
is at row i
.
Definition at line 98 of file LSQMatrix.h.
|
private |
Initialise matrix.
Determine max of abs values of n-length of diagonal.
Referenced by maxDiagonal_pub().
Determine max of abs values of n-length of diagonal.
Definition at line 115 of file LSQMatrix.h.
References maxDiagonal(), and n_p.
Multiply n-length of diagonal with 1+fac
Referenced by mulDiagonal_pub().
Multiply n-length of diagonal with 1+fac
Definition at line 111 of file LSQMatrix.h.
References mulDiagonal(), and n_p.
|
inlineprivate |
|
inline |
|
inlineprivate |
|
inline |
Index an element in the triangularised matrix.
Definition at line 140 of file LSQMatrix.h.
References trian_p.
Definition at line 141 of file LSQMatrix.h.
References trian_p.
|
staticprivate |
|
staticprivate |
|
staticprivate |
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).
|
staticprivate |
|
inlineprivate |
Get row pointer in normal equation (points to element [i][0]
)
Definition at line 153 of file LSQMatrix.h.
References n2m1_p, and trian_p.
Referenced by decRow(), decRow_pub(), incRow(), incRow_pub(), and row_pub().
A set of public interface functions.
Checks for index ranges are made, and zero or null returned if error.
Get row pointer in normal equation (points to element [i][0]
)
Definition at line 94 of file LSQMatrix.h.
|
private |
Set new sizes (default is for Real, a Bool argument will make it complex)
|
private |
|
privatevirtual |
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.
Implements casacore::RecordTransformable.
|
friend |
Definition at line 87 of file LSQMatrix.h.
|
private |
Derived sizes (all 0 if n_p equals 0)
Total size
Definition at line 228 of file LSQMatrix.h.
Referenced by nelements(), and nelements_pub().
|
private |
|
private |
|
private |
Matrix size (linear size)
Definition at line 224 of file LSQMatrix.h.
Referenced by addDiagonal_pub(), decRow(), diag_pub(), doDiagonal_pub(), incRow_pub(), maxDiagonal_pub(), mulDiagonal_pub(), nrows(), nrows_pub(), and row_pub().
|
private |
|
staticprivate |
Definition at line 240 of file LSQMatrix.h.
|
staticprivate |
Record field names.
Definition at line 239 of file LSQMatrix.h.
|
private |
Matrix (triangular n_p * n_p)
Definition at line 237 of file LSQMatrix.h.
Referenced by diag(), operator[](), and row().