HubbardGPU
Hubbard diagonalisation on the GPU (and CPU)
|
#include <SparseMatrix_CCS.h>
Public Member Functions | |
SparseMatrix_CCS (unsigned int n, unsigned int m) | |
SparseMatrix_CCS (const SparseMatrix_CCS &) | |
virtual | ~SparseMatrix_CCS () |
SparseMatrix_CCS & | operator= (const SparseMatrix_CCS &) |
double | operator() (unsigned int i, unsigned int j) const |
unsigned int | gn () const |
unsigned int | gm () const |
void | ConvertFromMatrix (const matrix &dense) |
void | ConvertToMatrix (matrix &dense) const |
void | PrintRaw () const |
void | PushToCol (unsigned int j, double value) |
void | NewCol () |
void | mvprod (const matrix &, matrix &) const |
unsigned int | NumOfElInCol (unsigned int idx) const |
double | GetElementInCol (unsigned int col_index, unsigned int element_index) const |
unsigned int | GetElementRowIndexInCol (unsigned int col_index, unsigned int element_index) const |
void | prod (const matrix &, const SparseMatrix_CCS &) |
Private Attributes | |
std::vector< double > | data |
Array that holds the non zero values. More... | |
std::vector< unsigned int > | col |
Array that holds the column indexes. More... | |
std::vector< unsigned int > | row |
Array that holds the row index of data. More... | |
unsigned int | n |
dimension of the matrix (number of rows) More... | |
unsigned int | m |
dimension of the matrix (number of columns) More... | |
Friends | |
ostream & | operator<< (ostream &output, SparseMatrix_CCS &matrix_p) |
Definition at line 35 of file SparseMatrix_CCS.h.
SparseMatrix_CCS::SparseMatrix_CCS | ( | unsigned int | n, |
unsigned int | m | ||
) |
Construct SparseMatrix_CCS object for n x m matrix
n | the number of rows |
m | the number of columns |
Definition at line 29 of file SparseMatrix_CCS.cpp.
SparseMatrix_CCS::SparseMatrix_CCS | ( | const SparseMatrix_CCS & | origin | ) |
Copy constructor
origin | the object to copy |
Definition at line 39 of file SparseMatrix_CCS.cpp.
|
virtual |
Definition at line 48 of file SparseMatrix_CCS.cpp.
void SparseMatrix_CCS::ConvertFromMatrix | ( | const matrix & | dense | ) |
Convert a dense matrix to CCS format
dense | the matrix to convert |
Definition at line 103 of file SparseMatrix_CCS.cpp.
void SparseMatrix_CCS::ConvertToMatrix | ( | matrix & | dense | ) | const |
Convert this CCS matrix to a dense matrix (only works for square matrices)
dense | the matrix to fill |
Definition at line 133 of file SparseMatrix_CCS.cpp.
double SparseMatrix_CCS::GetElementInCol | ( | unsigned int | col_index, |
unsigned int | element_index | ||
) | const |
Gives an element in from a column
col_index | the column from whiche to select an element |
element_index | the index of the element in column col_index |
Definition at line 252 of file SparseMatrix_CCS.cpp.
unsigned int SparseMatrix_CCS::GetElementRowIndexInCol | ( | unsigned int | col_index, |
unsigned int | element_index | ||
) | const |
Get the row index of a element in a certain column
col_index | the column index to use |
element_index | the index of the element |
Definition at line 265 of file SparseMatrix_CCS.cpp.
unsigned int SparseMatrix_CCS::gm | ( | ) | const |
Definition at line 78 of file SparseMatrix_CCS.cpp.
unsigned int SparseMatrix_CCS::gn | ( | ) | const |
Definition at line 70 of file SparseMatrix_CCS.cpp.
void SparseMatrix_CCS::NewCol | ( | ) |
Adds the next col to the sparsematrix
Definition at line 227 of file SparseMatrix_CCS.cpp.
unsigned int SparseMatrix_CCS::NumOfElInCol | ( | unsigned int | idx | ) | const |
Number of elements in a column
idx | the number of the column |
Definition at line 240 of file SparseMatrix_CCS.cpp.
double SparseMatrix_CCS::operator() | ( | unsigned int | i, |
unsigned int | j | ||
) | const |
Read only access operator
i | the row number |
j | the column number |
Definition at line 58 of file SparseMatrix_CCS.cpp.
SparseMatrix_CCS & SparseMatrix_CCS::operator= | ( | const SparseMatrix_CCS & | origin | ) |
Copy operator
origin | the object to copy |
Definition at line 88 of file SparseMatrix_CCS.cpp.
void SparseMatrix_CCS::PrintRaw | ( | ) | const |
Print the raw CCS data to stdout
Definition at line 149 of file SparseMatrix_CCS.cpp.
void SparseMatrix_CCS::prod | ( | const matrix & | A, |
const SparseMatrix_CCS & | B | ||
) |
Matrix-Matrix product of A and B: AB Stores the result in this object, destroying any matrix in it. The size is adjusted to the result of AB.
A | dense matrix |
B | sparse matrix |
Definition at line 279 of file SparseMatrix_CCS.cpp.
void SparseMatrix_CCS::PushToCol | ( | unsigned int | j, |
double | value | ||
) |
Adds a new row element to the current column. To use this, first call NewCol() to start a column and then use PushToCol() to add elements to that col. Always end with calling NewCol() again.
j | row |
value | the matrix element value |
Definition at line 191 of file SparseMatrix_CCS.cpp.
|
friend |
Output stream operator overloaded, the usage is simple, if you want to print to a file, make an ifstream object and type:
object << matrix << endl;
For output onto the screen type:
cout << matrix << endl;
output | The stream to which you are writing (e.g. cout) |
matrix_p | de SparseMatrix_CCS you want to print |
Print sparse matrix to output
output | the ostream to print to |
matrix_p | the matrix to print |
Definition at line 174 of file SparseMatrix_CCS.cpp.
|
private |
Array that holds the column indexes.
Definition at line 97 of file SparseMatrix_CCS.h.
|
private |
Array that holds the non zero values.
Definition at line 95 of file SparseMatrix_CCS.h.
|
private |
dimension of the matrix (number of columns)
Definition at line 104 of file SparseMatrix_CCS.h.
|
private |
dimension of the matrix (number of rows)
Definition at line 102 of file SparseMatrix_CCS.h.
|
private |
Array that holds the row index of data.
Definition at line 99 of file SparseMatrix_CCS.h.