![]() |
Diana Software
|
An array of complex matrices that have been laid out in memory. More...
Public Member Functions | |
| QMatrixCArray () | |
| Default ctor. More... | |
| QMatrixCArray (const QMatrixCArray &in) | |
| virtual | ~QMatrixCArray () |
| virtual void | Clear () |
| Clear the data in memory. More... | |
| void | Initialize (double Re, double Im=0) |
| Initialize the values of the matrix. More... | |
| void | Initialize (const QComplex &Val) |
| Initialize the values of the matrix. More... | |
| void | Invert () |
| Invert the matrices in place. More... | |
| void | CholeskyDecompose () |
| Cholesky decompose the matrices in place. More... | |
| virtual void | CholeskySolveX (const Diana::QVectorC &Y, Diana::QVectorC &X) const |
| Solve the equation AX=Y for X. More... | |
Protected Member Functions | |
| QMatrixCArray (UInt_t nMatrix, UInt_t nRow, UInt_t nCol) | |
| const QMatrixCArray & | operator= (const QMatrixCArray &in) |
| void | Resize (UInt_t nMatrix, UInt_t nRow, UInt_t nCol) |
| Resize, destroys all data in memory. More... | |
| UInt_t | GetSize () const |
| Return the total number of doubles in memory. More... | |
| UInt_t | GetNMatrix () const |
| Return the number of matrices stored. More... | |
| UInt_t | GetNRow () const |
| Return the number of rows in each matrix. More... | |
| UInt_t | GetNCol () const |
| Return the number of columns in each matrix. More... | |
| QMatrixC | GetMatrix (UInt_t idx) |
| Return the vector of values in the (idx1,idx2) position. More... | |
| const QMatrixC | GetMatrix (UInt_t idx) const |
| Return the vector of values in the (idx1,idx2) position. More... | |
| Diana::QVectorC | GetVector (UInt_t idx1, UInt_t idx2) |
| Return the vector of values in the (idx1,idx2) position. More... | |
| const Diana::QVectorC | GetVector (UInt_t idx1, UInt_t idx2) const |
| Return the vector of values in the (idx1,idx2) position. More... | |
| ClassDef (QMatrixCArray, 2) | |
Protected Attributes | |
| Bool_t | fDataOwner |
| UInt_t | fSize |
| Number of double values in fData. More... | |
| UInt_t | fNMatrix |
| Number of identical matrices. More... | |
| UInt_t | fNRow |
| Number of rows in each matrix. More... | |
| UInt_t | fNCol |
| Number of columns in each matrix. More... | |
| Double_t * | fData |
| Pointer to the head of the data. More... | |
An array of complex matrices that have been laid out in memory.
fData is an array of fNMatrix X fNRow X fNCol X 2 values. (The two comes from the fact that its complex).
The data are laid out as follows:
f1_00 f1_01 .. f1_0N f2_00 f2_01 .. f2_0N .... FM_01 .. FM_0N
f1_10 f1_11 .. f1_1N f2_10 f2_11 .. f2_1N .... FM_11 .. FM_1N
..
f1_N0 f1_N1 .. f1_NN f2_N0 f2_N1 .. f2_NN .... FM_N1 .. FM_NN
(In the complex case, each element represents two doubles).
In this way, the matrix rows are contiguous in memory, the matrix k begins at fData+k*NCol and has trailing dimension (tda) of NMatrix*NCol. The vector of (i,j)th elements from the NMatrix matrices is a vector beginning at fData+i*NCol*Matrix+j with stride NCol.
Definition at line 35 of file QMatrixCArray.hh.
| QMatrixCArray::QMatrixCArray | ( | ) |
Default ctor.
| QMatrixCArray::QMatrixCArray | ( | const QMatrixCArray & | in | ) |
|
virtual |
Definition at line 38 of file QMatrixCArray.cc.
References Clear().
|
protected |
Definition at line 27 of file QMatrixCArray.cc.
References Resize().
| void QMatrixCArray::CholeskyDecompose | ( | ) |
Cholesky decompose the matrices in place.
Computationally this amounts to NMatrix * (NRow X NCol) Cholesky decompositions.
The decomposition is done in place and requires no extra memory.
Definition at line 117 of file QMatrixCArray.cc.
References QMatrixC::CholeskyDecompose(), GetMatrix(), and GetNMatrix().
|
virtual |
Solve the equation AX=Y for X.
Uses a Cholesky decomposition of a matrix to solve the equation
AX = (LL^T)X=Y.
Computationally this splits the problem up into NMatrix Cholesky solutions and tacks them together.
NOTE: This assumes that the matrices have been Cholesky decomposed already.
Definition at line 124 of file QMatrixCArray.cc.
References DianaThrow, and QERR_SIZE_NOT_MATCH.
|
protected |
|
virtual |
Clear the data in memory.
Definition at line 42 of file QMatrixCArray.cc.
References QVector::ArrayFree(), fData, fDataOwner, fNCol, fNMatrix, fNRow, and fSize.
Referenced by operator=(), and ~QMatrixCArray().
|
protected |
Return the vector of values in the (idx1,idx2) position.
Returns the matrix in position idx of all the matrices. The returned QMatrixC is not the owner of the memory and operates on the data in the location where it is stored in fData.
Definition at line 79 of file QMatrixCArray.cc.
References DianaThrow, fData, fNCol, fNMatrix, fNRow, and QERR_SIZE_NOT_MATCH.
Referenced by CholeskyDecompose(), and Invert().
|
protected |
Return the vector of values in the (idx1,idx2) position.
Returns the matrix in position idx of all the matrices. The returned QMatrixC is not the owner of the memory and operates on the data in the location where it is stored in fData.
This is the constant version, and the resulting QMatrixC is const.
Definition at line 87 of file QMatrixCArray.cc.
References DianaThrow, fData, fNCol, fNMatrix, fNRow, and QERR_SIZE_NOT_MATCH.
|
inlineprotected |
Return the number of columns in each matrix.
Definition at line 110 of file QMatrixCArray.hh.
References fNCol.
Referenced by Resize().
|
inlineprotected |
Return the number of matrices stored.
Definition at line 104 of file QMatrixCArray.hh.
References fNMatrix.
Referenced by CholeskyDecompose(), Invert(), and Resize().
|
inlineprotected |
Return the number of rows in each matrix.
Definition at line 107 of file QMatrixCArray.hh.
References fNRow.
Referenced by Resize().
|
inlineprotected |
Return the total number of doubles in memory.
Definition at line 102 of file QMatrixCArray.hh.
References fSize.
|
protected |
Return the vector of values in the (idx1,idx2) position.
Returns the vector of values in the (idx1,idx2) position of all the matrices. The returned QVectorC is not the owner of the memory and operates on the data in the location where it is stored in fData.
Definition at line 95 of file QMatrixCArray.cc.
References DianaThrow, fData, fNCol, fNMatrix, fNRow, and QERR_SIZE_NOT_MATCH.
|
protected |
Return the vector of values in the (idx1,idx2) position.
Returns the vector of values in the (idx1,idx2) position of all the matrices. The returned QVectorC is not the owner of the memory and operates on the data in the location where it is stored in fData.
This is the constant version, and the resulting QVectorC is const.
Definition at line 103 of file QMatrixCArray.cc.
References DianaThrow, fData, fNCol, fNMatrix, fNRow, and QERR_SIZE_NOT_MATCH.
| void QMatrixCArray::Initialize | ( | const QComplex & | Val | ) |
Initialize the values of the matrix.
Definition at line 76 of file QMatrixCArray.cc.
References QComplex::Im(), Initialize(), and QComplex::Re().
| void QMatrixCArray::Initialize | ( | double | Re, |
| double | Im = 0 |
||
| ) |
Initialize the values of the matrix.
Definition at line 71 of file QMatrixCArray.cc.
References fData, fSize, Im(), and Re().
Referenced by Initialize().
| void QMatrixCArray::Invert | ( | ) |
Invert the matrices in place.
Computationally this amounts to NMatrix * (NRow X NCol) matrix inversions.
The inversions proceed through an LU decomposition. And require copying the matrix to another memory location.
Definition at line 111 of file QMatrixCArray.cc.
References GetMatrix(), GetNMatrix(), and QMatrixC::Invert().
|
protected |
|
protected |
Resize, destroys all data in memory.
Definition at line 57 of file QMatrixCArray.cc.
References QVector::ArrayAlloc(), QVector::ArrayFree(), DianaThrow, fData, fDataOwner, fNCol, fNMatrix, fNRow, fSize, GetNCol(), GetNMatrix(), GetNRow(), and QERR_SIZE_NOT_MATCH.
Referenced by operator=(), and QMatrixCArray().
|
protected |
Pointer to the head of the data.
Definition at line 170 of file QMatrixCArray.hh.
Referenced by Clear(), GetMatrix(), GetVector(), Initialize(), operator=(), QMatrixCArray(), and Resize().
|
protected |
Definition at line 155 of file QMatrixCArray.hh.
|
protected |
Number of columns in each matrix.
Definition at line 167 of file QMatrixCArray.hh.
Referenced by Clear(), GetMatrix(), GetNCol(), GetVector(), operator=(), QMatrixCArray(), and Resize().
|
protected |
Number of identical matrices.
Definition at line 161 of file QMatrixCArray.hh.
Referenced by Clear(), GetMatrix(), GetNMatrix(), GetVector(), operator=(), QMatrixCArray(), and Resize().
|
protected |
Number of rows in each matrix.
Definition at line 164 of file QMatrixCArray.hh.
Referenced by Clear(), GetMatrix(), GetNRow(), GetVector(), operator=(), QMatrixCArray(), and Resize().
|
protected |
Number of double values in fData.
Definition at line 158 of file QMatrixCArray.hh.
Referenced by Clear(), GetSize(), Initialize(), operator=(), QMatrixCArray(), and Resize().