28 #if !defined(_SPARSE_MATRIX_H_)
29 #define _SPARSE_MATRIX_H_ 1
46 #if !defined(BEGIN_NAMESPACE)
47 #define BEGIN_NAMESPACE(x) namespace x {
48 #define END_NAMESPACE(x) }
59 virtual const char *
what()
const throw() {
return msg; }
76 std::vector<int>
const & permutationHML);
79 for(
int i=0; i<n; i++) {
80 delete [](columns[i]);
81 delete [](offsets[i]);
90 void print(
const char *title)
const;
95 std::vector<int>
const & permutationHML)
const;
102 const int *hi = his[col];
104 for(idx = 0; idx < cnt[col] && row >hi[idx]; ++idx);
107 throw Exception(
"SparseMatrix::add called with incorrect args");
108 int offset = offsets[col][idx];
112 columnData[row-offset] += val;
120 const ergo_real *columnData = columns[col];
121 const int *hi = his[col];
122 int idx;
for(idx = 0; idx < cnt[col] && row >hi[idx]; ++idx);
124 throw Exception(
"SparseMatrix::at called with incorrect args");
126 int offset = offsets[col][idx];
130 return columnData[row-offset];
140 const
int* nblocks, const
int (*iblocks)[2],
145 const
int* nblocks, const
int (*iblocks)[2],
double ergo_real
Definition: realtype.h:53
int n
Definition: sparse_matrix.h:67
#define END_NAMESPACE(x)
Definition: sparse_pattern.h:32
#define BEGIN_NAMESPACE(x)
Definition: sparse_pattern.h:31
A way to store sparse matrix patterns.
Definition: sparse_pattern.h:43
Definition: sparse_matrix.h:55
ergo_real at(int row, int col) const
Definition: sparse_matrix.h:119
const SparsePattern & pattern
Definition: sparse_matrix.h:62
int ** offsets
for accelerated at() and add() methods.
Definition: sparse_matrix.h:64
ergo_real ** columns
Definition: sparse_matrix.h:63
Sparse matrix structure optimized for XC data access pattern.
Definition: sparse_matrix.h:54
void getrho_blocked_lda(int nbast, const Dft::SparseMatrix &dmat, const ergo_real *gao, const int *nblocks, const int(*iblocks)[2], int ldaib, ergo_real *tmp, int nvclen, ergo_real *rho)
Definition: sparse_matrix.cc:288
virtual const char * what() const
Definition: sparse_matrix.h:59
Header file with typedefs for matrix and vector types.
const char * msg
Definition: sparse_matrix.h:56
~SparseMatrix()
Definition: sparse_matrix.h:78
void add(int row, int col, ergo_real val)
Adds given value to an element in given row and column.
Definition: sparse_matrix.h:100
Exception(const char *msg_)
Definition: sparse_matrix.h:58
int * cnt
for accelerated at() and add() methods.
Definition: sparse_matrix.h:66
void getrho_blocked_gga(int nbast, const Dft::SparseMatrix &dmat, const ergo_real *gao, const int *nblocks, const int(*iblocks)[2], int ldaib, ergo_real *tmp, int nvclen, ergo_real *rho, ergo_real(*grad)[3])
Definition: sparse_matrix.cc:334
int ** his
for accelerated at() and add() methods.
Definition: sparse_matrix.h:65
Definition: grid_matrix.h:32