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++) {
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;
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],
Code for setting up basis functions starting from shells.
Definition sparse_matrix.h:57
const char * msg
Definition sparse_matrix.h:58
Exception(const char *msg_)
Definition sparse_matrix.h:60
virtual const char * what() const
Definition sparse_matrix.h:61
ergo_real ** columns
Definition sparse_matrix.h:65
ergo_real at(int row, int col) const
Definition sparse_matrix.h:121
int n
Definition sparse_matrix.h:69
SparseMatrix(const SparsePattern &pattern_)
Constructs a square matrix and preallocate according to the specified pattern.
Definition sparse_matrix.cc:134
~SparseMatrix()
Definition sparse_matrix.h:80
int * cnt
for accelerated at() and add() methods.
Definition sparse_matrix.h:68
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
const SparsePattern & pattern
Definition sparse_matrix.h:64
int ** offsets
for accelerated at() and add() methods.
Definition sparse_matrix.h:66
int ** his
for accelerated at() and add() methods.
Definition sparse_matrix.h:67
void createOffsets(const SparsePattern &pattern)
Fills in offsets and his based on pattern.
Definition sparse_matrix.cc:189
A way to store sparse matrix patterns.
Definition sparse_pattern.h:53
Header file with typedefs for matrix and vector types.
Definition grid_matrix.h:42
Definition of the main floating-point datatype used; the ergo_real type.
double ergo_real
Definition realtype.h:69
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:336
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:290
Class that can be used to store sparse matrix patterns.
#define END_NAMESPACE(x)
Definition sparse_pattern.h:42
#define BEGIN_NAMESPACE(x)
Definition sparse_pattern.h:41
MatrixSymmetric< real, matri > symmMatrix
Definition test_LanczosSeveralLargestEig.cc:69