LSQMatrix.h

Classes

LSQMatrix -- Support class for the LSQ package (full description)

class LSQMatrix

Interface

Private Members
LSQMatrix()
explicit LSQMatrix(uInt n)
LSQMatrix(uInt n, Bool)
LSQMatrix(const LSQMatrix &other)
LSQMatrix &operator=(const LSQMatrix &other)
~LSQMatrix()
Double &operator[](uInt index)
const Double operator[](uInt index) const
void reset()
void set(uInt n)
void set(uInt n, Bool)
Double *row(uInt i) const
void incRow(Double *&row, uInt i) const
void decRow(Double *&row, uInt i) const
Double *diag(uInt i) const
uInt nelements() const
uInt nrows() const
void copy(const LSQMatrix &other)
void init()
void clear()
void deinit()
void doDiagonal(uInt n)
void mulDiagonal(uInt n, Double fac)

Description

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.

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.

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)
LSQMatrix(uInt n, Bool)

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(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

Index an element in the triangularised matrix

void reset()

Reset all data to zero

void set(uInt n)
void set(uInt n, Bool)

Set new sizes (default is for Real, a Bool argument will make it complex)

Double *row(uInt i) const

Get row pointer in normal equation (points to element [i][0])

void incRow(Double *&row, uInt i) const
void decRow(Double *&row, uInt i) const

Get next row or previous row pointer in normal equation if the pointer row is at row i.

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