NTPoly
|
A datatype for storing a CSR matrix. More...
#include <SparseMatrix.h>
Public Member Functions | |
SparseMatrix (int columns, int rows) | |
SparseMatrix (std::string file_name) | |
SparseMatrix (const NTPoly::TripletList &list, int rows, int columns) | |
SparseMatrix (const NTPoly::SparseMatrix &matB) | |
int | GetRows () const |
Get the number of rows in a matrix. | |
int | GetColumns () const |
Get the number of columns in a matrix. | |
void | Scale (double constant) |
void | Increment (const NTPoly::SparseMatrix &matB, double alpha, double threshold) |
double | Dot (const NTPoly::SparseMatrix &matB) const |
void | PairwiseMultiply (const NTPoly::SparseMatrix &matA, const NTPoly::SparseMatrix &matB) |
void | Gemm (const NTPoly::SparseMatrix &matA, const NTPoly::SparseMatrix &matB, bool isATransposed, bool isBTransposed, double alpha, double beta, double threshold, NTPoly::MatrixMemoryPool &memory_pool) |
void | TransposeSparseMatrix (const NTPoly::SparseMatrix &matA) |
Transpose a sparse matrix. | |
void | Print () |
Print the sparse matrix to the console. | |
void | WriteToMatrixMarket (std::string file_name) |
void | MatrixToTripletList (NTPoly::TripletList &triplet_list) |
~SparseMatrix () | |
Standard destructor. | |
A datatype for storing a CSR matrix.
NTPoly::SparseMatrix::SparseMatrix | ( | int | columns, |
int | rows | ||
) |
Basic constructor.
columns | number of columns for the matrix. |
rows | number of rows for the matrix. |
NTPoly::SparseMatrix::SparseMatrix | ( | std::string | file_name | ) |
Construct from a matrix market file.
file_name | matrix market file name. |
NTPoly::SparseMatrix::SparseMatrix | ( | const NTPoly::TripletList & | list, |
int | rows, | ||
int | columns | ||
) |
Construct from a triplet list.
list | a list of triplet values to set in the matrix. |
columns | number of columns for the matrix. |
rows | number of rows for the matrix. |
NTPoly::SparseMatrix::SparseMatrix | ( | const NTPoly::SparseMatrix & | matB | ) |
Copy constructor.
matB | the matrix to copy from. |
double NTPoly::SparseMatrix::Dot | ( | const NTPoly::SparseMatrix & | matB | ) | const |
Matrix dot product.
matB | matrix to dot with. |
void NTPoly::SparseMatrix::Gemm | ( | const NTPoly::SparseMatrix & | matA, |
const NTPoly::SparseMatrix & | matB, | ||
bool | isATransposed, | ||
bool | isBTransposed, | ||
double | alpha, | ||
double | beta, | ||
double | threshold, | ||
NTPoly::MatrixMemoryPool & | memory_pool | ||
) |
This := alpha*matA*op( matB ) + beta*this
matA | |
matB | |
isATransposed | true if A is already transposed. |
isBTransposed | true if B is already transposed. |
alpha | scaling value. |
beta | scaling value. |
threshold | for flushing small values. |
memory_pool | a memory pool to use for storing intermediates. |
void NTPoly::SparseMatrix::Increment | ( | const NTPoly::SparseMatrix & | matB, |
double | alpha, | ||
double | threshold | ||
) |
This = alpha*MatrixB + This(AXPY).
matB | matrix to add. |
alpha | scale for the matrix. |
threshold | for flushing small values. |
void NTPoly::SparseMatrix::MatrixToTripletList | ( | NTPoly::TripletList & | triplet_list | ) |
Compute a triplet list from the entries in a matrix.
triplet_list | output. |
void NTPoly::SparseMatrix::PairwiseMultiply | ( | const NTPoly::SparseMatrix & | matA, |
const NTPoly::SparseMatrix & | matB | ||
) |
Pairwise multiply two sparse matrices.
matA | |
matB |
void NTPoly::SparseMatrix::Scale | ( | double | constant | ) |
Scale the matrix by a constant.
constant | value to scale by. |
void NTPoly::SparseMatrix::WriteToMatrixMarket | ( | std::string | file_name | ) |
Write the sparse matrix to file.
file_name | file to print to. |