30 #if !defined(_SPARSE_MATRIX_H_)
31 #define _SPARSE_MATRIX_H_ 1
48 #if !defined(BEGIN_NAMESPACE)
49 #define BEGIN_NAMESPACE(x) namespace x {
50 #define END_NAMESPACE(x) }
61 virtual const char *
what()
const throw() {
return msg; }
78 std::vector<int>
const & permutationHML);
81 for(
int i=0; i<n; i++) {
82 delete [](columns[i]);
83 delete [](offsets[i]);
92 void print(
const char *title)
const;
97 std::vector<int>
const & permutationHML)
const;
104 const int *hi = his[col];
106 for(idx = 0; idx < cnt[col] && row >hi[idx]; ++idx);
109 throw Exception(
"SparseMatrix::add called with incorrect args");
110 int offset = offsets[col][idx];
114 columnData[row-offset] += val;
122 const ergo_real *columnData = columns[col];
123 const int *hi = his[col];
124 int idx;
for(idx = 0; idx < cnt[col] && row >hi[idx]; ++idx);
126 throw Exception(
"SparseMatrix::at called with incorrect args");
128 int offset = offsets[col][idx];
132 return columnData[row-offset];
142 const
int* nblocks, const
int (*iblocks)[2],
147 const
int* nblocks, const
int (*iblocks)[2],
double ergo_real
Definition: realtype.h:69
int n
Definition: sparse_matrix.h:69
#define END_NAMESPACE(x)
Definition: sparse_pattern.h:42
void getrho_blocked_lda(int nbast, const real *dmat, const real *restrict gao, const int *nblocks, const int(*iblocks)[2], int ldaib, real *tmp, int nvclen, real *rho)
Computes the expectation value <o|dmat|o'> for a symmetric matrix and given set of precomputed orbital...
Definition: rho-mat.cc:94
#define BEGIN_NAMESPACE(x)
Definition: sparse_pattern.h:41
A way to store sparse matrix patterns.
Definition: sparse_pattern.h:53
MatrixSymmetric< real, matri > symmMatrix
Definition: test_LanczosSeveralLargestEig.cc:69
Definition: sparse_matrix.h:57
Class that can be used to store sparse matrix patterns.
Code for setting up basis functions starting from shells.
ergo_real at(int row, int col) const
Definition: sparse_matrix.h:121
const SparsePattern & pattern
Definition: sparse_matrix.h:64
Definition of the main floating-point datatype used; the ergo_real type.
int ** offsets
for accelerated at() and add() methods.
Definition: sparse_matrix.h:66
ergo_real ** columns
Definition: sparse_matrix.h:65
static void
Definition: sparse_matrix.cc:279
Sparse matrix structure optimized for XC data access pattern.
Definition: sparse_matrix.h:56
virtual const char * what() const
Definition: sparse_matrix.h:61
Header file with typedefs for matrix and vector types.
const char * msg
Definition: sparse_matrix.h:58
~SparseMatrix()
Definition: sparse_matrix.h:80
void add(int row, int col, ergo_real val)
Adds given value to an element in given row and column.
Definition: sparse_matrix.h:102
Exception(const char *msg_)
Definition: sparse_matrix.h:60
void getrho_blocked_gga(int nbast, const real *dmat, const real *restrict gao, const int *nblocks, const int(*iblocks)[2], int ldaib, real *tmp, int nvclen, real *rho, real(*grad)[3])
Computes the expectation value <o|dmat|o'> and its derivatives for a symmetric matrix and given set of...
Definition: rho-mat.cc:187
int * cnt
for accelerated at() and add() methods.
Definition: sparse_matrix.h:68
int ** his
for accelerated at() and add() methods.
Definition: sparse_matrix.h:67