Symmetric matrix. More...
#include <MatrixSymmetric.h>
Public Types | |
typedef VectorGeneral< Treal, typename Tmatrix::VectorType > | VectorType |
typedef Treal | real |
Public Member Functions | |
MatrixSymmetric () | |
Default constructor. | |
MatrixSymmetric (const MatrixSymmetric< Treal, Tmatrix > &symm) | |
Copy constructor. | |
MatrixSymmetric (const XY< Treal, MatrixSymmetric< Treal, Tmatrix > > &sm) | |
MatrixSymmetric (const MatrixGeneral< Treal, Tmatrix > &matr) | |
'Copy from normal matrix' - constructor | |
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. | |
void | fullMatrix (std::vector< Treal > &fullMat, std::vector< int > const &rowInversePermutation, std::vector< int > const &colInversePermutation) const |
Save matrix as full matrix. | |
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. | |
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. | |
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. | |
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. | |
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. | |
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. | |
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. | |
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. | |
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. | |
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. | |
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. | |
Treal | frob_thresh (Treal const threshold) |
Does thresholding so that the error in the Frobenius norm is below the given threshold. | |
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 | gersgorin (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. | |
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. | |
MatrixSymmetric< Treal, Tmatrix > & | operator= (const XYZ< Treal, MatrixSymmetric< Treal, Tmatrix >, MatrixSymmetric< Treal, Tmatrix > > &sm2) |
C = alpha * A * A : A and C are symmetric. | |
MatrixSymmetric< Treal, Tmatrix > & | operator+= (const XYZ< Treal, MatrixSymmetric< Treal, Tmatrix >, MatrixSymmetric< Treal, Tmatrix > > &sm2) |
C += alpha * A * A : A and C are symmetric. | |
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. | |
MatrixSymmetric< Treal, Tmatrix > & | operator= (const XYZ< Treal, MatrixGeneral< Treal, Tmatrix >, MatrixGeneral< Treal, Tmatrix > > &smm) |
C = alpha * A * transpose(A) : C is symmetric. | |
MatrixSymmetric< Treal, Tmatrix > & | operator+= (const XYZ< Treal, MatrixGeneral< Treal, Tmatrix >, MatrixGeneral< Treal, Tmatrix > > &smm) |
C += alpha * A * transpose(A) : C is symmetric. | |
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. | |
MatrixSymmetric< Treal, Tmatrix > & | operator= (XpY< MatrixSymmetric< Treal, Tmatrix >, MatrixSymmetric< Treal, Tmatrix > > const &mpm) |
C = A + B : A, B, and C are symmetric. | |
MatrixSymmetric< Treal, Tmatrix > & | operator= (XmY< MatrixSymmetric< Treal, Tmatrix >, MatrixSymmetric< Treal, Tmatrix > > const &mm) |
C = A - B : A, B, and C are symmetric. | |
MatrixSymmetric< Treal, Tmatrix > & | operator+= (MatrixSymmetric< Treal, Tmatrix > const &A) |
B += A : A and B are symmetric. | |
MatrixSymmetric< Treal, Tmatrix > & | operator-= (MatrixSymmetric< Treal, Tmatrix > const &A) |
B -= A : A and B are symmetric. | |
MatrixSymmetric< Treal, Tmatrix > & | operator+= (XY< Treal, MatrixSymmetric< Treal, Tmatrix > > const &sm) |
B += alpha * A : A and B are symmetric. | |
MatrixSymmetric< Treal, Tmatrix > & | operator-= (XY< Treal, MatrixSymmetric< Treal, Tmatrix > > const &sm) |
B -= alpha * A : A and B are symmetric. | |
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. | |
void | transfer (MatrixSymmetric< Treal, Tmatrix > &dest) |
Transfer this matrix to dest, clearing previous content of dest if any. | |
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 ). | |
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. | |
static Treal | frob_diff (const MatrixSymmetric< Treal, Tmatrix > &A, const MatrixSymmetric< Treal, Tmatrix > &B) |
Returns the Frobenius norm of A - B ( || A - B ||_F ). | |
static Treal | eucl_diff (const MatrixSymmetric< Treal, Tmatrix > &A, const MatrixSymmetric< Treal, Tmatrix > &B, Treal const requestedAccuracy) |
Returns the Euclidean norm of A - B ( || A - B ||_2 ). | |
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 ). | |
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 ). | |
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! | |
Protected Member Functions | |
void | writeToFileProt (std::ofstream &file) const |
Write object to file. | |
void | readFromFileProt (std::ifstream &file) |
Read object from 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. |
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
typedef Treal mat::MatrixSymmetric< Treal, Tmatrix >::real |
typedef VectorGeneral<Treal, typename Tmatrix::VectorType> mat::MatrixSymmetric< Treal, Tmatrix >::VectorType |
mat::MatrixSymmetric< Treal, Tmatrix >::MatrixSymmetric | ( | ) | [inline] |
Default constructor.
mat::MatrixSymmetric< Treal, Tmatrix >::MatrixSymmetric | ( | const MatrixSymmetric< Treal, Tmatrix > & | symm | ) | [inline, explicit] |
Copy constructor.
mat::MatrixSymmetric< Treal, Tmatrix >::MatrixSymmetric | ( | const XY< Treal, MatrixSymmetric< Treal, Tmatrix > > & | sm | ) | [inline, explicit] |
mat::MatrixSymmetric< Treal, Tmatrix >::MatrixSymmetric | ( | const MatrixGeneral< Treal, Tmatrix > & | matr | ) | [inline, explicit] |
'Copy from normal matrix' - constructor
Treal mat::MatrixSymmetric< Treal, Tmatrix >::accumulateWith | ( | Top & | op | ) | [inline] |
Referenced by mat::accumulate().
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.
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.
Referenced by add_random_diag_perturbation(), SparseMatrix::addSymmetrizedTo(), calculation_shared(), and main().
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.
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.
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.
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.
Referenced by add_disturbance_to_matrix(), mat::MatrixSymmetric< ergo_real, Matri >::assign_from_sparse(), mat::MatrixSymmetric< ergo_real, Matri >::assignFromFull(), compute_h_core_matrix_simple_dense(), compute_J_by_boxes_sparse(), compute_K_by_boxes_sparse(), compute_V_sparse(), get_diag_matrix_from_file(), get_simple_starting_guess_sparse(), get_T(), load_density_and_project_sparse(), main(), and mainFun().
void mat::MatrixSymmetric< Treal, Tmatrix >::assignFromFull | ( | std::vector< Treal > const & | fullMat, | |
std::vector< int > const & | rowPermutation, | |||
std::vector< int > const & | colPermutation | |||
) | [inline] |
void mat::MatrixSymmetric< Treal, Tmatrix >::assignFromFull | ( | std::vector< Treal > const & | fullMat | ) | [inline] |
Referenced by SCF_unrestricted::do_spin_flip(), get_2e_matrices_and_energy_restricted_open(), get_2e_matrices_and_energy_simple_sparse_unrestricted(), get_2e_matrices_and_energy_sparse_unrestricted(), get_2e_matrix_and_energy_simple_sparse(), get_2e_matrix_and_energy_sparse(), get_dens_from_fock_general(), get_random_positive_definite_matrix(), and mainFun().
Interval< Treal > mat::MatrixSymmetric< Treal, Tmatrix >::diff | ( | const MatrixSymmetric< Treal, Tmatrix > & | A, | |
const MatrixSymmetric< Treal, Tmatrix > & | B, | |||
normType const | norm, | |||
Treal const | requestedAccuracy | |||
) | [inline, static] |
Returns interval containing the Euclidean norm of A - B ( || A - B ||_2 ).
References mat::MatrixSymmetric< Treal, Tmatrix >::eucl_diff(), mat::euclNorm, mat::MatrixSymmetric< Treal, Tmatrix >::frob_diff(), mat::frobNorm, mat::MatrixBase< Treal, Tmatrix >::get_nrows(), and template_blas_sqrt().
Referenced by mat::MatrixSymmetric< Treal, Tmatrix >::diffIfSmall().
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 | |||
) | [inline, 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'.
References mat::MatrixSymmetric< Treal, Tmatrix >::diff(), mat::MatrixSymmetric< Treal, Tmatrix >::euclDiffIfSmall(), mat::euclNorm, mat::MatrixSymmetric< Treal, Tmatrix >::frob_diff(), mat::frobNorm, mat::MatrixBase< Treal, Tmatrix >::get_nrows(), and template_blas_sqrt().
Treal mat::MatrixSymmetric< Treal, Tmatrix >::eucl | ( | Treal const | requestedAccuracy, | |
int | maxIter = -1 | |||
) | const [inline] |
References mat::MatrixSymmetric< Treal, Tmatrix >::frob(), mat::MatrixSymmetric< Treal, Tmatrix >::frob_thresh(), mat::MatrixBase< Treal, Tmatrix >::get_nrows(), mat::MatrixBase< Treal, Tmatrix >::getCols(), mat::arn::LanczosLargestMagnitudeEig< Treal, Tmatrix, Tvector >::getLargestMagnitudeEig(), mat::VectorGeneral< Treal, Tvector >::rand(), mat::VectorGeneral< Treal, Tvector >::resetSizesAndBlocks(), and template_blas_fabs().
Referenced by SCF_restricted::disturb_dens_matrix_exact_try(), SCF_restricted::get_2e_part_and_energy(), SCF_restricted::get_non_ort_err_mat_normalized_in_ort_basis(), getAllEigsInterval(), SCF_general::GetEuclideanNormOfMatrix(), main(), mainFun(), mat::MatrixSymmetric< Treal, Tmatrix >::mixed_diff(), mat::MatrixSymmetric< Treal, Tmatrix >::mixed_norm(), MatAccInvestigator< Treal, Tworker >::Scan(), SCF_general::SCF_general(), and SCF_restricted::update_subspace_diff().
Treal mat::MatrixSymmetric< Treal, Tmatrix >::eucl_diff | ( | const MatrixSymmetric< Treal, Tmatrix > & | A, | |
const MatrixSymmetric< Treal, Tmatrix > & | B, | |||
Treal const | requestedAccuracy | |||
) | [inline, static] |
Returns the Euclidean norm of A - B ( || A - B ||_2 ).
References mat::euclIfSmall(), and mat::Interval< Treal >::midPoint().
Referenced by mat::MatrixSymmetric< Treal, Tmatrix >::diff(), SCF_restricted::get_2e_part_and_energy(), get_dens_from_fock_sparse(), get_E_norm_and_sin_theta(), output_diff_norm_values(), and run_comparison_to_simple_purification().
Treal mat::MatrixSymmetric< Treal, Tmatrix >::eucl_element_level_thresh | ( | Treal const | threshold | ) |
Treal mat::MatrixSymmetric< Treal, Tmatrix >::eucl_thresh | ( | Treal const | threshold, | |
MatrixTriangular< Treal, Tmatrix > const *const | Zptr = NULL | |||
) | [inline] |
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 | |||
) | [inline, 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 mat::euclIfSmall(), mat::Interval< Treal >::length(), and mat::Interval< Treal >::midPoint().
Referenced by mat::MatrixSymmetric< Treal, Tmatrix >::diffIfSmall().
Treal mat::MatrixSymmetric< Treal, Tmatrix >::frob | ( | ) | const [inline] |
static Treal mat::MatrixSymmetric< Treal, Tmatrix >::frob_diff | ( | const MatrixSymmetric< Treal, Tmatrix > & | A, | |
const MatrixSymmetric< Treal, Tmatrix > & | B | |||
) | [inline, static] |
Returns the Frobenius norm of A - B ( || A - B ||_F ).
Referenced by mat::MatrixSymmetric< Treal, Tmatrix >::diff(), mat::MatrixSymmetric< Treal, Tmatrix >::diffIfSmall(), do_tdhf_dynamics(), SCF_restricted::get_2e_part_and_energy(), get_dens_from_fock_sparse(), mainFun(), output_diff_norm_values(), simple_purification(), and test_S_V_comparison().
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.
Referenced by mat::MatrixSymmetric< Treal, Tmatrix >::eucl(), SCF_unrestricted::get_2e_part_and_energy(), mat::MatrixSymmetric< Treal, Tmatrix >::thresh(), and SCF_unrestricted::use_diis_to_get_new_fock_matrix().
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.
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 SCF_unrestricted::do_spin_flip(), es_run(), get_2e_matrices_and_energy_restricted_open(), get_2e_matrices_and_energy_simple_sparse_unrestricted(), get_2e_matrices_and_energy_sparse_unrestricted(), get_2e_matrix_and_energy_simple_sparse(), get_2e_matrix_and_energy_sparse(), mainFun(), SCF_unrestricted::output_density_images(), test_V_by_explicit_comparison(), test_V_by_explicit_comparison_tight(), and write_full_matrix().
void mat::MatrixSymmetric< Treal, Tmatrix >::gersgorin | ( | Treal & | lmin, | |
Treal & | lmax | |||
) | const [inline] |
Referenced by getAllEigsInterval(), and mainFun().
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"
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.
Referenced by mat::MatrixSymmetric< ergo_real, Matri >::fullMatrix(), get_CSR_from_symmMatrix(), main(), mainFun(), SCF_unrestricted::write_density_to_file(), and SCF_restricted::write_density_to_file().
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.
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.
Referenced by check_diagonal_elements_of_overlap_matrix(), compute_J_by_boxes_sparse(), mainFun(), small_calculation_core(), SparseMatrix::SparseMatrix(), and write_diag_elements_to_file().
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 | |||
) | [inline, static, protected] |
This function permutes row and column indices according to the specified permutation and gives the indices as upper triangle in the new permutation.
Referenced by mat::MatrixSymmetric< ergo_real, Matri >::add_values(), mat::MatrixSymmetric< ergo_real, Matri >::assign_from_sparse(), mat::MatrixSymmetric< ergo_real, Matri >::get_all_values(), and mat::MatrixSymmetric< ergo_real, Matri >::get_values().
void mat::MatrixSymmetric< Treal, Tmatrix >::getSizesAndBlocksForFrobNormMat | ( | SizesAndBlocks & | rows_new, | |
SizesAndBlocks & | cols_new | |||
) | const [inline] |
void mat::MatrixSymmetric< Treal, Tmatrix >::matVecProd | ( | Tvector & | y, | |
Tvector const & | x | |||
) | const [inline] |
Treal mat::MatrixSymmetric< Treal, Tmatrix >::mixed_diff | ( | const MatrixSymmetric< Treal, Tmatrix > & | A, | |
const MatrixSymmetric< Treal, Tmatrix > & | B, | |||
Treal const | requestedAccuracy | |||
) | [inline, static] |
Returns the 'mixed' norm of A - B ( || A - B ||_mixed ).
References mat::MatrixSymmetric< Treal, Tmatrix >::eucl(), mat::MatrixBase< Treal, Tmatrix >::getMatrix(), mat::MatrixSymmetric< Treal, Tmatrix >::getSizesAndBlocksForFrobNormMat(), and mat::MatrixBase< Treal, Tmatrix >::resetSizesAndBlocks().
Referenced by SCF_restricted::get_2e_part_and_energy(), get_dens_from_fock_sparse(), and output_diff_norm_values().
Treal mat::MatrixSymmetric< Treal, Tmatrix >::mixed_norm | ( | Treal const | requestedAccuracy, | |
int | maxIter = -1 | |||
) | const [inline] |
Treal mat::MatrixSymmetric< Treal, Tmatrix >::mixed_norm_thresh | ( | Treal const | threshold | ) | [inline] |
References mat::MatrixBase< Treal, Tmatrix >::getMatrix(), mat::MatrixSymmetric< Treal, Tmatrix >::getSizesAndBlocksForFrobNormMat(), mat::MatrixBase< Treal, Tmatrix >::resetSizesAndBlocks(), and mat::EuclTruncationBase< Tmatrix, Treal >::run().
Referenced by mainFun(), and mat::MatrixSymmetric< Treal, Tmatrix >::thresh().
size_t mat::MatrixSymmetric< Treal, Tmatrix >::nnz | ( | ) | const [inline] |
size_t mat::MatrixSymmetric< Treal, Tmatrix >::nvalues | ( | ) | const [inline] |
Referenced by SCF_unrestricted::write_density_to_file(), and SCF_restricted::write_density_to_file().
std::string mat::MatrixSymmetric< Treal, Tmatrix >::obj_type_id | ( | ) | const [inline, virtual] |
Reimplemented from mat::MatrixBase< Treal, 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.
MatrixSymmetric< Treal, Tmatrix > & mat::MatrixSymmetric< Treal, Tmatrix >::operator+= | ( | MatrixSymmetric< Treal, Tmatrix > const & | A | ) | [inline] |
B += A : A and B are symmetric.
References mat::MatrixBase< Treal, Tmatrix >::matrixPtr.
MatrixSymmetric< Treal, Tmatrix > & mat::MatrixSymmetric< Treal, Tmatrix >::operator+= | ( | const XYZ< Treal, MatrixGeneral< Treal, Tmatrix >, MatrixGeneral< Treal, Tmatrix > > & | smm | ) | [inline] |
C += alpha * A * transpose(A) : C is symmetric.
References mat::syrk().
MatrixSymmetric< Treal, Tmatrix > & mat::MatrixSymmetric< Treal, Tmatrix >::operator+= | ( | const XYZ< Treal, MatrixSymmetric< Treal, Tmatrix >, MatrixSymmetric< Treal, Tmatrix > > & | sm2 | ) | [inline] |
C += alpha * A * A : A and C are symmetric.
MatrixSymmetric< Treal, Tmatrix > & mat::MatrixSymmetric< Treal, Tmatrix >::operator-= | ( | XY< Treal, MatrixSymmetric< Treal, Tmatrix > > const & | sm | ) | [inline] |
B -= alpha * A : A and B are symmetric.
MatrixSymmetric< Treal, Tmatrix > & mat::MatrixSymmetric< Treal, Tmatrix >::operator-= | ( | MatrixSymmetric< Treal, Tmatrix > const & | A | ) | [inline] |
B -= A : A and B are symmetric.
References mat::MatrixBase< Treal, Tmatrix >::matrixPtr.
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.
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.
MatrixSymmetric< Treal, Tmatrix > & mat::MatrixSymmetric< Treal, Tmatrix >::operator= | ( | const XYZ< MatrixTriangular< Treal, Tmatrix >, MatrixSymmetric< Treal, Tmatrix >, MatrixTriangular< Treal, Tmatrix > > & | zaz | ) | [inline] |
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.
MatrixSymmetric< Treal, Tmatrix > & mat::MatrixSymmetric< Treal, Tmatrix >::operator= | ( | const XYZ< Treal, MatrixGeneral< Treal, Tmatrix >, MatrixGeneral< Treal, Tmatrix > > & | smm | ) | [inline] |
C = alpha * A * transpose(A) : C is symmetric.
References mat::syrk().
MatrixSymmetric< Treal, Tmatrix > & mat::MatrixSymmetric< Treal, Tmatrix >::operator= | ( | const XYZpUV< Treal, MatrixGeneral< Treal, Tmatrix >, MatrixGeneral< Treal, Tmatrix >, Treal, MatrixSymmetric< Treal, Tmatrix > > & | smmpsm | ) | [inline] |
C = alpha * A * transpose(A) + beta * C : C is symmetric.
References mat::syrk().
MatrixSymmetric< Treal, Tmatrix > & mat::MatrixSymmetric< Treal, Tmatrix >::operator= | ( | const XYZ< Treal, MatrixSymmetric< Treal, Tmatrix >, MatrixSymmetric< Treal, Tmatrix > > & | sm2 | ) | [inline] |
C = alpha * A * A : A and C are symmetric.
MatrixSymmetric< Treal, Tmatrix > & mat::MatrixSymmetric< Treal, Tmatrix >::operator= | ( | const XYZpUV< Treal, MatrixSymmetric< Treal, Tmatrix >, MatrixSymmetric< Treal, Tmatrix >, Treal, MatrixSymmetric< Treal, Tmatrix > > & | sm2psm | ) | [inline] |
C = alpha * A * A + beta * C : A and C are symmetric.
MatrixSymmetric< Treal, Tmatrix > & mat::MatrixSymmetric< Treal, Tmatrix >::operator= | ( | XY< Treal, MatrixSymmetric< Treal, Tmatrix > > const & | sm | ) | [inline] |
B = alpha * A : A and B are symmetric.
MatrixSymmetric<Treal, Tmatrix>& mat::MatrixSymmetric< Treal, Tmatrix >::operator= | ( | int const | k | ) | [inline] |
MatrixSymmetric<Treal, Tmatrix>& mat::MatrixSymmetric< Treal, Tmatrix >::operator= | ( | const MatrixGeneral< Treal, Tmatrix > & | matr | ) | [inline] |
MatrixSymmetric<Treal, Tmatrix>& mat::MatrixSymmetric< Treal, Tmatrix >::operator= | ( | const MatrixSymmetric< Treal, Tmatrix > & | symm | ) | [inline] |
Reimplemented from mat::MatrixBase< Treal, Tmatrix >.
Referenced by mat::MatrixSymmetric< ergo_real, Matri >::operator=().
void mat::MatrixSymmetric< Treal, Tmatrix >::quickEuclBounds | ( | Treal & | euclLowerBound, | |
Treal & | euclUpperBound | |||
) | const [inline] |
void mat::MatrixSymmetric< Treal, Tmatrix >::random | ( | ) | [inline] |
void mat::MatrixSymmetric< Treal, Tmatrix >::randomZeroStructure | ( | Treal | probabilityBeingZero | ) | [inline] |
Referenced by mainFun().
void mat::MatrixSymmetric< Treal, Tmatrix >::read_from_buffer | ( | void * | buffer, | |
const int | n_bytes | |||
) | [inline] |
void mat::MatrixSymmetric< Treal, Tmatrix >::readFromFileProt | ( | std::ifstream & | ) | [inline, protected, virtual] |
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().
void mat::MatrixSymmetric< Treal, Tmatrix >::simple_blockwise_frob_thresh | ( | Treal const | threshold | ) | [inline] |
Referenced by get_E_norm_and_sin_theta(), and simple_purification().
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 | |||
) | [inline, 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 mat::MatrixBase< Treal, Tmatrix >::matrixPtr.
Treal mat::MatrixSymmetric< Treal, Tmatrix >::thresh | ( | Treal const | threshold, | |
normType const | norm | |||
) | [inline] |
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.
References mat::MatrixSymmetric< Treal, Tmatrix >::eucl_thresh(), mat::euclNorm, mat::MatrixSymmetric< Treal, Tmatrix >::frob_thresh(), mat::frobNorm, mat::MatrixSymmetric< Treal, Tmatrix >::mixed_norm_thresh(), and mat::mixedNorm.
Referenced by get_dens_from_fock_sparse().
static Treal mat::MatrixSymmetric< Treal, Tmatrix >::trace_ab | ( | const MatrixSymmetric< Treal, Tmatrix > & | A, | |
const MatrixSymmetric< Treal, Tmatrix > & | B | |||
) | [inline, static] |
Referenced by SCF_unrestricted::calculate_energy(), SCF_restricted::calculate_energy(), compute_dipole_moment_onecoord(), SCF_unrestricted::do_spin_flip(), get_2e_matrices_and_energy_restricted_open(), get_2e_matrices_and_energy_simple_HF_sparse_unrestricted(), get_2e_matrices_and_energy_simple_sparse_unrestricted(), get_2e_matrix_and_energy_simple_HF_sparse(), get_2e_matrix_and_energy_simple_sparse(), SCF_unrestricted::get_new_density_matrix(), and SCF_restricted::get_new_density_matrix().
void mat::MatrixSymmetric< Treal, Tmatrix >::transfer | ( | MatrixSymmetric< Treal, Tmatrix > & | dest | ) | [inline] |
Transfer this matrix to dest, clearing previous content of dest if any.
Referenced by get_dens_from_fock_sparse(), and simple_purification().
void mat::MatrixSymmetric< Treal, Tmatrix >::write_to_buffer | ( | void * | buffer, | |
const int | n_bytes | |||
) | const [inline] |
void mat::MatrixSymmetric< Treal, Tmatrix >::writeToFileProt | ( | std::ofstream & | ) | const [inline, protected, virtual] |