ergo
mat::MatrixSymmetric< Treal, Tmatrix > Class Template Reference

Symmetric matrix. More...

#include <MatrixBase.h>

Public Types

typedef VectorGeneral< Treal, typename Tmatrix::VectorType > VectorType
 
typedef Treal real
 

Public Member Functions

 MatrixSymmetric ()
 Default constructor
More...
 
 MatrixSymmetric (const MatrixSymmetric< Treal, Tmatrix > &symm)
 Copy constructor
More...
 
 MatrixSymmetric (const XY< Treal, MatrixSymmetric< Treal, Tmatrix > > &sm)
 
 MatrixSymmetric (const MatrixGeneral< Treal, Tmatrix > &matr)
 'Copy from normal matrix' - constructor
More...
 
void assignFromFull (std::vector< Treal > const &fullMat)
 
void assignFromFull (std::vector< Treal > const &fullMat, std::vector< int > const &rowPermutation, std::vector< int > const &colPermutation)
 
void fullMatrix (std::vector< Treal > &fullMat) const
 Save matrix as full matrix. More...
 
void fullMatrix (std::vector< Treal > &fullMat, std::vector< int > const &rowInversePermutation, std::vector< int > const &colInversePermutation) const
 Save matrix as full matrix. More...
 
void assign_from_sparse (std::vector< int > const &rowind, std::vector< int > const &colind, std::vector< Treal > const &values)
 Assign from sparse matrix given by three vectors. More...
 
void assign_from_sparse (std::vector< int > const &rowind, std::vector< int > const &colind, std::vector< Treal > const &values, SizesAndBlocks const &newRows, SizesAndBlocks const &newCols)
 Assign from sparse matrix given by three vectors. More...
 
void assign_from_sparse (std::vector< int > const &rowind, std::vector< int > const &colind, std::vector< Treal > const &values, std::vector< int > const &rowPermutation, std::vector< int > const &colPermutation)
 Same as above, except taking two additional arguments specifying the permutation of rows and columns. More...
 
void assign_from_sparse (std::vector< int > const &rowind, std::vector< int > const &colind, std::vector< Treal > const &values, SizesAndBlocks const &newRows, SizesAndBlocks const &newCols, std::vector< int > const &rowPermutation, std::vector< int > const &colPermutation)
 Same as above, except taking sizes and blocks arguments. More...
 
void add_values (std::vector< int > const &rowind, std::vector< int > const &colind, std::vector< Treal > const &values)
 Add given set of values to the matrix. More...
 
void add_values (std::vector< int > const &rowind, std::vector< int > const &colind, std::vector< Treal > const &values, std::vector< int > const &rowPermutation, std::vector< int > const &colPermutation)
 Same as above, except taking two additional arguments specifying the permutation of rows and columns. More...
 
void get_values (std::vector< int > const &rowind, std::vector< int > const &colind, std::vector< Treal > &values) const
 Get values given by row and column index lists. More...
 
void get_values (std::vector< int > const &rowind, std::vector< int > const &colind, std::vector< Treal > &values, std::vector< int > const &rowPermutation, std::vector< int > const &colPermutation) const
 Same as above, except taking two additional arguments specifying the permutation of rows and columns. More...
 
void get_all_values (std::vector< int > &rowind, std::vector< int > &colind, std::vector< Treal > &values) const
 Get all values and corresponding row and column index lists, in matrix. More...
 
void get_all_values (std::vector< int > &rowind, std::vector< int > &colind, std::vector< Treal > &values, std::vector< int > const &rowInversePermutation, std::vector< int > const &colInversePermutation) const
 Same as above, except taking two additional arguments specifying the permutation of rows and columns. More...
 
MatrixSymmetric< Treal, Tmatrix > & operator= (const MatrixSymmetric< Treal, Tmatrix > &symm)
 
MatrixSymmetric< Treal, Tmatrix > & operator= (const MatrixGeneral< Treal, Tmatrix > &matr)
 
MatrixSymmetric< Treal, Tmatrix > & operator= (int const k)
 
Treal frob () const
 
Treal mixed_norm (Treal const requestedAccuracy, int maxIter=-1) const
 
Treal eucl (Treal const requestedAccuracy, int maxIter=-1) const
 
void quickEuclBounds (Treal &euclLowerBound, Treal &euclUpperBound) const
 
Treal thresh (Treal const threshold, normType const norm)
 Does thresholding so that the error in the chosen norm is below the given threshold. More...
 
Treal frob_thresh (Treal const threshold)
 Does thresholding so that the error in the Frobenius norm is below the given threshold. More...
 
Treal eucl_thresh (Treal const threshold, MatrixTriangular< Treal, Tmatrix > const *const Zptr=NULL)
 
Treal eucl_element_level_thresh (Treal const threshold)
 
void getSizesAndBlocksForFrobNormMat (SizesAndBlocks &rows_new, SizesAndBlocks &cols_new) const
 
Treal mixed_norm_thresh (Treal const threshold)
 
void simple_blockwise_frob_thresh (Treal const threshold)
 
void gershgorin (Treal &lmin, Treal &lmax) const
 
size_t nnz () const
 
size_t nvalues () const
 
void write_to_buffer (void *buffer, const int n_bytes) const
 
void read_from_buffer (void *buffer, const int n_bytes)
 
MatrixSymmetric< Treal, Tmatrix > & operator= (XY< Treal, MatrixSymmetric< Treal, Tmatrix > > const &sm)
 B = alpha * A : A and B are symmetric. More...
 
MatrixSymmetric< Treal, Tmatrix > & operator= (const XYZpUV< Treal, MatrixSymmetric< Treal, Tmatrix >, MatrixSymmetric< Treal, Tmatrix >, Treal, MatrixSymmetric< Treal, Tmatrix > > &sm2psm)
 C = alpha * A * A + beta * C : A and C are symmetric
More...
 
MatrixSymmetric< Treal, Tmatrix > & operator= (const XYZ< Treal, MatrixSymmetric< Treal, Tmatrix >, MatrixSymmetric< Treal, Tmatrix > > &sm2)
 C = alpha * A * A : A and C are symmetric
More...
 
MatrixSymmetric< Treal, Tmatrix > & operator+= (const XYZ< Treal, MatrixSymmetric< Treal, Tmatrix >, MatrixSymmetric< Treal, Tmatrix > > &sm2)
 C += alpha * A * A : A and C are symmetric
More...
 
MatrixSymmetric< Treal, Tmatrix > & operator= (const XYZpUV< Treal, MatrixGeneral< Treal, Tmatrix >, MatrixGeneral< Treal, Tmatrix >, Treal, MatrixSymmetric< Treal, Tmatrix > > &smmpsm)
 C = alpha * A * transpose(A) + beta * C : C is symmetric
More...
 
MatrixSymmetric< Treal, Tmatrix > & operator= (const XYZ< Treal, MatrixGeneral< Treal, Tmatrix >, MatrixGeneral< Treal, Tmatrix > > &smm)
 C = alpha * A * transpose(A) : C is symmetric
More...
 
MatrixSymmetric< Treal, Tmatrix > & operator+= (const XYZ< Treal, MatrixGeneral< Treal, Tmatrix >, MatrixGeneral< Treal, Tmatrix > > &smm)
 C += alpha * A * transpose(A) : C is symmetric
More...
 
MatrixSymmetric< Treal, Tmatrix > & operator= (const XYZ< MatrixTriangular< Treal, Tmatrix >, MatrixSymmetric< Treal, Tmatrix >, MatrixTriangular< Treal, Tmatrix > > &zaz)
 A = Z * A * transpose(Z) : Z is upper triangular and A is symmetric; A = transpose(Z) * A * Z : Z is upper triangular and A is symmetric. More...
 
MatrixSymmetric< Treal, Tmatrix > & operator= (XpY< MatrixSymmetric< Treal, Tmatrix >, MatrixSymmetric< Treal, Tmatrix > > const &mpm)
 C = A + B : A, B, and C are symmetric
More...
 
MatrixSymmetric< Treal, Tmatrix > & operator= (XmY< MatrixSymmetric< Treal, Tmatrix >, MatrixSymmetric< Treal, Tmatrix > > const &mm)
 C = A - B : A, B, and C are symmetric
More...
 
MatrixSymmetric< Treal, Tmatrix > & operator+= (MatrixSymmetric< Treal, Tmatrix > const &A)
 B += A : A and B are symmetric. More...
 
MatrixSymmetric< Treal, Tmatrix > & operator-= (MatrixSymmetric< Treal, Tmatrix > const &A)
 B -= A : A and B are symmetric. More...
 
MatrixSymmetric< Treal, Tmatrix > & operator+= (XY< Treal, MatrixSymmetric< Treal, Tmatrix > > const &sm)
 B += alpha * A : A and B are symmetric. More...
 
MatrixSymmetric< Treal, Tmatrix > & operator-= (XY< Treal, MatrixSymmetric< Treal, Tmatrix > > const &sm)
 B -= alpha * A : A and B are symmetric. More...
 
template<typename Top >
Treal accumulateWith (Top &op)
 
void random ()
 
void randomZeroStructure (Treal probabilityBeingZero)
 
template<typename TRule >
void setElementsByRule (TRule &rule)
 Uses rule depending on the row and column indexes to set matrix elements The Trule class should have the function "Treal = set(int row,int col)" which is used to set the elements. More...
 
void transfer (MatrixSymmetric< Treal, Tmatrix > &dest)
 Transfer this matrix to dest, clearing previous content of dest if any. More...
 
template<typename Tvector >
void matVecProd (Tvector &y, Tvector const &x) const
 
std::string obj_type_id () const
 

Static Public Member Functions

static Interval< Treal > diff (const MatrixSymmetric< Treal, Tmatrix > &A, const MatrixSymmetric< Treal, Tmatrix > &B, normType const norm, Treal const requestedAccuracy)
 Returns interval containing the Euclidean norm of A - B ( || A - B ||_2 ) More...
 
static Interval< Treal > diffIfSmall (const MatrixSymmetric< Treal, Tmatrix > &A, const MatrixSymmetric< Treal, Tmatrix > &B, normType const norm, Treal const requestedAccuracy, Treal const maxAbsVal)
 Returns interval containing the Euclidean norm of A - B ( || A - B ||_2 ) based on the chosen norm. More...
 
static Treal frob_diff (const MatrixSymmetric< Treal, Tmatrix > &A, const MatrixSymmetric< Treal, Tmatrix > &B)
 Returns the Frobenius norm of A - B ( || A - B ||_F ) More...
 
static Treal eucl_diff (const MatrixSymmetric< Treal, Tmatrix > &A, const MatrixSymmetric< Treal, Tmatrix > &B, Treal const requestedAccuracy, int maxIter=-1)
 Returns the Euclidean norm of A - B ( || A - B ||_2 ) More...
 
static Treal mixed_diff (const MatrixSymmetric< Treal, Tmatrix > &A, const MatrixSymmetric< Treal, Tmatrix > &B, Treal const requestedAccuracy)
 Returns the 'mixed' norm of A - B ( || A - B ||_mixed ) More...
 
static Interval< Treal > euclDiffIfSmall (const MatrixSymmetric< Treal, Tmatrix > &A, const MatrixSymmetric< Treal, Tmatrix > &B, Treal const requestedAccuracy, Treal const maxAbsVal, VectorType *const eVecPtr=0)
 Returns interval containing the Euclidean norm of A - B ( || A - B ||_2 ). More...
 
static Treal trace_ab (const MatrixSymmetric< Treal, Tmatrix > &A, const MatrixSymmetric< Treal, Tmatrix > &B)
 
static void ssmmUpperTriangleOnly (const Treal alpha, const MatrixSymmetric< Treal, Tmatrix > &A, const MatrixSymmetric< Treal, Tmatrix > &B, const Treal beta, MatrixSymmetric< Treal, Tmatrix > &C)
 C = alpha * A * B + beta * C where A and B are symmetric and only the upper triangle of C is computed, C is enforced to be symmetric! More...
 

Protected Member Functions

void writeToFileProt (std::ofstream &file) const
 
void readFromFileProt (std::ifstream &file)
 

Static Protected Member Functions

static void getPermutedAndSymmetrized (std::vector< int > const &rowind, std::vector< int > const &rowPermutation, std::vector< int > &newRowind, std::vector< int > const &colind, std::vector< int > const &colPermutation, std::vector< int > &newColind)
 This function permutes row and column indices according to the specified permutation and gives the indices as upper triangle in the new permutation. More...
 

Detailed Description

template<typename Treal, typename Tmatrix>
class mat::MatrixSymmetric< Treal, Tmatrix >

Symmetric matrix.

This class belongs to the matrix API

The matrix is stored in the upper triangle.

Treal: Type for real numbers

Tmatrix: The matrix class

See also
MatrixBase
MatrixGeneral
MatrixTriangular

Member Typedef Documentation

◆ real

template<typename Treal , typename Tmatrix >
typedef Treal mat::MatrixSymmetric< Treal, Tmatrix >::real

◆ VectorType

template<typename Treal , typename Tmatrix >
typedef VectorGeneral<Treal, typename Tmatrix::VectorType> mat::MatrixSymmetric< Treal, Tmatrix >::VectorType

Constructor & Destructor Documentation

◆ MatrixSymmetric() [1/4]

template<typename Treal , typename Tmatrix >
mat::MatrixSymmetric< Treal, Tmatrix >::MatrixSymmetric ( )
inline

Default constructor

◆ MatrixSymmetric() [2/4]

template<typename Treal , typename Tmatrix >
mat::MatrixSymmetric< Treal, Tmatrix >::MatrixSymmetric ( const MatrixSymmetric< Treal, Tmatrix > &  symm)
inline

Copy constructor

◆ MatrixSymmetric() [3/4]

template<typename Treal , typename Tmatrix >
mat::MatrixSymmetric< Treal, Tmatrix >::MatrixSymmetric ( const XY< Treal, MatrixSymmetric< Treal, Tmatrix > > &  sm)
inlineexplicit

◆ MatrixSymmetric() [4/4]

template<typename Treal , typename Tmatrix >
mat::MatrixSymmetric< Treal, Tmatrix >::MatrixSymmetric ( const MatrixGeneral< Treal, Tmatrix > &  matr)
inlineexplicit

'Copy from normal matrix' - constructor

Member Function Documentation

◆ accumulateWith()

template<typename Treal , typename Tmatrix >
template<typename Top >
Treal mat::MatrixSymmetric< Treal, Tmatrix >::accumulateWith ( Top &  op)
inline

◆ add_values() [1/2]

template<typename Treal , typename Tmatrix >
void mat::MatrixSymmetric< Treal, Tmatrix >::add_values ( std::vector< int > const &  rowind,
std::vector< int > const &  colind,
std::vector< Treal > const &  values 
)
inline

Add given set of values to the matrix.

The values should be given in upper triangular storage.

◆ add_values() [2/2]

template<typename Treal , typename Tmatrix >
void mat::MatrixSymmetric< Treal, Tmatrix >::add_values ( std::vector< int > const &  rowind,
std::vector< int > const &  colind,
std::vector< Treal > const &  values,
std::vector< int > const &  rowPermutation,
std::vector< int > const &  colPermutation 
)
inline

Same as above, except taking two additional arguments specifying the permutation of rows and columns.

References mat::MatrixSymmetric< Treal, Tmatrix >::getPermutedAndSymmetrized().

◆ assign_from_sparse() [1/4]

template<typename Treal , typename Tmatrix >
void mat::MatrixSymmetric< Treal, Tmatrix >::assign_from_sparse ( std::vector< int > const &  rowind,
std::vector< int > const &  colind,
std::vector< Treal > const &  values 
)
inline

Assign from sparse matrix given by three vectors.

The vectors contain row indices, column indices and values. The indices start at zero. The elements to be added must be given in upper triangluar storage. Information about sizes and blocks for rows as well as columns must also be given. Assumes that sizes and blocks are already set.

Warning
All indexing start at zero.

Referenced by mat::MatrixSymmetric< Treal, Tmatrix >::assign_from_sparse(), mat::MatrixSymmetric< Treal, Tmatrix >::assignFromFull(), main(), mainFun(), test1(), test2(), test3(), and test4().

◆ assign_from_sparse() [2/4]

template<typename Treal , typename Tmatrix >
void mat::MatrixSymmetric< Treal, Tmatrix >::assign_from_sparse ( std::vector< int > const &  rowind,
std::vector< int > const &  colind,
std::vector< Treal > const &  values,
SizesAndBlocks const &  newRows,
SizesAndBlocks const &  newCols 
)
inline

Assign from sparse matrix given by three vectors.

The vectors contain row indices, column indices and values. The indices start at zero. The elements to be added must be given in upper triangluar storage. Information about sizes and blocks for rows as well as columns must also be given.

Warning
All indexing start at zero.

◆ assign_from_sparse() [3/4]

template<typename Treal , typename Tmatrix >
void mat::MatrixSymmetric< Treal, Tmatrix >::assign_from_sparse ( std::vector< int > const &  rowind,
std::vector< int > const &  colind,
std::vector< Treal > const &  values,
SizesAndBlocks const &  newRows,
SizesAndBlocks const &  newCols,
std::vector< int > const &  rowPermutation,
std::vector< int > const &  colPermutation 
)
inline

Same as above, except taking sizes and blocks arguments.

References mat::MatrixSymmetric< Treal, Tmatrix >::assign_from_sparse().

◆ assign_from_sparse() [4/4]

template<typename Treal , typename Tmatrix >
void mat::MatrixSymmetric< Treal, Tmatrix >::assign_from_sparse ( std::vector< int > const &  rowind,
std::vector< int > const &  colind,
std::vector< Treal > const &  values,
std::vector< int > const &  rowPermutation,
std::vector< int > const &  colPermutation 
)
inline

Same as above, except taking two additional arguments specifying the permutation of rows and columns.

Also, assuming that sizes and blocks are already set.

References mat::MatrixSymmetric< Treal, Tmatrix >::getPermutedAndSymmetrized().

◆ assignFromFull() [1/2]

template<typename Treal , typename Tmatrix >
void mat::MatrixSymmetric< Treal, Tmatrix >::assignFromFull ( std::vector< Treal > const &  fullMat)
inline

Referenced by mainFun().

◆ assignFromFull() [2/2]

template<typename Treal , typename Tmatrix >
void mat::MatrixSymmetric< Treal, Tmatrix >::assignFromFull ( std::vector< Treal > const &  fullMat,
std::vector< int > const &  rowPermutation,
std::vector< int > const &  colPermutation 
)
inline

◆ diff()

template<typename Treal , typename Tmatrix >
Interval< Treal > mat::MatrixSymmetric< Treal, Tmatrix >::diff ( const MatrixSymmetric< Treal, Tmatrix > &  A,
const MatrixSymmetric< Treal, Tmatrix > &  B,
normType const  norm,
Treal const  requestedAccuracy 
)
static

Returns interval containing the Euclidean norm of A - B ( || A - B ||_2 )

See also
eucl_diff
frob_diff

References A, B, mat::euclNorm, mat::frobNorm, and template_blas_sqrt().

◆ diffIfSmall()

template<typename Treal , typename Tmatrix >
Interval< Treal > mat::MatrixSymmetric< Treal, Tmatrix >::diffIfSmall ( const MatrixSymmetric< Treal, Tmatrix > &  A,
const MatrixSymmetric< Treal, Tmatrix > &  B,
normType const  norm,
Treal const  requestedAccuracy,
Treal const  maxAbsVal 
)
static

Returns interval containing the Euclidean norm of A - B ( || A - B ||_2 ) based on the chosen norm.

BUT, in the case of Euclidean norm, the norm is only computed with the requested accuracy if it is smaller than 'maxAbsVal'.

See also
euclDiffIfSmall
frob_diff

References A, B, mat::euclNorm, mat::frobNorm, and template_blas_sqrt().

◆ eucl()

◆ eucl_diff()

template<typename Treal , typename Tmatrix >
Treal mat::MatrixSymmetric< Treal, Tmatrix >::eucl_diff ( const MatrixSymmetric< Treal, Tmatrix > &  A,
const MatrixSymmetric< Treal, Tmatrix > &  B,
Treal const  requestedAccuracy,
int  maxIter = -1 
)
static

Returns the Euclidean norm of A - B ( || A - B ||_2 )

References A, B, mat::euclIfSmall(), mat::Interval< Treal >::midPoint(), and template_blas_sqrt().

◆ eucl_element_level_thresh()

template<typename Treal , typename Tmatrix >
Treal mat::MatrixSymmetric< Treal, Tmatrix >::eucl_element_level_thresh ( Treal const  threshold)

◆ eucl_thresh()

template<typename Treal , typename Tmatrix >
Treal mat::MatrixSymmetric< Treal, Tmatrix >::eucl_thresh ( Treal const  threshold,
MatrixTriangular< Treal, Tmatrix > const *const  Zptr = NULL 
)

◆ euclDiffIfSmall()

template<typename Treal , typename Tmatrix >
Interval< Treal > mat::MatrixSymmetric< Treal, Tmatrix >::euclDiffIfSmall ( const MatrixSymmetric< Treal, Tmatrix > &  A,
const MatrixSymmetric< Treal, Tmatrix > &  B,
Treal const  requestedAccuracy,
Treal const  maxAbsVal,
VectorType *const  eVecPtr = 0 
)
static

Returns interval containing the Euclidean norm of A - B ( || A - B ||_2 ).

BUT, the norm is only computed with the requested accuracy if it is smaller than 'maxAbsVal'. Otherwise, the Frobenius norm is used to get the bounds.

References A, B, mat::euclIfSmall(), mat::Interval< Treal >::length(), mat::Interval< Treal >::midPoint(), and template_blas_sqrt().

◆ frob()

template<typename Treal , typename Tmatrix >
Treal mat::MatrixSymmetric< Treal, Tmatrix >::frob ( ) const
inline

◆ frob_diff()

template<typename Treal , typename Tmatrix >
static Treal mat::MatrixSymmetric< Treal, Tmatrix >::frob_diff ( const MatrixSymmetric< Treal, Tmatrix > &  A,
const MatrixSymmetric< Treal, Tmatrix > &  B 
)
inlinestatic

Returns the Frobenius norm of A - B ( || A - B ||_F )

References A, and B.

◆ frob_thresh()

template<typename Treal , typename Tmatrix >
Treal mat::MatrixSymmetric< Treal, Tmatrix >::frob_thresh ( Treal const  threshold)
inline

Does thresholding so that the error in the Frobenius norm is below the given threshold.

Returns an upper bound of the introduced error. If no elements on the block diagonal are removed the return value is equal to the introduced error.

◆ fullMatrix() [1/2]

template<typename Treal , typename Tmatrix >
void mat::MatrixSymmetric< Treal, Tmatrix >::fullMatrix ( std::vector< Treal > &  fullMat) const
inline

Save matrix as full matrix.

Whole matrix is written in columnwise order. Both lower and upper triangle. NOTE that no permutation is used in this operation.

Referenced by mainFun().

◆ fullMatrix() [2/2]

template<typename Treal , typename Tmatrix >
void mat::MatrixSymmetric< Treal, Tmatrix >::fullMatrix ( std::vector< Treal > &  fullMat,
std::vector< int > const &  rowInversePermutation,
std::vector< int > const &  colInversePermutation 
) const
inline

Save matrix as full matrix.

Whole matrix is written in columnwise order. Both lower and upper triangle. Permutation is used.

References mat::MatrixSymmetric< Treal, Tmatrix >::get_all_values().

◆ gershgorin()

template<typename Treal , typename Tmatrix >
void mat::MatrixSymmetric< Treal, Tmatrix >::gershgorin ( Treal &  lmin,
Treal &  lmax 
) const
inline

Referenced by mainFun().

◆ get_all_values() [1/2]

template<typename Treal , typename Tmatrix >
void mat::MatrixSymmetric< Treal, Tmatrix >::get_all_values ( std::vector< int > &  rowind,
std::vector< int > &  colind,
std::vector< Treal > &  values 
) const
inline

Get all values and corresponding row and column index lists, in matrix.

Only upper triangle values are returned.

Warning
All indexing start at zero.

References mat::MatrixSymmetric< Treal, Tmatrix >::nnz().

Referenced by mat::MatrixSymmetric< Treal, Tmatrix >::fullMatrix(), and mainFun().

◆ get_all_values() [2/2]

template<typename Treal , typename Tmatrix >
void mat::MatrixSymmetric< Treal, Tmatrix >::get_all_values ( std::vector< int > &  rowind,
std::vector< int > &  colind,
std::vector< Treal > &  values,
std::vector< int > const &  rowInversePermutation,
std::vector< int > const &  colInversePermutation 
) const
inline

Same as above, except taking two additional arguments specifying the permutation of rows and columns.

Note, however, that this permutation is the inverse permutation compared to the permutations provided in the functions "assign_from_sparse", "add_values", and "get_values"

Warning
permutation is inverse compared to other functions

References mat::MatrixSymmetric< Treal, Tmatrix >::getPermutedAndSymmetrized().

◆ get_values() [1/2]

template<typename Treal , typename Tmatrix >
void mat::MatrixSymmetric< Treal, Tmatrix >::get_values ( std::vector< int > const &  rowind,
std::vector< int > const &  colind,
std::vector< Treal > &  values 
) const
inline

Get values given by row and column index lists.

Input arrays contain row and column indices. The wanted elements must be given in upper triangluar storage. The output array contains values for the given indices.

Warning
All indexing start at zero.

Referenced by mainFun().

◆ get_values() [2/2]

template<typename Treal , typename Tmatrix >
void mat::MatrixSymmetric< Treal, Tmatrix >::get_values ( std::vector< int > const &  rowind,
std::vector< int > const &  colind,
std::vector< Treal > &  values,
std::vector< int > const &  rowPermutation,
std::vector< int > const &  colPermutation 
) const
inline

Same as above, except taking two additional arguments specifying the permutation of rows and columns.

References mat::MatrixSymmetric< Treal, Tmatrix >::getPermutedAndSymmetrized().

◆ getPermutedAndSymmetrized()

template<typename Treal , typename Tmatrix >
static void mat::MatrixSymmetric< Treal, Tmatrix >::getPermutedAndSymmetrized ( std::vector< int > const &  rowind,
std::vector< int > const &  rowPermutation,
std::vector< int > &  newRowind,
std::vector< int > const &  colind,
std::vector< int > const &  colPermutation,
std::vector< int > &  newColind 
)
inlinestaticprotected

This function permutes row and column indices according to the specified permutation and gives the indices as upper triangle in the new permutation.

Warning
Duplicate indices are kept.

References mat::MatrixBase< Treal, Tmatrix >::getPermutedIndexes().

Referenced by mat::MatrixSymmetric< Treal, Tmatrix >::add_values(), mat::MatrixSymmetric< Treal, Tmatrix >::assign_from_sparse(), mat::MatrixSymmetric< Treal, Tmatrix >::get_all_values(), and mat::MatrixSymmetric< Treal, Tmatrix >::get_values().

◆ getSizesAndBlocksForFrobNormMat()

template<typename Treal , typename Tmatrix >
void mat::MatrixSymmetric< Treal, Tmatrix >::getSizesAndBlocksForFrobNormMat ( SizesAndBlocks rows_new,
SizesAndBlocks cols_new 
) const

◆ matVecProd()

template<typename Treal , typename Tmatrix >
template<typename Tvector >
void mat::MatrixSymmetric< Treal, Tmatrix >::matVecProd ( Tvector &  y,
Tvector const &  x 
) const
inline

◆ mixed_diff()

template<typename Treal , typename Tmatrix >
Treal mat::MatrixSymmetric< Treal, Tmatrix >::mixed_diff ( const MatrixSymmetric< Treal, Tmatrix > &  A,
const MatrixSymmetric< Treal, Tmatrix > &  B,
Treal const  requestedAccuracy 
)
static

Returns the 'mixed' norm of A - B ( || A - B ||_mixed )

References A, and B.

◆ mixed_norm()

template<typename Treal , typename Tmatrix >
Treal mat::MatrixSymmetric< Treal, Tmatrix >::mixed_norm ( Treal const  requestedAccuracy,
int  maxIter = -1 
) const

◆ mixed_norm_thresh()

template<typename Treal , typename Tmatrix >
Treal mat::MatrixSymmetric< Treal, Tmatrix >::mixed_norm_thresh ( Treal const  threshold)

◆ nnz()

template<typename Treal , typename Tmatrix >
size_t mat::MatrixSymmetric< Treal, Tmatrix >::nnz ( ) const
inline

◆ nvalues()

template<typename Treal , typename Tmatrix >
size_t mat::MatrixSymmetric< Treal, Tmatrix >::nvalues ( ) const
inline

◆ obj_type_id()

template<typename Treal , typename Tmatrix >
std::string mat::MatrixSymmetric< Treal, Tmatrix >::obj_type_id ( ) const
inline

◆ operator+=() [1/4]

template<typename Treal , typename Tmatrix >
MatrixSymmetric< Treal, Tmatrix > & mat::MatrixSymmetric< Treal, Tmatrix >::operator+= ( const XYZ< Treal, MatrixGeneral< Treal, Tmatrix >, MatrixGeneral< Treal, Tmatrix > > &  smm)

C += alpha * A * transpose(A) : C is symmetric

References mat::syrk().

◆ operator+=() [2/4]

template<typename Treal , typename Tmatrix >
MatrixSymmetric< Treal, Tmatrix > & mat::MatrixSymmetric< Treal, Tmatrix >::operator+= ( const XYZ< Treal, MatrixSymmetric< Treal, Tmatrix >, MatrixSymmetric< Treal, Tmatrix > > &  sm2)

C += alpha * A * A : A and C are symmetric

◆ operator+=() [3/4]

template<typename Treal , typename Tmatrix >
MatrixSymmetric< Treal, Tmatrix > & mat::MatrixSymmetric< Treal, Tmatrix >::operator+= ( MatrixSymmetric< Treal, Tmatrix > const &  A)
inline

B += A : A and B are symmetric.

References A.

◆ operator+=() [4/4]

template<typename Treal , typename Tmatrix >
MatrixSymmetric< Treal, Tmatrix > & mat::MatrixSymmetric< Treal, Tmatrix >::operator+= ( XY< Treal, MatrixSymmetric< Treal, Tmatrix > > const &  sm)
inline

B += alpha * A : A and B are symmetric.

◆ operator-=() [1/2]

template<typename Treal , typename Tmatrix >
MatrixSymmetric< Treal, Tmatrix > & mat::MatrixSymmetric< Treal, Tmatrix >::operator-= ( MatrixSymmetric< Treal, Tmatrix > const &  A)
inline

B -= A : A and B are symmetric.

References A.

◆ operator-=() [2/2]

template<typename Treal , typename Tmatrix >
MatrixSymmetric< Treal, Tmatrix > & mat::MatrixSymmetric< Treal, Tmatrix >::operator-= ( XY< Treal, MatrixSymmetric< Treal, Tmatrix > > const &  sm)
inline

B -= alpha * A : A and B are symmetric.

◆ operator=() [1/11]

template<typename Treal , typename Tmatrix >
MatrixSymmetric<Treal, Tmatrix>& mat::MatrixSymmetric< Treal, Tmatrix >::operator= ( const MatrixGeneral< Treal, Tmatrix > &  matr)
inline

◆ operator=() [2/11]

template<typename Treal , typename Tmatrix >
MatrixSymmetric<Treal, Tmatrix>& mat::MatrixSymmetric< Treal, Tmatrix >::operator= ( const MatrixSymmetric< Treal, Tmatrix > &  symm)
inline

◆ operator=() [3/11]

template<typename Treal , typename Tmatrix >
MatrixSymmetric< Treal, Tmatrix > & mat::MatrixSymmetric< Treal, Tmatrix >::operator= ( const XYZ< MatrixTriangular< Treal, Tmatrix >, MatrixSymmetric< Treal, Tmatrix >, MatrixTriangular< Treal, Tmatrix > > &  zaz)

A = Z * A * transpose(Z) : Z is upper triangular and A is symmetric; A = transpose(Z) * A * Z : Z is upper triangular and A is symmetric.

◆ operator=() [4/11]

template<typename Treal , typename Tmatrix >
MatrixSymmetric< Treal, Tmatrix > & mat::MatrixSymmetric< Treal, Tmatrix >::operator= ( const XYZ< Treal, MatrixGeneral< Treal, Tmatrix >, MatrixGeneral< Treal, Tmatrix > > &  smm)

C = alpha * A * transpose(A) : C is symmetric

References mat::syrk().

◆ operator=() [5/11]

template<typename Treal , typename Tmatrix >
MatrixSymmetric< Treal, Tmatrix > & mat::MatrixSymmetric< Treal, Tmatrix >::operator= ( const XYZ< Treal, MatrixSymmetric< Treal, Tmatrix >, MatrixSymmetric< Treal, Tmatrix > > &  sm2)

C = alpha * A * A : A and C are symmetric

◆ operator=() [6/11]

template<typename Treal , typename Tmatrix >
MatrixSymmetric< Treal, Tmatrix > & mat::MatrixSymmetric< Treal, Tmatrix >::operator= ( const XYZpUV< Treal, MatrixGeneral< Treal, Tmatrix >, MatrixGeneral< Treal, Tmatrix >, Treal, MatrixSymmetric< Treal, Tmatrix > > &  smmpsm)

C = alpha * A * transpose(A) + beta * C : C is symmetric

References mat::syrk().

◆ operator=() [7/11]

template<typename Treal , typename Tmatrix >
MatrixSymmetric< Treal, Tmatrix > & mat::MatrixSymmetric< Treal, Tmatrix >::operator= ( const XYZpUV< Treal, MatrixSymmetric< Treal, Tmatrix >, MatrixSymmetric< Treal, Tmatrix >, Treal, MatrixSymmetric< Treal, Tmatrix > > &  sm2psm)

C = alpha * A * A + beta * C : A and C are symmetric

◆ operator=() [8/11]

template<typename Treal , typename Tmatrix >
MatrixSymmetric<Treal, Tmatrix>& mat::MatrixSymmetric< Treal, Tmatrix >::operator= ( int const  k)
inline

◆ operator=() [9/11]

template<typename Treal , typename Tmatrix >
MatrixSymmetric< Treal, Tmatrix > & mat::MatrixSymmetric< Treal, Tmatrix >::operator= ( XmY< MatrixSymmetric< Treal, Tmatrix >, MatrixSymmetric< Treal, Tmatrix > > const &  mm)
inline

C = A - B : A, B, and C are symmetric

◆ operator=() [10/11]

template<typename Treal , typename Tmatrix >
MatrixSymmetric< Treal, Tmatrix > & mat::MatrixSymmetric< Treal, Tmatrix >::operator= ( XpY< MatrixSymmetric< Treal, Tmatrix >, MatrixSymmetric< Treal, Tmatrix > > const &  mpm)
inline

C = A + B : A, B, and C are symmetric

◆ operator=() [11/11]

template<typename Treal , typename Tmatrix >
MatrixSymmetric< Treal, Tmatrix > & mat::MatrixSymmetric< Treal, Tmatrix >::operator= ( XY< Treal, MatrixSymmetric< Treal, Tmatrix > > const &  sm)
inline

B = alpha * A : A and B are symmetric.

◆ quickEuclBounds()

template<typename Treal , typename Tmatrix >
void mat::MatrixSymmetric< Treal, Tmatrix >::quickEuclBounds ( Treal &  euclLowerBound,
Treal &  euclUpperBound 
) const
inline

◆ random()

template<typename Treal , typename Tmatrix >
void mat::MatrixSymmetric< Treal, Tmatrix >::random ( )
inline

Referenced by mainFun().

◆ randomZeroStructure()

template<typename Treal , typename Tmatrix >
void mat::MatrixSymmetric< Treal, Tmatrix >::randomZeroStructure ( Treal  probabilityBeingZero)
inline

Referenced by main(), and mainFun().

◆ read_from_buffer()

template<typename Treal , typename Tmatrix >
void mat::MatrixSymmetric< Treal, Tmatrix >::read_from_buffer ( void *  buffer,
const int  n_bytes 
)
inline

References mat::matrix_symm.

◆ readFromFileProt()

template<typename Treal , typename Tmatrix >
void mat::MatrixSymmetric< Treal, Tmatrix >::readFromFileProt ( std::ifstream &  file)
inlineprotected

References mat::matrix_symm.

◆ setElementsByRule()

template<typename Treal , typename Tmatrix >
template<typename TRule >
void mat::MatrixSymmetric< Treal, Tmatrix >::setElementsByRule ( TRule &  rule)
inline

Uses rule depending on the row and column indexes to set matrix elements The Trule class should have the function "Treal = set(int row,int col)" which is used to set the elements.

Referenced by mainFun().

◆ simple_blockwise_frob_thresh()

template<typename Treal , typename Tmatrix >
void mat::MatrixSymmetric< Treal, Tmatrix >::simple_blockwise_frob_thresh ( Treal const  threshold)
inline

◆ ssmmUpperTriangleOnly()

template<typename Treal , typename Tmatrix >
void mat::MatrixSymmetric< Treal, Tmatrix >::ssmmUpperTriangleOnly ( const Treal  alpha,
const MatrixSymmetric< Treal, Tmatrix > &  A,
const MatrixSymmetric< Treal, Tmatrix > &  B,
const Treal  beta,
MatrixSymmetric< Treal, Tmatrix > &  C 
)
static

C = alpha * A * B + beta * C where A and B are symmetric and only the upper triangle of C is computed, C is enforced to be symmetric!

References A, and B.

◆ thresh()

template<typename Treal , typename Tmatrix >
Treal mat::MatrixSymmetric< Treal, Tmatrix >::thresh ( Treal const  threshold,
normType const  norm 
)

Does thresholding so that the error in the chosen norm is below the given threshold.

Returns the actual introduced error. In case of the Frobenius norm the return value may be an upper bound. In case of the Euclidean norm the return value is sometimes an upper bound as well but it can only happen if the whole matrix is removed.

See also
frob_thresh(Treal)
eucl_thresh(Treal const)

References mat::euclNorm, mat::frobNorm, and mat::mixedNorm.

◆ trace_ab()

template<typename Treal , typename Tmatrix >
static Treal mat::MatrixSymmetric< Treal, Tmatrix >::trace_ab ( const MatrixSymmetric< Treal, Tmatrix > &  A,
const MatrixSymmetric< Treal, Tmatrix > &  B 
)
inlinestatic

References A, and B.

◆ transfer()

template<typename Treal , typename Tmatrix >
void mat::MatrixSymmetric< Treal, Tmatrix >::transfer ( MatrixSymmetric< Treal, Tmatrix > &  dest)
inline

Transfer this matrix to dest, clearing previous content of dest if any.

References mat::ValidPtr< Tobj >::swap().

◆ write_to_buffer()

template<typename Treal , typename Tmatrix >
void mat::MatrixSymmetric< Treal, Tmatrix >::write_to_buffer ( void *  buffer,
const int  n_bytes 
) const
inline

References mat::matrix_symm.

◆ writeToFileProt()

template<typename Treal , typename Tmatrix >
void mat::MatrixSymmetric< Treal, Tmatrix >::writeToFileProt ( std::ofstream &  file) const
inlineprotected

References mat::matrix_symm.


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