DecompLib
A simple library for decomposition of spectra using a response matrix.
RespMatrix< ParamType > Class Template Reference

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.
 

Detailed Description

template<typename ParamType>
class RespMatrix< ParamType >

A representation of the matrix response functions.

Template Parameters
ParamTypeThe floating point type for which this calculation will be carried out

Definition at line 33 of file RespMatrix.h.

Constructor & Destructor Documentation

template<typename ParamType>
RespMatrix< ParamType >::RespMatrix ( int  numFunctions,
int  numRespCells,
bool  printBadSafety = true 
)
inline

Constructor.

Parameters
numFunctionsThe number of response functions
numRespCellsThe number of cells per response function
printBadSafetyWhether 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.

Member Function Documentation

template<typename ParamType>
ParamType RespMatrix< ParamType >::getElement ( int  funcNum,
int  respInd 
) const
inline

Returns the value of the matrix at the specified cell.

Parameters
funcNumThe index of the response function whose value is being set
respIndThe index within the response function that is being set
Returns
The value of the matrix in the specified location

Definition at line 71 of file RespMatrix.h.

References RespMatrix< ParamType >::matrix, and RespMatrix< ParamType >::respLen.

template<typename ParamType>
ParamType RespMatrix< ParamType >::getElementTranspose ( int  funcNum,
int  respInd 
) const
inline

Returns the value of the transpose at the specified cell.

Parameters
funcNumThe index of the response function whose value is being set
respIndThe index within the response function that is being set
Returns
The value of the matrix in the specified location

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.

template<typename ParamType>
ParamType* RespMatrix< ParamType >::getMatrixPtr ( )
inline

Gives access to the underlying matrix pointer.

Returns
The underlying matrix pointer
Remarks
This function should only be used within decomp library

Definition at line 108 of file RespMatrix.h.

References RespMatrix< ParamType >::matrix.

Referenced by performDecomposition().

template<typename ParamType>
int RespMatrix< ParamType >::getNumRespFuncs ( ) const
inline

Returns the number of response functions in the matrix.

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

template<typename ParamType>
int RespMatrix< ParamType >::getRespFuncsLens ( ) const
inline

Returns the length of each response function in the matrix.

Returns
The length of the response functions in the matrix

Definition at line 100 of file RespMatrix.h.

References RespMatrix< ParamType >::respLen.

Referenced by performDecomposition(), and testSafety().

template<typename ParamType>
ParamType* RespMatrix< ParamType >::getSummedRowPtr ( )
inline

Gives access to the underlying pointer to the vector from summing the rows of the resp matrix.

Returns
The underlying summed row vector pointer
Remarks
This function should only be used within decomp library

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

template<typename ParamType>
ParamType* RespMatrix< ParamType >::getTransposePtr ( )
inline

Gives access to the underlying matrix transpose pointer.

Returns
The underlying matrix transpose pointer
Remarks
This function should only be used within decomp library

Definition at line 116 of file RespMatrix.h.

References RespMatrix< ParamType >::transpose.

Referenced by performDecomposition().

template<typename ParamType >
bool RespMatrix< ParamType >::isSafe ( )

Checks if the response matrix is safe for usage in the decomposition.

Returns
True if safe, False if unsafe

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

template<typename ParamType>
void RespMatrix< ParamType >::setElement ( int  funcNum,
int  respInd,
ParamType  val 
)
inline

Sets the element in the matrix and its transpose.

Parameters
funcNumThe index of the response function whose value is being set
respIndThe index within the response function that is being set
valThe 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.


The documentation for this class was generated from the following file: