DecompLib
A simple library for decomposition of spectra using a response matrix.
|
A representation of the matrix response functions. More...
#include <RespMatrix.h>
Public Member Functions | |
RespMatrix (int numFunctions, int numRespCells, bool printBadSafety=true) | |
Constructor. More... | |
ParamType | getElement (int funcNum, int respInd) const |
Returns the value of the matrix at the specified cell. More... | |
ParamType | getElementTranspose (int funcNum, int respInd) const |
Returns the value of the transpose at the specified cell. More... | |
ParamType * | getMatrixPtr () |
Gives access to the underlying matrix pointer. More... | |
int | getNumRespFuncs () const |
Returns the number of response functions in the matrix. More... | |
int | getRespFuncsLens () const |
Returns the length of each response function in the matrix. More... | |
ParamType * | getSummedRowPtr () |
Gives access to the underlying pointer to the vector from summing the rows of the resp matrix. More... | |
ParamType * | getTransposePtr () |
Gives access to the underlying matrix transpose pointer. More... | |
bool | isSafe () |
Checks if the response matrix is safe for usage in the decomposition. More... | |
void | setElement (int funcNum, int respInd, ParamType val) |
Sets the element in the matrix and its transpose. More... | |
Private Member Functions | |
void | calculateSummedRows () |
Calculates the summed rows vector used in the decomposition calculation. | |
Private Attributes | |
ParamType * | matrix |
The response matrix. | |
int | numFunc |
The number of response functions in the matrix. | |
bool | printErrors |
Stores if errors should be printed during safety checks. | |
int | respLen |
The number of elements in each response function. | |
bool | rowSumPerformed = false |
Stores if the response matrix row sum has been performed yet. | |
ParamType * | summedRows |
The vector that results when each row of the matrix is summed independently. | |
ParamType * | transpose |
The transpose of the response matrix. | |
A representation of the matrix response functions.
ParamType | The floating point type for which this calculation will be carried out |
Definition at line 33 of file RespMatrix.h.
|
inline |
Constructor.
numFunctions | The number of response functions |
numRespCells | The number of cells per response function |
printBadSafety | Whether or not to print locations of errors in safety checks |
Definition at line 42 of file RespMatrix.h.
References RespMatrix< ParamType >::matrix, RespMatrix< ParamType >::summedRows, and RespMatrix< ParamType >::transpose.
|
inline |
Returns the value of the matrix at the specified cell.
funcNum | The index of the response function whose value is being set |
respInd | The index within the response function that is being set |
Definition at line 71 of file RespMatrix.h.
References RespMatrix< ParamType >::matrix, and RespMatrix< ParamType >::respLen.
|
inline |
Returns the value of the transpose at the specified cell.
funcNum | The index of the response function whose value is being set |
respInd | The index within the response function that is being set |
This is the same as get element but allows row major traversal even with iterating on function number faster than response index
Definition at line 85 of file RespMatrix.h.
References RespMatrix< ParamType >::respLen, and RespMatrix< ParamType >::transpose.
|
inline |
Gives access to the underlying matrix pointer.
Definition at line 108 of file RespMatrix.h.
References RespMatrix< ParamType >::matrix.
Referenced by performDecomposition().
|
inline |
Returns the number of response functions in the matrix.
Definition at line 94 of file RespMatrix.h.
References RespMatrix< ParamType >::numFunc.
Referenced by performDecomposition(), and testSafety().
|
inline |
Returns the length of each response function in the matrix.
Definition at line 100 of file RespMatrix.h.
References RespMatrix< ParamType >::respLen.
Referenced by performDecomposition(), and testSafety().
|
inline |
Gives access to the underlying pointer to the vector from summing the rows of the resp matrix.
Definition at line 124 of file RespMatrix.h.
References RespMatrix< ParamType >::calculateSummedRows(), RespMatrix< ParamType >::isSafe(), RespMatrix< ParamType >::rowSumPerformed, and RespMatrix< ParamType >::summedRows.
Referenced by performDecomposition().
|
inline |
Gives access to the underlying matrix transpose pointer.
Definition at line 116 of file RespMatrix.h.
References RespMatrix< ParamType >::transpose.
Referenced by performDecomposition().
bool RespMatrix< ParamType >::isSafe | ( | ) |
Checks if the response matrix is safe for usage in the decomposition.
This makes sure that each of the rows and each of the columns sums to greater than zero and contains no negative values
Definition at line 175 of file RespMatrix.h.
References RespMatrix< ParamType >::matrix, RespMatrix< ParamType >::numFunc, RespMatrix< ParamType >::printErrors, RespMatrix< ParamType >::respLen, and RespMatrix< ParamType >::transpose.
Referenced by RespMatrix< ParamType >::getSummedRowPtr(), and testSafety().
|
inline |
Sets the element in the matrix and its transpose.
funcNum | The index of the response function whose value is being set |
respInd | The index within the response function that is being set |
val | The value to set the cell to |
Definition at line 57 of file RespMatrix.h.
References RespMatrix< ParamType >::matrix, RespMatrix< ParamType >::numFunc, RespMatrix< ParamType >::respLen, RespMatrix< ParamType >::rowSumPerformed, and RespMatrix< ParamType >::transpose.