ergo
|
Matrix class and heart of the matrix library. More...
#include <Matrix.h>
Public Types | |
typedef Telement | ElementType |
typedef Vector< Treal, typename ElementType::VectorType > | VectorType |
Public Member Functions | |
Matrix () | |
void | allocate () |
void | assignFromFull (std::vector< Treal > const &fullMat) |
void | fullMatrix (std::vector< Treal > &fullMat) const |
void | syFullMatrix (std::vector< Treal > &fullMat) const |
void | syUpTriFullMatrix (std::vector< Treal > &fullMat) const |
void | assignFromSparse (std::vector< int > const &rowind, std::vector< int > const &colind, std::vector< Treal > const &values) |
void | assignFromSparse (std::vector< int > const &rowind, std::vector< int > const &colind, std::vector< Treal > const &values, std::vector< int > const &indexes) |
void | addValues (std::vector< int > const &rowind, std::vector< int > const &colind, std::vector< Treal > const &values) |
void | addValues (std::vector< int > const &rowind, std::vector< int > const &colind, std::vector< Treal > const &values, std::vector< int > const &indexes) |
void | syAssignFromSparse (std::vector< int > const &rowind, std::vector< int > const &colind, std::vector< Treal > const &values) |
void | syAddValues (std::vector< int > const &rowind, std::vector< int > const &colind, std::vector< Treal > const &values) |
void | getValues (std::vector< int > const &rowind, std::vector< int > const &colind, std::vector< Treal > &values) const |
void | getValues (std::vector< int > const &rowind, std::vector< int > const &colind, std::vector< Treal > &, std::vector< int > const &indexes) const |
void | syGetValues (std::vector< int > const &rowind, std::vector< int > const &colind, std::vector< Treal > &values) const |
void | getAllValues (std::vector< int > &rowind, std::vector< int > &colind, std::vector< Treal > &) const |
void | syGetAllValues (std::vector< int > &rowind, std::vector< int > &colind, std::vector< Treal > &) const |
Matrix< Treal, Telement > & | operator= (const Matrix< Treal, Telement > &mat) |
void | clear () |
~Matrix () | |
void | writeToFile (std::ofstream &file) const |
void | readFromFile (std::ifstream &file) |
void | random () |
void | syRandom () |
void | randomZeroStructure (Treal probabilityBeingZero) |
Get a random zero structure with a specified probability that each submatrix is zero. | |
void | syRandomZeroStructure (Treal probabilityBeingZero) |
template<typename TRule> | |
void | setElementsByRule (TRule &rule) |
template<typename TRule> | |
void | sySetElementsByRule (TRule &rule) |
template<typename TRule> | |
void | trSetElementsByRule (TRule &rule) |
void | addIdentity (Treal alpha) |
void | symToNosym () |
void | nosymToSym () |
Matrix< Treal, Telement > & | operator= (int const k) |
Matrix< Treal, Telement > & | operator*= (const Treal alpha) |
Treal | frob () const |
Treal | frobSquared () const |
Treal | syFrob () const |
Treal | syFrobSquared () const |
Treal | trace () const |
void | assign (Treal const alpha, Matrix< Treal, Telement > const &A) |
void | getFrobSqLowestLevel (std::vector< Treal > &frobsq) const |
void | frobThreshLowestLevel (Treal const threshold, Matrix< Treal, Telement > *ErrorMatrix) |
void | getFrobSqElementLevel (std::vector< Treal > &frobsq) const |
void | frobThreshElementLevel (Treal const threshold, Matrix< Treal, Telement > *ErrorMatrix) |
void | assignFrobNormsLowestLevel (Matrix< Treal, Matrix< Treal, Telement > > const &A) |
Build a matrix with single matrix elements at the lowest level containing the Frobenius norms of the submatrices of A. | |
void | syAssignFrobNormsLowestLevel (Matrix< Treal, Matrix< Treal, Telement > > const &A) |
Version of assignFrobNormsLowestLevelToMatrix for symmetric matrices. | |
void | assignDiffFrobNormsLowestLevel (Matrix< Treal, Matrix< Treal, Telement > > const &A, Matrix< Treal, Matrix< Treal, Telement > > const &B) |
Same as assignFrobNormsLowestLevel except that the Frobenius norms of the differences between submatrices of A and B are assigned. | |
void | syAssignDiffFrobNormsLowestLevel (Matrix< Treal, Matrix< Treal, Telement > > const &A, Matrix< Treal, Matrix< Treal, Telement > > const &B) |
Same as syAssignFrobNormsLowestLevel except that the Frobenius norms of the differences between submatrices of A and B are assigned. | |
void | truncateAccordingToSparsityPattern (Matrix< Treal, Matrix< Treal, Telement > > &A) const |
Truncate matrix A according to the sparsity pattern of the this matrix (frobNormMat). | |
Treal | frob_thresh (Treal const threshold, Matrix< Treal, Telement > *ErrorMatrix=0) |
Removes small elements so that the introduced error is smaller than the threshold in the Frobenius norm Returns the Frobenius norm of the introduced error. | |
Treal | frob_squared_thresh (Treal const threshold, Matrix< Treal, Telement > *ErrorMatrix=0) |
Removes small elements so that the introduced error is smaller than threshold in the squared Frobenius norm, returns squared frobenius norm of the introduced error added to ErrorMatrix. | |
void | gershgorin (Treal &lmin, Treal &lmax) const |
void | sy_gershgorin (Treal &lmin, Treal &lmax) const |
void | add_abs_col_sums (Treal *abscolsums) const |
void | get_diagonal (Treal *diag) const |
size_t | memory_usage () const |
size_t | nnz () const |
Returns number of nonzeros in matrix. | |
size_t | sy_nnz () const |
Returns number of nonzeros in matrix including lower triangle elements. | |
size_t | nvalues () const |
Returns number of stored values in matrix. | |
size_t | sy_nvalues () const |
Returns number of stored values in matrix. | |
template<typename Top> | |
Treal | syAccumulateWith (Top &op) |
template<typename Top> | |
Treal | geAccumulateWith (Top &op) |
Accumulation algorithm for general matrices. | |
Treal | maxAbsValue () const |
![]() | |
bool | operator== (int k) const |
const int & | nScalarsRows () const |
const int & | nScalarsCols () const |
const int & | nrows () const |
const int & | ncols () const |
Treal & | operator ()(int row |
const Treal & | operator ()(int row |
assert (row >=0) | |
assert (col >=0) | |
assert (row< nrows()) | |
assert (col< ncols()) | |
assert (row >=0) | |
assert (col >=0) | |
assert (row< nrows()) | |
assert (col< ncols()) | |
Treal & | operator[] (int index) |
Treal const & | operator[] (int index) const |
bool | is_zero () const |
int | nElements () const |
void | resetRows (SizesAndBlocks const &newRows) |
void | resetCols (SizesAndBlocks const &newCols) |
void | getRows (SizesAndBlocks &rowsCopy) const |
void | getCols (SizesAndBlocks &colsCopy) const |
bool | highestLevel () const |
bool | is_empty () const |
Check if matrix is empty Empty is different from zero, a zero matrix contains information about blocksizes etc. | |
Static Public Member Functions | |
static void | transpose (Matrix< Treal, Telement > const &A, Matrix< Treal, Telement > &AT) |
static void | gemm (const bool tA, const bool tB, const Treal alpha, const Matrix< Treal, Telement > &A, const Matrix< Treal, Telement > &B, const Treal beta, Matrix< Treal, Telement > &C) |
static void | symm (const char side, const char uplo, const Treal alpha, const Matrix< Treal, Telement > &A, const Matrix< Treal, Telement > &B, const Treal beta, Matrix< Treal, Telement > &C) |
static void | syrk (const char uplo, const bool tA, const Treal alpha, const Matrix< Treal, Telement > &A, const Treal beta, Matrix< Treal, Telement > &C) |
static void | sysq (const char uplo, const Treal alpha, const Matrix< Treal, Telement > &A, const Treal beta, Matrix< Treal, Telement > &C) |
static void | ssmm (const Treal alpha, const Matrix< Treal, Telement > &A, const Matrix< Treal, Telement > &B, const Treal beta, Matrix< Treal, Telement > &C) |
static void | ssmm_upper_tr_only (const Treal alpha, const Matrix< Treal, Telement > &A, const Matrix< Treal, Telement > &B, const Treal beta, Matrix< Treal, Telement > &C) |
static void | trmm (const char side, const char uplo, const bool tA, const Treal alpha, const Matrix< Treal, Telement > &A, Matrix< Treal, Telement > &B) |
static Treal | frobDiff (const Matrix< Treal, Telement > &A, const Matrix< Treal, Telement > &B) |
static Treal | frobSquaredDiff (const Matrix< Treal, Telement > &A, const Matrix< Treal, Telement > &B) |
static Treal | syFrobDiff (const Matrix< Treal, Telement > &A, const Matrix< Treal, Telement > &B) |
static Treal | syFrobSquaredDiff (const Matrix< Treal, Telement > &A, const Matrix< Treal, Telement > &B) |
static Treal | trace_ab (const Matrix< Treal, Telement > &A, const Matrix< Treal, Telement > &B) |
static Treal | trace_aTb (const Matrix< Treal, Telement > &A, const Matrix< Treal, Telement > &B) |
static Treal | sy_trace_ab (const Matrix< Treal, Telement > &A, const Matrix< Treal, Telement > &B) |
static void | add (const Treal alpha, const Matrix< Treal, Telement > &A, Matrix< Treal, Telement > &B) |
static void | gemm_upper_tr_only (const bool tA, const bool tB, const Treal alpha, const Matrix< Treal, Telement > &A, const Matrix< Treal, Telement > &B, const Treal beta, Matrix< Treal, Telement > &C) |
static void | sytr_upper_tr_only (char const side, const Treal alpha, Matrix< Treal, Telement > &A, const Matrix< Treal, Telement > &Z) |
static void | trmm_upper_tr_only (const char side, const char uplo, const bool tA, const Treal alpha, const Matrix< Treal, Telement > &A, Matrix< Treal, Telement > &B) |
static void | trsytriplemm (char const side, const Matrix< Treal, Telement > &Z, Matrix< Treal, Telement > &A) |
static void | syInch (const Matrix< Treal, Telement > &A, Matrix< Treal, Telement > &Z, const Treal threshold=0, const side looking=left, const inchversion version=unstable) |
static unsigned int | level () |
Friends | |
class | Vector< Treal, Telement > |
Additional Inherited Members | |
![]() | |
Treal int | col |
return | elements [row+col *nrows()] |
const Treal int col | const |
![]() | |
MatrixHierarchicBase () | |
MatrixHierarchicBase (SizesAndBlocks const &rowsInp, SizesAndBlocks const &colsInp) | |
MatrixHierarchicBase (const MatrixHierarchicBase< Treal, Treal > &mat) | |
MatrixHierarchicBase< Treal, Treal > & | operator= (const MatrixHierarchicBase< Treal, Treal > &mat) |
virtual | ~MatrixHierarchicBase () |
![]() | |
static void | swap (MatrixHierarchicBase< Treal, Treal > &A, MatrixHierarchicBase< Treal, Treal > &B) |
![]() | |
Treal * | elements |
SizesAndBlocks | rows |
SizesAndBlocks | cols |
Matrix class and heart of the matrix library.
This class is used to obtain the hierarchic data structure.
typedef Telement mat::Matrix< Treal, Telement >::ElementType |
typedef Vector<Treal, typename ElementType::VectorType> mat::Matrix< Treal, Telement >::VectorType |
|
inline |
Referenced by add(), assign(), assignDiffFrobNormsLowestLevel(), assignFrobNormsLowestLevel(), frob_squared_thresh(), frobSquaredDiff(), frobThreshElementLevel(), frobThreshLowestLevel(), gemm(), gemm_upper_tr_only(), operator*=(), ssmm(), ssmm_upper_tr_only(), sy_trace_ab(), syAssignDiffFrobNormsLowestLevel(), syAssignFrobNormsLowestLevel(), syFrobSquaredDiff(), syInch(), symm(), syrk(), sysq(), sytr_upper_tr_only(), trace_ab(), trace_aTb(), transpose(), trmm(), trmm_upper_tr_only(), trsytriplemm(), and truncateAccordingToSparsityPattern().
|
inline |
|
static |
void mat::Matrix< Treal, Telement >::add_abs_col_sums | ( | Treal * | abscolsums | ) | const |
References add_abs_col_sums(), mat::MatrixHierarchicBase< Treal, Treal >::assert(), mat::MatrixHierarchicBase< Treal, Treal >::col, mat::MatrixHierarchicBase< Treal, Treal >::is_zero(), mat::MatrixHierarchicBase< Treal, Treal >::ncols(), mat::MatrixHierarchicBase< Treal, Treal >::nrows(), and mat::MatrixHierarchicBase< Treal, Treal >::nScalarsCols().
Referenced by add_abs_col_sums(), and gershgorin().
void mat::Matrix< Treal, Telement >::addIdentity | ( | Treal | alpha | ) |
void mat::Matrix< Treal, Telement >::addValues | ( | std::vector< int > const & | rowind, |
std::vector< int > const & | colind, | ||
std::vector< Treal > const & | values ) |
References addValues(), and mat::MatrixHierarchicBase< Treal, Treal >::assert().
Referenced by addValues(), addValues(), and syAddValues().
void mat::Matrix< Treal, Telement >::addValues | ( | std::vector< int > const & | rowind, |
std::vector< int > const & | colind, | ||
std::vector< Treal > const & | values, | ||
std::vector< int > const & | indexes ) |
References addValues(), allocate(), mat::MatrixHierarchicBase< Treal, Treal >::col, mat::MatrixHierarchicBase< Treal, Treal >::cols, mat::MatrixHierarchicBase< Treal, Treal >::is_zero(), mat::MatrixHierarchicBase< Treal, Treal >::ncols(), mat::MatrixHierarchicBase< Treal, Treal >::nrows(), and mat::MatrixHierarchicBase< Treal, Treal >::rows.
|
inline |
Referenced by addIdentity(), addValues(), assignDiffFrobNormsLowestLevel(), mat::Matrix< Treal >::assignDiffFrobNormsLowestLevel(), assignFrobNormsLowestLevel(), mat::Matrix< Treal >::assignFrobNormsLowestLevel(), assignFromFull(), assignFromSparse(), frobThreshElementLevel(), mat::Matrix< Treal >::frobThreshElementLevel(), frobThreshLowestLevel(), gemm(), mat::Matrix< Treal >::gemm(), gemm_upper_tr_only(), operator=(), random(), randomZeroStructure(), readFromFile(), setElementsByRule(), ssmm(), ssmm_upper_tr_only(), syAssignDiffFrobNormsLowestLevel(), mat::Matrix< Treal >::syAssignDiffFrobNormsLowestLevel(), syAssignFrobNormsLowestLevel(), mat::Matrix< Treal >::syAssignFrobNormsLowestLevel(), syInch(), symm(), mat::Matrix< Treal >::symm(), syRandom(), syRandomZeroStructure(), syrk(), mat::Matrix< Treal >::syrk(), sySetElementsByRule(), and sysq().
void mat::Matrix< Treal, Telement >::assign | ( | Treal const | alpha, |
Matrix< Treal, Telement > const & | A ) |
void mat::Matrix< Treal, Telement >::assignDiffFrobNormsLowestLevel | ( | Matrix< Treal, Matrix< Treal, Telement > > const & | A, |
Matrix< Treal, Matrix< Treal, Telement > > const & | B ) |
Same as assignFrobNormsLowestLevel except that the Frobenius norms of the differences between submatrices of A and B are assigned.
References A, allocate(), mat::MatrixHierarchicBase< Treal, Treal >::assert(), assignDiffFrobNormsLowestLevel(), assignFrobNormsLowestLevel(), B, clear(), mat::MatrixHierarchicBase< Treal, Treal >::elements, mat::MatrixHierarchicBase< Treal, Treal >::is_zero(), Matrix(), and mat::MatrixHierarchicBase< Treal, Treal >::nElements().
Referenced by assignDiffFrobNormsLowestLevel(), and syAssignDiffFrobNormsLowestLevel().
void mat::Matrix< Treal, Telement >::assignFrobNormsLowestLevel | ( | Matrix< Treal, Matrix< Treal, Telement > > const & | A | ) |
Build a matrix with single matrix elements at the lowest level containing the Frobenius norms of the submatrices of A.
References A, allocate(), mat::MatrixHierarchicBase< Treal, Treal >::assert(), assignFrobNormsLowestLevel(), clear(), mat::MatrixHierarchicBase< Treal, Treal >::elements, mat::MatrixHierarchicBase< Treal, Treal >::is_zero(), Matrix(), and mat::MatrixHierarchicBase< Treal, Treal >::nElements().
Referenced by assignDiffFrobNormsLowestLevel(), mat::Matrix< Treal >::assignDiffFrobNormsLowestLevel(), assignFrobNormsLowestLevel(), and syAssignFrobNormsLowestLevel().
void mat::Matrix< Treal, Telement >::assignFromFull | ( | std::vector< Treal > const & | fullMat | ) |
References allocate(), mat::MatrixHierarchicBase< Treal, Treal >::assert(), assignFromFull(), mat::MatrixHierarchicBase< Treal, Treal >::col, mat::MatrixHierarchicBase< Treal, Treal >::cols, mat::MatrixHierarchicBase< Treal, Treal >::is_zero(), mat::MatrixHierarchicBase< Treal, Treal >::ncols(), mat::MatrixHierarchicBase< Treal, Treal >::nrows(), and mat::MatrixHierarchicBase< Treal, Treal >::rows.
Referenced by assignFromFull().
void mat::Matrix< Treal, Telement >::assignFromSparse | ( | std::vector< int > const & | rowind, |
std::vector< int > const & | colind, | ||
std::vector< Treal > const & | values ) |
References mat::MatrixHierarchicBase< Treal, Treal >::assert(), and assignFromSparse().
Referenced by assignFromSparse(), assignFromSparse(), and syAssignFromSparse().
void mat::Matrix< Treal, Telement >::assignFromSparse | ( | std::vector< int > const & | rowind, |
std::vector< int > const & | colind, | ||
std::vector< Treal > const & | values, | ||
std::vector< int > const & | indexes ) |
References allocate(), assignFromSparse(), clear(), mat::MatrixHierarchicBase< Treal, Treal >::col, mat::MatrixHierarchicBase< Treal, Treal >::cols, mat::MatrixHierarchicBase< Treal, Treal >::is_zero(), mat::MatrixHierarchicBase< Treal, Treal >::ncols(), mat::MatrixHierarchicBase< Treal, Treal >::nrows(), and mat::MatrixHierarchicBase< Treal, Treal >::rows.
void mat::Matrix< Treal, Telement >::clear | ( | ) |
References clear(), mat::MatrixHierarchicBase< Treal, Treal >::elements, mat::freeElements(), mat::MatrixHierarchicBase< Treal, Treal >::is_zero(), and mat::MatrixHierarchicBase< Treal, Treal >::nElements().
Referenced by assignDiffFrobNormsLowestLevel(), mat::Matrix< Treal >::assignDiffFrobNormsLowestLevel(), assignFrobNormsLowestLevel(), mat::Matrix< Treal >::assignFrobNormsLowestLevel(), assignFromSparse(), clear(), frobThreshElementLevel(), mat::Matrix< Treal >::frobThreshElementLevel(), frobThreshLowestLevel(), nosymToSym(), operator=(), randomZeroStructure(), readFromFile(), syAssignDiffFrobNormsLowestLevel(), mat::Matrix< Treal >::syAssignDiffFrobNormsLowestLevel(), syAssignFrobNormsLowestLevel(), mat::Matrix< Treal >::syAssignFrobNormsLowestLevel(), syRandomZeroStructure(), mat::Matrix< real, real >::~Matrix(), and mat::Matrix< Treal >::~Matrix().
|
inline |
Treal mat::Matrix< Treal, Telement >::frob_squared_thresh | ( | Treal const | threshold, |
Matrix< Treal, Telement > * | ErrorMatrix = 0 ) |
Removes small elements so that the introduced error is smaller than threshold in the squared Frobenius norm, returns squared frobenius norm of the introduced error added to ErrorMatrix.
References mat::MatrixHierarchicBase< Treal, Treal >::assert(), mat::MatrixHierarchicBase< Treal, Treal >::cols, frobThreshLowestLevel(), getFrobSqLowestLevel(), mat::MatrixHierarchicBase< Treal, Telement >::is_empty(), mat::MatrixHierarchicBase< Treal, Treal >::is_empty(), Matrix(), mat::MatrixHierarchicBase< Treal, Telement >::resetCols(), mat::MatrixHierarchicBase< Treal, Telement >::resetRows(), mat::MatrixHierarchicBase< Treal, Treal >::rows, and mat::MatrixHierarchicBase< Treal, Treal >::swap().
Referenced by mat::Matrix< real, real >::frob_thresh(), and mat::Matrix< Treal >::frob_thresh().
|
inline |
Removes small elements so that the introduced error is smaller than the threshold in the Frobenius norm Returns the Frobenius norm of the introduced error.
Referenced by syInch().
|
inlinestatic |
Treal mat::Matrix< Treal, Telement >::frobSquared | ( | ) | const |
References mat::MatrixHierarchicBase< Treal, Treal >::assert(), mat::MatrixHierarchicBase< Treal, Treal >::elements, frobSquared(), mat::MatrixHierarchicBase< Treal, Treal >::is_empty(), mat::MatrixHierarchicBase< Treal, Treal >::is_zero(), and mat::MatrixHierarchicBase< Treal, Treal >::nElements().
Referenced by mat::Matrix< real, real >::frob(), mat::Matrix< Treal >::frob(), frobSquared(), mat::Matrix< Treal >::frobThreshLowestLevel(), and syFrobSquared().
|
static |
References A, mat::MatrixHierarchicBase< Treal, Treal >::assert(), B, and Matrix().
Referenced by mat::Matrix< real, real >::frobDiff(), and mat::Matrix< Treal >::frobDiff().
void mat::Matrix< Treal, Telement >::frobThreshElementLevel | ( | Treal const | threshold, |
Matrix< Treal, Telement > * | ErrorMatrix ) |
References allocate(), mat::MatrixHierarchicBase< Treal, Treal >::assert(), clear(), mat::MatrixHierarchicBase< Treal, Telement >::elements, mat::MatrixHierarchicBase< Treal, Treal >::elements, frobThreshElementLevel(), mat::MatrixHierarchicBase< Treal, Telement >::is_empty(), mat::MatrixHierarchicBase< Treal, Treal >::is_empty(), mat::MatrixHierarchicBase< Treal, Telement >::is_zero(), mat::MatrixHierarchicBase< Treal, Treal >::is_zero(), Matrix(), and mat::MatrixHierarchicBase< Treal, Treal >::nElements().
Referenced by frobThreshElementLevel().
void mat::Matrix< Treal, Telement >::frobThreshLowestLevel | ( | Treal const | threshold, |
Matrix< Treal, Telement > * | ErrorMatrix ) |
References allocate(), mat::MatrixHierarchicBase< Treal, Treal >::assert(), clear(), mat::MatrixHierarchicBase< Treal, Telement >::elements, mat::MatrixHierarchicBase< Treal, Treal >::elements, frobThreshLowestLevel(), mat::MatrixHierarchicBase< Treal, Telement >::is_empty(), mat::MatrixHierarchicBase< Treal, Treal >::is_empty(), mat::MatrixHierarchicBase< Treal, Telement >::is_zero(), mat::MatrixHierarchicBase< Treal, Treal >::is_zero(), Matrix(), and mat::MatrixHierarchicBase< Treal, Treal >::nElements().
Referenced by frob_squared_thresh(), and frobThreshLowestLevel().
void mat::Matrix< Treal, Telement >::fullMatrix | ( | std::vector< Treal > & | fullMat | ) | const |
References mat::MatrixHierarchicBase< Treal, Treal >::col, mat::MatrixHierarchicBase< Treal, Treal >::cols, fullMatrix(), mat::MatrixHierarchicBase< Treal, Treal >::is_zero(), mat::MatrixHierarchicBase< Treal, Treal >::ncols(), mat::MatrixHierarchicBase< Treal, Treal >::nrows(), mat::MatrixHierarchicBase< Treal, Treal >::nScalarsCols(), mat::MatrixHierarchicBase< Treal, Treal >::nScalarsRows(), and mat::MatrixHierarchicBase< Treal, Treal >::rows.
Referenced by fullMatrix().
|
inline |
Accumulation algorithm for general matrices.
Referenced by mat::Matrix< real, real >::geAccumulateWith(), and mat::Matrix< real, real >::syAccumulateWith().
|
static |
References A, allocate(), mat::MatrixHierarchicBase< Treal, Treal >::assert(), B, mat::MatrixHierarchicBase< Treal, Treal >::col, mat::MatrixHierarchicBase< Treal, Telement >::is_empty(), mat::MatrixHierarchicBase< Treal, Telement >::is_zero(), MAT_OMP_END, MAT_OMP_FINALIZE, MAT_OMP_INIT, MAT_OMP_START, Matrix(), mat::MatrixHierarchicBase< Treal, Telement >::ncols(), mat::MatrixHierarchicBase< Treal, Telement >::nrows(), mat::MatrixHierarchicBase< Treal, Telement >::resetCols(), and mat::MatrixHierarchicBase< Treal, Telement >::resetRows().
Referenced by mat::Matrix< Treal >::gemm_upper_tr_only().
|
static |
References A, allocate(), mat::MatrixHierarchicBase< Treal, Treal >::assert(), B, mat::MatrixHierarchicBase< Treal, Treal >::col, mat::MatrixHierarchicBase< Treal, Telement >::is_empty(), mat::MatrixHierarchicBase< Treal, Telement >::is_zero(), Matrix(), mat::MatrixHierarchicBase< Treal, Telement >::ncols(), mat::MatrixHierarchicBase< Treal, Telement >::nrows(), mat::MatrixHierarchicBase< Treal, Telement >::resetCols(), and mat::MatrixHierarchicBase< Treal, Telement >::resetRows().
void mat::Matrix< Treal, Telement >::gershgorin | ( | Treal & | lmin, |
Treal & | lmax ) const |
References add_abs_col_sums(), mat::MatrixHierarchicBase< Treal, Treal >::assert(), mat::MatrixHierarchicBase< Treal, Treal >::col, get_diagonal(), mat::MatrixHierarchicBase< Treal, Treal >::is_empty(), mat::MatrixHierarchicBase< Treal, Treal >::nScalarsCols(), mat::MatrixHierarchicBase< Treal, Treal >::nScalarsRows(), and template_blas_fabs().
Referenced by mat::Matrix< real, real >::sy_gershgorin(), and mat::Matrix< Treal >::sy_gershgorin().
void mat::Matrix< Treal, Telement >::get_diagonal | ( | Treal * | diag | ) | const |
References mat::MatrixHierarchicBase< Treal, Treal >::assert(), get_diagonal(), mat::MatrixHierarchicBase< Treal, Treal >::is_zero(), mat::MatrixHierarchicBase< Treal, Treal >::ncols(), mat::MatrixHierarchicBase< Treal, Treal >::nrows(), and mat::MatrixHierarchicBase< Treal, Treal >::nScalarsCols().
Referenced by gershgorin(), and get_diagonal().
void mat::Matrix< Treal, Telement >::getAllValues | ( | std::vector< int > & | rowind, |
std::vector< int > & | colind, | ||
std::vector< Treal > & | values ) const |
void mat::Matrix< Treal, Telement >::getFrobSqElementLevel | ( | std::vector< Treal > & | frobsq | ) | const |
void mat::Matrix< Treal, Telement >::getFrobSqLowestLevel | ( | std::vector< Treal > & | frobsq | ) | const |
void mat::Matrix< Treal, Telement >::getValues | ( | std::vector< int > const & | rowind, |
std::vector< int > const & | colind, | ||
std::vector< Treal > & | values, | ||
std::vector< int > const & | indexes ) const |
References mat::MatrixHierarchicBase< Treal, Treal >::assert(), mat::MatrixHierarchicBase< Treal, Treal >::col, mat::MatrixHierarchicBase< Treal, Treal >::cols, getValues(), mat::MatrixHierarchicBase< Treal, Treal >::is_empty(), mat::MatrixHierarchicBase< Treal, Treal >::is_zero(), mat::MatrixHierarchicBase< Treal, Treal >::ncols(), mat::MatrixHierarchicBase< Treal, Treal >::nrows(), and mat::MatrixHierarchicBase< Treal, Treal >::rows.
void mat::Matrix< Treal, Telement >::getValues | ( | std::vector< int > const & | rowind, |
std::vector< int > const & | colind, | ||
std::vector< Treal > & | values ) const |
References mat::MatrixHierarchicBase< Treal, Treal >::assert(), and getValues().
Referenced by getValues(), getValues(), and syGetValues().
|
inlinestatic |
|
inline |
size_t mat::Matrix< Treal, Telement >::memory_usage | ( | ) | const |
References mat::MatrixHierarchicBase< Treal, Treal >::assert(), mat::MatrixHierarchicBase< Treal, Treal >::elements, mat::MatrixHierarchicBase< Treal, Treal >::is_empty(), mat::MatrixHierarchicBase< Treal, Treal >::is_zero(), memory_usage(), and mat::MatrixHierarchicBase< Treal, Treal >::nElements().
Referenced by memory_usage().
size_t mat::Matrix< Treal, Telement >::nnz | ( | ) | const |
Returns number of nonzeros in matrix.
References mat::MatrixHierarchicBase< Treal, Treal >::elements, mat::MatrixHierarchicBase< Treal, Treal >::is_zero(), mat::MatrixHierarchicBase< Treal, Treal >::nElements(), and nnz().
Referenced by nnz(), mat::Matrix< real, real >::nvalues(), mat::Matrix< Treal >::nvalues(), and sy_nnz().
void mat::Matrix< Treal, Telement >::nosymToSym | ( | ) |
References clear(), mat::MatrixHierarchicBase< Treal, Treal >::col, mat::MatrixHierarchicBase< Treal, Treal >::is_zero(), mat::MatrixHierarchicBase< Treal, Treal >::ncols(), nosymToSym(), and mat::MatrixHierarchicBase< Treal, Treal >::nrows().
Referenced by mat::Matrix< Treal >::gemm_upper_tr_only(), nosymToSym(), and mat::Matrix< Treal >::ssmm_upper_tr_only().
|
inline |
Matrix< Treal, Telement > & mat::Matrix< Treal, Telement >::operator*= | ( | const Treal | alpha | ) |
|
inline |
Matrix< Treal, Telement > & mat::Matrix< Treal, Telement >::operator= | ( | int const | k | ) |
void mat::Matrix< Treal, Telement >::random | ( | ) |
void mat::Matrix< Treal, Telement >::randomZeroStructure | ( | Treal | probabilityBeingZero | ) |
Get a random zero structure with a specified probability that each submatrix is zero.
References allocate(), clear(), mat::MatrixHierarchicBase< Treal, Treal >::elements, mat::MatrixHierarchicBase< Treal, Treal >::highestLevel(), mat::MatrixHierarchicBase< Treal, Treal >::is_zero(), mat::MatrixHierarchicBase< Treal, Treal >::nElements(), and randomZeroStructure().
Referenced by randomZeroStructure(), and syRandomZeroStructure().
void mat::Matrix< Treal, Telement >::readFromFile | ( | std::ifstream & | file | ) |
void mat::Matrix< Treal, Telement >::setElementsByRule | ( | TRule & | rule | ) |
|
static |
References A, allocate(), mat::MatrixHierarchicBase< Treal, Treal >::assert(), B, mat::MatrixHierarchicBase< Treal, Treal >::col, mat::MatrixHierarchicBase< Treal, Telement >::is_empty(), mat::MatrixHierarchicBase< Treal, Telement >::is_zero(), MAT_OMP_END, MAT_OMP_FINALIZE, MAT_OMP_INIT, MAT_OMP_START, Matrix(), mat::MatrixHierarchicBase< Treal, Telement >::ncols(), mat::MatrixHierarchicBase< Treal, Telement >::nrows(), mat::MatrixHierarchicBase< Treal, Telement >::resetCols(), and mat::MatrixHierarchicBase< Treal, Telement >::resetRows().
|
static |
References A, allocate(), mat::MatrixHierarchicBase< Treal, Treal >::assert(), B, mat::MatrixHierarchicBase< Treal, Treal >::col, mat::MatrixHierarchicBase< Treal, Telement >::is_empty(), mat::MatrixHierarchicBase< Treal, Telement >::is_zero(), MAT_OMP_END, MAT_OMP_FINALIZE, MAT_OMP_INIT, MAT_OMP_START, Matrix(), mat::MatrixHierarchicBase< Treal, Telement >::ncols(), mat::MatrixHierarchicBase< Treal, Telement >::nrows(), mat::MatrixHierarchicBase< Treal, Telement >::resetCols(), and mat::MatrixHierarchicBase< Treal, Telement >::resetRows().
|
inline |
size_t mat::Matrix< Treal, Telement >::sy_nnz | ( | ) | const |
Returns number of nonzeros in matrix including lower triangle elements.
References mat::MatrixHierarchicBase< Treal, Treal >::col, mat::MatrixHierarchicBase< Treal, Treal >::is_zero(), mat::MatrixHierarchicBase< Treal, Treal >::ncols(), nnz(), mat::MatrixHierarchicBase< Treal, Treal >::nrows(), and sy_nnz().
Referenced by sy_nnz().
size_t mat::Matrix< Treal, Telement >::sy_nvalues | ( | ) | const |
Returns number of stored values in matrix.
Lower triangle is not included. Lower triangle in diagonal submatrices is not included as well. Different from sy_nnz().
References mat::MatrixHierarchicBase< Treal, Treal >::col, mat::MatrixHierarchicBase< Treal, Treal >::is_zero(), mat::MatrixHierarchicBase< Treal, Treal >::ncols(), mat::MatrixHierarchicBase< Treal, Treal >::nrows(), nvalues(), and sy_nvalues().
Referenced by sy_nvalues().
|
static |
References A, mat::MatrixHierarchicBase< Treal, Treal >::assert(), B, and Matrix().
|
inline |
Referenced by mat::Matrix< real, real >::syAccumulateWith().
void mat::Matrix< Treal, Telement >::syAddValues | ( | std::vector< int > const & | rowind, |
std::vector< int > const & | colind, | ||
std::vector< Treal > const & | values ) |
References addValues(), and mat::MatrixHierarchicBase< Treal, Treal >::assert().
void mat::Matrix< Treal, Telement >::syAssignDiffFrobNormsLowestLevel | ( | Matrix< Treal, Matrix< Treal, Telement > > const & | A, |
Matrix< Treal, Matrix< Treal, Telement > > const & | B ) |
Same as syAssignFrobNormsLowestLevel except that the Frobenius norms of the differences between submatrices of A and B are assigned.
References A, allocate(), mat::MatrixHierarchicBase< Treal, Treal >::assert(), assignDiffFrobNormsLowestLevel(), B, clear(), mat::MatrixHierarchicBase< Treal, Treal >::col, mat::MatrixHierarchicBase< Treal, Treal >::is_zero(), Matrix(), mat::MatrixHierarchicBase< Treal, Treal >::ncols(), mat::MatrixHierarchicBase< Treal, Treal >::nElements(), syAssignDiffFrobNormsLowestLevel(), and syAssignFrobNormsLowestLevel().
Referenced by syAssignDiffFrobNormsLowestLevel().
void mat::Matrix< Treal, Telement >::syAssignFrobNormsLowestLevel | ( | Matrix< Treal, Matrix< Treal, Telement > > const & | A | ) |
Version of assignFrobNormsLowestLevelToMatrix for symmetric matrices.
References A, allocate(), mat::MatrixHierarchicBase< Treal, Treal >::assert(), assignFrobNormsLowestLevel(), clear(), mat::MatrixHierarchicBase< Treal, Treal >::col, mat::MatrixHierarchicBase< Treal, Treal >::is_zero(), Matrix(), mat::MatrixHierarchicBase< Treal, Treal >::ncols(), mat::MatrixHierarchicBase< Treal, Treal >::nElements(), and syAssignFrobNormsLowestLevel().
Referenced by syAssignDiffFrobNormsLowestLevel(), mat::Matrix< Treal >::syAssignDiffFrobNormsLowestLevel(), and syAssignFrobNormsLowestLevel().
void mat::Matrix< Treal, Telement >::syAssignFromSparse | ( | std::vector< int > const & | rowind, |
std::vector< int > const & | colind, | ||
std::vector< Treal > const & | values ) |
References mat::MatrixHierarchicBase< Treal, Treal >::assert(), and assignFromSparse().
|
inline |
Referenced by mat::Matrix< Treal >::syAssignDiffFrobNormsLowestLevel().
|
inlinestatic |
Treal mat::Matrix< Treal, Telement >::syFrobSquared | ( | ) | const |
References mat::MatrixHierarchicBase< Treal, Treal >::assert(), mat::MatrixHierarchicBase< Treal, Treal >::col, frobSquared(), mat::MatrixHierarchicBase< Treal, Treal >::is_empty(), mat::MatrixHierarchicBase< Treal, Treal >::is_zero(), mat::MatrixHierarchicBase< Treal, Treal >::ncols(), mat::MatrixHierarchicBase< Treal, Treal >::nrows(), and syFrobSquared().
Referenced by mat::Matrix< real, real >::syFrob(), mat::Matrix< Treal >::syFrob(), and syFrobSquared().
|
static |
References A, mat::MatrixHierarchicBase< Treal, Treal >::assert(), B, mat::MatrixHierarchicBase< Treal, Treal >::col, and Matrix().
Referenced by mat::Matrix< real, real >::syFrobDiff(), and mat::Matrix< Treal >::syFrobDiff().
void mat::Matrix< Treal, Telement >::syFullMatrix | ( | std::vector< Treal > & | fullMat | ) | const |
References mat::MatrixHierarchicBase< Treal, Treal >::col, mat::MatrixHierarchicBase< Treal, Treal >::cols, mat::MatrixHierarchicBase< Treal, Treal >::is_zero(), mat::MatrixHierarchicBase< Treal, Treal >::ncols(), mat::MatrixHierarchicBase< Treal, Treal >::nScalarsCols(), mat::MatrixHierarchicBase< Treal, Treal >::rows, syFullMatrix(), and syUpTriFullMatrix().
Referenced by syFullMatrix().
void mat::Matrix< Treal, Telement >::syGetAllValues | ( | std::vector< int > & | rowind, |
std::vector< int > & | colind, | ||
std::vector< Treal > & | values ) const |
void mat::Matrix< Treal, Telement >::syGetValues | ( | std::vector< int > const & | rowind, |
std::vector< int > const & | colind, | ||
std::vector< Treal > & | values ) const |
References mat::MatrixHierarchicBase< Treal, Treal >::assert(), and getValues().
|
static |
References A, allocate(), mat::MatrixHierarchicBase< Treal, Treal >::assert(), frob_thresh(), mat::left, Matrix(), mat::MatrixHierarchicBase< Treal, Telement >::ncols(), mat::MatrixHierarchicBase< Treal, Telement >::nrows(), mat::MatrixHierarchicBase< Treal, Telement >::resetCols(), mat::MatrixHierarchicBase< Treal, Telement >::resetRows(), mat::right, and mat::stable.
|
static |
References A, allocate(), mat::MatrixHierarchicBase< Treal, Treal >::assert(), B, mat::MatrixHierarchicBase< Treal, Treal >::col, mat::MatrixHierarchicBase< Treal, Telement >::is_empty(), mat::MatrixHierarchicBase< Treal, Telement >::is_zero(), MAT_OMP_END, MAT_OMP_FINALIZE, MAT_OMP_INIT, MAT_OMP_START, Matrix(), mat::MatrixHierarchicBase< Treal, Telement >::ncols(), mat::MatrixHierarchicBase< Treal, Telement >::nrows(), mat::MatrixHierarchicBase< Treal, Telement >::resetCols(), and mat::MatrixHierarchicBase< Treal, Telement >::resetRows().
Referenced by mat::Matrix< Treal >::ssmm().
void mat::Matrix< Treal, Telement >::symToNosym | ( | ) |
References mat::MatrixHierarchicBase< Treal, Treal >::col, mat::MatrixHierarchicBase< Treal, Treal >::is_zero(), mat::MatrixHierarchicBase< Treal, Treal >::ncols(), mat::MatrixHierarchicBase< Treal, Treal >::nrows(), and symToNosym().
Referenced by mat::Matrix< Treal >::ssmm(), mat::Matrix< real, real >::sy_gershgorin(), mat::Matrix< Treal >::sy_gershgorin(), symToNosym(), and mat::Matrix< Treal >::sysq().
void mat::Matrix< Treal, Telement >::syRandom | ( | ) |
void mat::Matrix< Treal, Telement >::syRandomZeroStructure | ( | Treal | probabilityBeingZero | ) |
References allocate(), clear(), mat::MatrixHierarchicBase< Treal, Treal >::col, mat::MatrixHierarchicBase< Treal, Treal >::highestLevel(), mat::MatrixHierarchicBase< Treal, Treal >::is_zero(), mat::MatrixHierarchicBase< Treal, Treal >::ncols(), mat::MatrixHierarchicBase< Treal, Treal >::nrows(), randomZeroStructure(), and syRandomZeroStructure().
Referenced by syRandomZeroStructure().
|
static |
References A, allocate(), mat::MatrixHierarchicBase< Treal, Treal >::assert(), mat::MatrixHierarchicBase< Treal, Treal >::col, mat::MatrixHierarchicBase< Treal, Telement >::is_empty(), mat::MatrixHierarchicBase< Treal, Telement >::is_zero(), MAT_OMP_END, MAT_OMP_FINALIZE, MAT_OMP_INIT, MAT_OMP_START, Matrix(), mat::MatrixHierarchicBase< Treal, Telement >::ncols(), mat::MatrixHierarchicBase< Treal, Telement >::nrows(), mat::MatrixHierarchicBase< Treal, Telement >::resetCols(), and mat::MatrixHierarchicBase< Treal, Telement >::resetRows().
Referenced by mat::Matrix< Treal >::sysq().
void mat::Matrix< Treal, Telement >::sySetElementsByRule | ( | TRule & | rule | ) |
References allocate(), mat::MatrixHierarchicBase< Treal, Treal >::col, mat::MatrixHierarchicBase< Treal, Treal >::is_zero(), mat::MatrixHierarchicBase< Treal, Treal >::ncols(), mat::MatrixHierarchicBase< Treal, Treal >::nrows(), setElementsByRule(), and sySetElementsByRule().
Referenced by sySetElementsByRule(), and mat::Matrix< real, real >::trSetElementsByRule().
|
static |
References A, allocate(), mat::MatrixHierarchicBase< Treal, Treal >::assert(), mat::MatrixHierarchicBase< Treal, Treal >::col, mat::MatrixHierarchicBase< Treal, Telement >::is_empty(), mat::MatrixHierarchicBase< Treal, Telement >::is_zero(), MAT_OMP_END, MAT_OMP_FINALIZE, MAT_OMP_INIT, MAT_OMP_START, Matrix(), mat::MatrixHierarchicBase< Treal, Telement >::ncols(), mat::MatrixHierarchicBase< Treal, Telement >::nrows(), mat::MatrixHierarchicBase< Treal, Telement >::resetCols(), and mat::MatrixHierarchicBase< Treal, Telement >::resetRows().
|
static |
References A, mat::MatrixHierarchicBase< Treal, Treal >::assert(), mat::MatrixHierarchicBase< Treal, Treal >::col, mat::MatrixHierarchicBase< Treal, Telement >::is_empty(), mat::MatrixHierarchicBase< Treal, Telement >::is_zero(), Matrix(), mat::MatrixHierarchicBase< Treal, Telement >::ncols(), and mat::MatrixHierarchicBase< Treal, Telement >::nrows().
Referenced by trsytriplemm(), and mat::Matrix< Treal >::trsytriplemm().
void mat::Matrix< Treal, Telement >::syUpTriFullMatrix | ( | std::vector< Treal > & | fullMat | ) | const |
References mat::MatrixHierarchicBase< Treal, Treal >::col, mat::MatrixHierarchicBase< Treal, Treal >::cols, mat::MatrixHierarchicBase< Treal, Treal >::is_zero(), mat::MatrixHierarchicBase< Treal, Treal >::ncols(), mat::MatrixHierarchicBase< Treal, Treal >::nrows(), mat::MatrixHierarchicBase< Treal, Treal >::nScalarsCols(), mat::MatrixHierarchicBase< Treal, Treal >::nScalarsRows(), mat::MatrixHierarchicBase< Treal, Treal >::rows, and syUpTriFullMatrix().
Referenced by syFullMatrix(), and syUpTriFullMatrix().
Treal mat::Matrix< Treal, Telement >::trace | ( | ) | const |
|
static |
References A, mat::MatrixHierarchicBase< Treal, Treal >::assert(), B, and Matrix().
|
static |
References A, mat::MatrixHierarchicBase< Treal, Treal >::assert(), B, and Matrix().
|
static |
References A, mat::allocateElements(), mat::MatrixHierarchicBase< Treal, Treal >::col, mat::MatrixHierarchicBase< Treal, Telement >::cols, mat::MatrixHierarchicBase< Treal, Telement >::elements, mat::freeElements(), mat::MatrixHierarchicBase< Treal, Telement >::is_zero(), Matrix(), mat::MatrixHierarchicBase< Treal, Telement >::ncols(), mat::MatrixHierarchicBase< Treal, Telement >::nElements(), mat::MatrixHierarchicBase< Treal, Telement >::nrows(), and mat::MatrixHierarchicBase< Treal, Telement >::rows.
|
static |
References A, mat::MatrixHierarchicBase< Treal, Treal >::assert(), B, mat::MatrixHierarchicBase< Treal, Treal >::col, and Matrix().
Referenced by trsytriplemm(), and mat::Matrix< Treal >::trsytriplemm().
|
inline |
|
static |
void mat::Matrix< Treal, Telement >::truncateAccordingToSparsityPattern | ( | Matrix< Treal, Matrix< Treal, Telement > > & | A | ) | const |
Truncate matrix A according to the sparsity pattern of the this matrix (frobNormMat).
References A, mat::MatrixHierarchicBase< Treal, Treal >::assert(), mat::MatrixHierarchicBase< Treal, Treal >::elements, mat::MatrixHierarchicBase< Treal, Treal >::is_zero(), Matrix(), mat::MatrixHierarchicBase< Treal, Treal >::nElements(), and truncateAccordingToSparsityPattern().
Referenced by truncateAccordingToSparsityPattern().
void mat::Matrix< Treal, Telement >::writeToFile | ( | std::ofstream & | file | ) | const |
|
friend |