ergo
SparseMatrix Class Reference

Sparse matrix structure optimized for XC data access pattern. More...

#include <sparse_matrix.h>

Classes

class  Exception
 

Public Member Functions

 SparseMatrix (const SparsePattern &pattern_)
 Constructs a square matrix and preallocate according to the specified pattern. More...
 
 SparseMatrix (const SparsePattern &pattern_, const symmMatrix &m, const int *aoMap, std::vector< int > const &permutationHML)
 
 ~SparseMatrix ()
 
void print (const char *title) const
 
void addSymmetrizedTo (symmMatrix &sMat, const int *aoMap, std::vector< int > const &permutationHML) const
 Assigns itself to a given hierarchic matrix. More...
 
void add (int row, int col, ergo_real val)
 Adds given value to an element in given row and column. More...
 
ergo_real at (int row, int col) const
 

Private Member Functions

void createOffsets (const SparsePattern &pattern)
 Fills in offsets and his based on pattern. More...
 

Private Attributes

const SparsePatternpattern
 
ergo_real ** columns
 
int ** offsets
 for accelerated at() and add() methods. More...
 
int ** his
 for accelerated at() and add() methods. More...
 
int * cnt
 for accelerated at() and add() methods. More...
 
int n
 

Detailed Description

Sparse matrix structure optimized for XC data access pattern.

Constructor & Destructor Documentation

◆ SparseMatrix() [1/2]

SparseMatrix::SparseMatrix ( const SparsePattern pattern_)
explicit

Constructs a square matrix and preallocate according to the specified pattern.

References columns, createOffsets(), SparsePattern::getColumnSize(), n, and pattern.

◆ SparseMatrix() [2/2]

SparseMatrix::SparseMatrix ( const SparsePattern pattern_,
const symmMatrix m,
const int *  aoMap,
std::vector< int > const &  permutationHML 
)

◆ ~SparseMatrix()

SparseMatrix::~SparseMatrix ( )
inline

Member Function Documentation

◆ add()

void SparseMatrix::add ( int  row,
int  col,
ergo_real  val 
)
inline

Adds given value to an element in given row and column.

Checking against intervals.end() is terribly expensive!!! Luckily, we do not have to do it.

◆ addSymmetrizedTo()

void SparseMatrix::addSymmetrizedTo ( symmMatrix sMat,
const int *  aoMap,
std::vector< int > const &  permutationHML 
) const

Assigns itself to a given hierarchic matrix.

References SparsePattern::Column::begin(), columns, SparsePattern::Column::end(), n, and pattern.

Referenced by XCEvaluatorRestricted::getXC().

◆ at()

ergo_real SparseMatrix::at ( int  row,
int  col 
) const
inline

◆ createOffsets()

void SparseMatrix::createOffsets ( const SparsePattern pattern)
private

Fills in offsets and his based on pattern.

References cnt, his, n, offsets, and SparsePattern::size().

Referenced by SparseMatrix().

◆ print()

void SparseMatrix::print ( const char *  title) const

Member Data Documentation

◆ cnt

int* SparseMatrix::cnt
private

for accelerated at() and add() methods.

Referenced by createOffsets().

◆ columns

ergo_real** SparseMatrix::columns
private

◆ his

int** SparseMatrix::his
private

for accelerated at() and add() methods.

Referenced by createOffsets().

◆ n

int SparseMatrix::n
private

◆ offsets

int** SparseMatrix::offsets
private

for accelerated at() and add() methods.

Referenced by createOffsets().

◆ pattern

const SparsePattern& SparseMatrix::pattern
private

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