|
|
| Indexed_Matrix (const DIMTYPE n, bool LUstorage=false) |
| | allocates for an n x n matrix; LUstorage true also allocates the permutation/whereis buffers LUdecompose() needs (i.e. this instance is meant to serve as an LU-decomposition result buffer)
|
|
| Indexed_Matrix (const Indexed_Matrix &im) |
| | copy-constructor (deep-copies the raw buffer, index map, and any allocated LU/temporary buffers)
|
|
Indexed_Matrix & | operator= (Indexed_Matrix const &im) |
| | deep-copy assignment (reallocates only where capacity or LU-storage presence differs from im's)
|
|
void | reset (const DIMTYPE n_max, bool LUstorage=false) |
| | reallocates
|
|
void | redim (const DIMTYPE n=0) |
| | keeps main allocations, just resets index arrays and adjusts _n; n==0 here equals _n_max
|
|
DATATYPE & | at_raw (const DIMTYPE row, const DIMTYPE col) |
| | raw (unindexed) element access, row and col in [0,get_n())
|
|
DATATYPE & | at (const DIMTYPE row, const DIMTYPE col) |
| | indexed access through the narrow_to() subset map – both row and col are mapped, row/col in [0,get_d())
|
|
DATATYPE * | get_row_raw (const DIMTYPE row) |
| | pointer to the start of raw row row (unindexed, get_n() entries), row in [0,get_n())
|
|
DATATYPE * | get_row (const DIMTYPE row) |
| | pointer to the start of matrix row _index[row] (only the row is subset-mapped – the returned row still spans all get_n() raw columns, unlike at()), row in [0,get_d())
|
|
void | narrow_to (const PSubset sub) |
| | fill _index[] -> access to data is then mapped to sub-matrix
|
|
void | denarrow () |
| | reset _index[] -> access is reset to the full matrix
|
|
DIMTYPE | get_n_max () const |
| | the allocated capacity (max n the matrix can reset()/redim() to without reallocating)
|
|
DIMTYPE | get_n () const |
| | the full ("raw") dimensionality currently in use, get_n()<=get_n_max()
|
|
DIMTYPE | get_d () const |
| | the current virtual (narrow_to()'d) dimensionality, get_d()<=get_n()
|
|
void | set_all_raw_to (const DATATYPE val) |
| | sets all get_n()*get_n() raw entries to val (ignores the index map)
|
|
void | add_raw (const Indexed_Matrix &mr) |
| | this += mr, elementwise over the raw get_n()*get_n() entries (requires mr.get_n()==get_n())
|
|
void | add_constmul_raw (const Indexed_Matrix &mr, const DATATYPE mul) |
| | this += mul * mr, elementwise over the raw get_n()*get_n() entries (requires mr.get_n()==get_n())
|
|
void | copy_constmul_raw (const Indexed_Matrix &mr, const DATATYPE mul) |
| | this = mul * mr, elementwise over the raw get_n()*get_n() entries (an assignment, not an accumulation; requires mr.get_n()==get_n())
|
|
void | copy_raw (const Indexed_Matrix &mr) |
| | this = mr, elementwise over the raw get_n()*get_n() entries (requires mr.get_n()==get_n())
|
| void | LUdecompose (Indexed_Matrix &result) |
| void | solve_equations (Indexed_Vector< DATATYPE, DIMTYPE, SUBSET > &result_vec, const Indexed_Matrix &LU_matrix, Indexed_Vector< DATATYPE, DIMTYPE, SUBSET > &coef_vec) |
| void | invert (Indexed_Matrix &result, const Indexed_Matrix &LU_matrix) |
| DATATYPE | determinant (const Indexed_Matrix &LU_matrix) |
| DATATYPE | log_determinant (const Indexed_Matrix &LU_matrix) |
|
|
DIMTYPE | _n_max |
| | allocated space can hold _n_max*_n_max matrix
|
|
DIMTYPE | _n |
| | full feature set dimensionality
|
|
std::unique_ptr< DATATYPE[]> | _data |
| | raw matrix data, _n_max*_n_max entries, row by row
|
|
std::unique_ptr< DIMTYPE[]> | _permut |
| | LU row permutation, physical row -> logical row (the inverse of _tmp_whereis); allocated only for an LUstorage matrix.
|
|
int | _sign |
| | sign of the LU row permutation (+1/-1; 0 before any decomposition), the factor determinant() needs
|
|
DIMTYPE | _d |
| | virtual sub-matrix (as represented by _index) dimensionality
|
|
std::unique_ptr< DIMTYPE[]> | _index |
| | maps virtual sub-matrix _d dimensions to original _n dimensions
|
|
std::unique_ptr< DATATYPE[]> | _tmp_rowscale |
| | reciprocals of the row maxima (implicit row scaling used for pivot choice); allocated on the first LUdecompose() call and kept
|
|
std::unique_ptr< DIMTYPE[]> | _tmp_whereis |
| | LU row permutation, logical row -> physical row in _data (the map that replaces physical row swapping); allocated only for an LUstorage matrix.
|
|
std::unique_ptr< Indexed_Vector< DATATYPE, DIMTYPE, SUBSET > > | _tmp_eq_coefs |
| | right-hand side handed to solve_equations() by invert() (allocated on first use)
|
|
std::unique_ptr< Indexed_Vector< DATATYPE, DIMTYPE, SUBSET > > | _tmp_eq_roots |
| | solution vector returned by solve_equations() to invert() (allocated on first use)
|
template<typename DATATYPE, typename DIMTYPE, class SUBSET>
class FST::Indexed_Matrix< DATATYPE, DIMTYPE, SUBSET >
Matrix representation and operations, allows operation in selected subspace.