TBTK
TBTK::SparseMatrix< DataType > Class Template Reference

Public Types

enum  StorageFormat { CSR, CSC }
 

Public Member Functions

 SparseMatrix (StorageFormat)
 
 SparseMatrix (const SparseMatrix &sparseMatrix)
 
 SparseMatrix (SparseMatrix &&sparseMatrix)
 
 SparseMatrix (StorageFormat storageFormat, unsigned int numRows, unsigned int numCols)
 
SparseMatrixoperator= (const SparseMatrix &sparseMatrix)
 
SparseMatrixoperator= (SparseMatrix &&sparseMatrix)
 
 ~SparseMatrix ()
 
void add (unsigned int row, unsigned int col, const DataType &value)
 
void setStorageFormat (StorageFormat storageFormat)
 
unsigned int getNumRows () const
 
unsigned int getNumColumns () const
 
unsigned int getCSRNumMatrixElements () const
 
unsigned int getCSCNumMatrixElements () const
 
const unsigned int * getCSRRowPointers () const
 
const unsigned int * getCSCColumnPointers () const
 
const unsigned int * getCSRColumns () const
 
const unsigned int * getCSCRows () const
 
const DataType * getCSRValues () const
 
const DataType * getCSCValues () const
 
void print () const
 
std::vector< std::vector< std::tuple< unsigned int, DataType > > > constructLIL ()
 
void sortLIL (std::vector< std::vector< std::tuple< unsigned int, DataType >> > &listOfLists) const
 
void mergeLIL (std::vector< std::vector< std::tuple< unsigned int, DataType >> > &listOfLists) const
 
void constructCSX ()
 
void convertCSXToLIL ()
 

Member Enumeration Documentation

template<typename DataType>
enum TBTK::SparseMatrix::StorageFormat
strong

Enum class for determining the storage format.

Constructor & Destructor Documentation

template<typename DataType >
TBTK::SparseMatrix< DataType >::SparseMatrix ( StorageFormat  storageFormat)
inline

Constructor.

template<typename DataType >
TBTK::SparseMatrix< DataType >::SparseMatrix ( const SparseMatrix< DataType > &  sparseMatrix)
inline

Copy constructor.

template<typename DataType >
TBTK::SparseMatrix< DataType >::SparseMatrix ( SparseMatrix< DataType > &&  sparseMatrix)
inline

Copy constructor.

template<typename DataType >
TBTK::SparseMatrix< DataType >::SparseMatrix ( StorageFormat  storageFormat,
unsigned int  numRows,
unsigned int  numCols 
)
inline

Constructor.

template<typename DataType >
TBTK::SparseMatrix< DataType >::~SparseMatrix ( )
inline

Destructor.

Member Function Documentation

template<typename DataType >
void TBTK::SparseMatrix< DataType >::add ( unsigned int  row,
unsigned int  col,
const DataType &  value 
)
inline

Add matrix element.

template<typename DataType >
void TBTK::SparseMatrix< DataType >::constructCSX ( )
inline

Construct matrix on compressed sparse row format (CSR).

template<typename DataType>
std::vector< std::vector<std::tuple<unsigned int, DataType> > > TBTK::SparseMatrix< DataType >::constructLIL ( )

Construct list of lists (LIL) from dictionaryOfKeys.

template<typename DataType >
void TBTK::SparseMatrix< DataType >::convertCSXToLIL ( )
inline

Adds all matrix elements constructed on CSR/CSC format to LIL. Used when a matrix is reconstructed either because new elements has been added, or because the format of the matrix is being changed.

template<typename DataType >
const unsigned int * TBTK::SparseMatrix< DataType >::getCSCColumnPointers ( ) const
inline

Get CSC column pointers.

template<typename DataType >
unsigned int TBTK::SparseMatrix< DataType >::getCSCNumMatrixElements ( ) const
inline

Get number of CSC matrix elements.

template<typename DataType >
const unsigned int * TBTK::SparseMatrix< DataType >::getCSCRows ( ) const
inline

Get CSC columns.

template<typename DataType >
const DataType * TBTK::SparseMatrix< DataType >::getCSCValues ( ) const
inline

Get CSC values.

template<typename DataType >
const unsigned int * TBTK::SparseMatrix< DataType >::getCSRColumns ( ) const
inline

Get CSR columns.

template<typename DataType >
unsigned int TBTK::SparseMatrix< DataType >::getCSRNumMatrixElements ( ) const
inline

Get number of CSR matrix elements.

template<typename DataType >
const unsigned int * TBTK::SparseMatrix< DataType >::getCSRRowPointers ( ) const
inline

Get CSR row pointers.

template<typename DataType >
const DataType * TBTK::SparseMatrix< DataType >::getCSRValues ( ) const
inline

Get CSR values.

template<typename DataType >
unsigned int TBTK::SparseMatrix< DataType >::getNumColumns ( ) const
inline

Get number of columns.

template<typename DataType >
unsigned int TBTK::SparseMatrix< DataType >::getNumRows ( ) const
inline

Get number of rows.

template<typename DataType >
void TBTK::SparseMatrix< DataType >::mergeLIL ( std::vector< std::vector< std::tuple< unsigned int, DataType >> > &  listOfLists) const
inline

Merge list of lists (LIL) entries with the same row and column indices.

template<typename DataType >
SparseMatrix< DataType > & TBTK::SparseMatrix< DataType >::operator= ( const SparseMatrix< DataType > &  sparseMatrix)
inline

Assignment operator.

template<typename DataType >
SparseMatrix< DataType > & TBTK::SparseMatrix< DataType >::operator= ( SparseMatrix< DataType > &&  sparseMatrix)
inline

Move assignment operator.

template<typename DataType >
void TBTK::SparseMatrix< DataType >::print ( ) const
inline

Print.

template<typename DataType >
void TBTK::SparseMatrix< DataType >::setStorageFormat ( StorageFormat  storageFormat)
inline

Set StorageFormat.

template<typename DataType >
void TBTK::SparseMatrix< DataType >::sortLIL ( std::vector< std::vector< std::tuple< unsigned int, DataType >> > &  listOfLists) const
inline

Sort list of lists (LIL).


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