DecompLib
A simple library for decomposition of spectra using a response matrix.
|
A representation of the vector of decomposition parameters that is passed into the decomposition as an initial guess and passed out as the final answer. More...
#include <DecompVector.h>
Public Member Functions | |
DecompVector (int length, bool printBadSafety=true) | |
Constructor. More... | |
DecompVector (const DecompVector< ParamType > &dv) | |
Copy Constructor. More... | |
ParamType | getElement (int index) const |
Returns the value of the vector at index. More... | |
int | getLength () const |
Gets the size of the vector. More... | |
ParamType * | getRawDataPtr () |
Gives access to the underlying vector pointer. More... | |
void | initWithConstant (const ParamType &val) |
Initializes this vector with a constant parameter. More... | |
void | initWithDataVector (const DataVector< ParamType > &val, const ParamType &factor, const ParamType &offset=0.0) |
Initializes this vector by subsampling a DataVector. More... | |
bool | isSafe () |
Checks if the decomp vector guess is safe for usage in the decomposition. More... | |
DecompVector< ParamType > & | operator= (const DecompVector< ParamType > &dv) |
Assignment Operator. More... | |
void | setElement (int index, ParamType value) |
Places a given value into a specific index in the vector. More... | |
Private Attributes | |
bool | printErrors |
Stores if errors should be printed during safety checks. | |
int | size |
The number of cells in the input data vector. | |
double | TinyValue = 1.0e-10 |
Tiny value to use where the input spectrum is zero / too small in initialization. | |
ParamType * | vec |
The data vector itself. | |
A representation of the vector of decomposition parameters that is passed into the decomposition as an initial guess and passed out as the final answer.
ParamType | The floating point type for which this calculation will be carried out |
Definition at line 32 of file DecompVector.h.
|
inline |
Constructor.
length | the number of values in the vector |
printBadSafety | Whether or not to print locations of errors in safety checks |
Definition at line 40 of file DecompVector.h.
References DecompVector< ParamType >::operator=(), and DecompVector< ParamType >::vec.
DecompVector< ParamType >::DecompVector | ( | const DecompVector< ParamType > & | dv | ) |
Copy Constructor.
dv | The original DecompVector to copy |
Definition at line 121 of file DecompVector.h.
References DecompVector< ParamType >::size, and DecompVector< ParamType >::vec.
|
inline |
Returns the value of the vector at index.
index | The index into the vector |
Definition at line 73 of file DecompVector.h.
References DecompVector< ParamType >::vec.
Referenced by performDecomposition().
|
inline |
Gets the size of the vector.
Definition at line 79 of file DecompVector.h.
References DecompVector< ParamType >::initWithConstant(), DecompVector< ParamType >::initWithDataVector(), and DecompVector< ParamType >::size.
Referenced by testSafety().
|
inline |
Gives access to the underlying vector pointer.
Definition at line 102 of file DecompVector.h.
References DecompVector< ParamType >::isSafe(), and DecompVector< ParamType >::vec.
void DecompVector< ParamType >::initWithConstant | ( | const ParamType & | val | ) |
Initializes this vector with a constant parameter.
val | The value that every element of the vector should contain |
Definition at line 176 of file DecompVector.h.
References DecompVector< ParamType >::size, and DecompVector< ParamType >::vec.
Referenced by DecompVector< ParamType >::getLength().
void DecompVector< ParamType >::initWithDataVector | ( | const DataVector< ParamType > & | val, |
const ParamType & | factor, | ||
const ParamType & | offset = 0.0 |
||
) |
Initializes this vector by subsampling a DataVector.
val | The data vector that this decomp vector should be initialized from, the length of this vector should be greater than or equal to the length of this vector |
factor | A factor to multiply the values from the data vector by |
offset | An offset to add to the values from the data vector |
Definition at line 145 of file DecompVector.h.
References DataVector< ParamType >::getElement(), DataVector< ParamType >::getLength(), DecompVector< ParamType >::size, DecompVector< ParamType >::TinyValue, and DecompVector< ParamType >::vec.
Referenced by DecompVector< ParamType >::getLength().
bool DecompVector< ParamType >::isSafe | ( | ) |
Checks if the decomp vector guess is safe for usage in the decomposition.
Checking the vector's safety involves testing that every element is greater than zero
Definition at line 185 of file DecompVector.h.
References DecompVector< ParamType >::printErrors, DecompVector< ParamType >::size, and DecompVector< ParamType >::vec.
Referenced by DecompVector< ParamType >::getRawDataPtr(), and testSafety().
DecompVector< ParamType > & DecompVector< ParamType >::operator= | ( | const DecompVector< ParamType > & | dv | ) |
Assignment Operator.
dv | The DecompVector whose contents is to be copied into this one |
Definition at line 131 of file DecompVector.h.
References DecompVector< ParamType >::printErrors, DecompVector< ParamType >::size, and DecompVector< ParamType >::vec.
Referenced by DecompVector< ParamType >::DecompVector().
|
inline |
Places a given value into a specific index in the vector.
index | The index into the vector |
value | The value to place at index |
Definition at line 64 of file DecompVector.h.
References DecompVector< ParamType >::vec.
Referenced by performDecomposition().