NTPoly
|
A Module For Performing Distributed Sparse Matrix Operations. More...
#include <PSMatrix.h>
Public Member Functions | |
Matrix_ps (int matrix_dimension) | |
Matrix_ps (int matrix_dimension, const ProcessGrid &grid) | |
Matrix_ps (std::string file_name, bool is_binary=false) | |
Matrix_ps (std::string file_name, const ProcessGrid &grid, bool is_binary=false) | |
Matrix_ps (const Matrix_ps &matB) | |
void | WriteToBinary (std::string file_name) const |
void | WriteToMatrixMarket (std::string file_name) const |
void | FillFromTripletList (const TripletList_r &triplet_list) |
void | FillFromTripletList (const TripletList_c &triplet_list) |
void | FillDistributedPermutation (const Permutation &lb, bool permuterows=true) |
void | FillIdentity () |
Fills this matrix as the identity matrix. | |
int | GetActualDimension () const |
get the actual dimension of the matrix. | |
int | GetLogicalDimension () const |
the logical dimension is scaled so each process has an even slice. | |
long int | GetSize () const |
Get the total number of non-zero entries in the matrix. | |
void | GetTripletList (TripletList_r &triplet_list) const |
void | GetTripletList (TripletList_c &triplet_list) const |
void | GetMatrixBlock (TripletList_r &triplet_list, int start_row, int end_row, int start_column, int end_column) |
void | GetMatrixBlock (TripletList_c &triplet_list, int start_row, int end_row, int start_column, int end_column) |
void | GetMatrixSlice (Matrix_ps &submatrix, int start_row, int end_row, int start_column, int end_column) |
void | Transpose (const NTPoly::Matrix_ps &matA) |
Transpose a sparse matrix. | |
void | Conjugate () |
Compute the complex conjugate of a matrix. | |
void | Resize (int new_size) |
double | Dot (const Matrix_ps &matB) |
std::complex< double > | Dot_c (const Matrix_ps &matB) |
void | Increment (const Matrix_ps &matB, double alpha=1.0, double threshold=0.0) |
void | PairwiseMultiply (const Matrix_ps &matA, const Matrix_ps &matB) |
Elementwise multiplication. C_ij = A_ij * B_ij. Also known as a Hadamard. More... | |
void | Gemm (const Matrix_ps &matA, const Matrix_ps &matB, PMatrixMemoryPool &memory_pool, double alpha=1.0, double beta=0.0, double threshold=0.0) |
void | Scale (double constant) |
double | Norm () const |
compute the norm of a matrix. | |
double | Trace () const |
compute the trace of a matrix. | |
~Matrix_ps () | |
Destructor. | |
Friends | |
class | LoadBalancer |
class | SolverBase |
template<class T > | |
class | TripletList |
class | PMatrixMemoryPool |
class | MatrixMapper |
class | MatrixConversion |
A Module For Performing Distributed Sparse Matrix Operations.
NTPoly::Matrix_ps::Matrix_ps | ( | int | matrix_dimension | ) |
Construct an empty matrix.
matrix_dimension | size fo the matrix. |
NTPoly::Matrix_ps::Matrix_ps | ( | int | matrix_dimension, |
const ProcessGrid & | grid | ||
) |
Construct an empty matrix.
matrix_dimension | size fo the matrix. |
grid | the process grid this matrix is distributed on. |
NTPoly::Matrix_ps::Matrix_ps | ( | std::string | file_name, |
bool | is_binary = false |
||
) |
Construct a matrix from file.
file_name | name of the file to build from. |
is_binary | true if the file is a binary file. |
NTPoly::Matrix_ps::Matrix_ps | ( | std::string | file_name, |
const ProcessGrid & | grid, | ||
bool | is_binary = false |
||
) |
Construct a matrix from file.
file_name | name of the file to build from. |
is_binary | true if the file is a binary file. |
grid | the process grid this matrix is distributed on. |
NTPoly::Matrix_ps::Matrix_ps | ( | const Matrix_ps & | matB | ) |
Copy constructor.
matB | matrix to copy from. |
double NTPoly::Matrix_ps::Dot | ( | const Matrix_ps & | matB | ) |
this = dot(this,matB)
matB | the matrix to dot. |
complex< double > NTPoly::Matrix_ps::Dot_c | ( | const Matrix_ps & | matB | ) |
this = dot(this,matB)
matB | the matrix to dot. |
void NTPoly::Matrix_ps::FillDistributedPermutation | ( | const Permutation & | lb, |
bool | permuterows = true |
||
) |
Fill the matrix based on a permutation.
lb | the permutation. |
permuterows | true if this is a row permutation matrix. |
void NTPoly::Matrix_ps::FillFromTripletList | ( | const TripletList_c & | triplet_list | ) |
Fill in the matrix based on the contents of triplet lists.
triplet_list | list of values. Need to be absolute coordinates. |
void NTPoly::Matrix_ps::FillFromTripletList | ( | const TripletList_r & | triplet_list | ) |
Fill in the matrix based on the contents of triplet lists.
triplet_list | list of values. Need to be absolute coordinates. |
void NTPoly::Matrix_ps::Gemm | ( | const Matrix_ps & | matA, |
const Matrix_ps & | matB, | ||
PMatrixMemoryPool & | memory_pool, | ||
double | alpha = 1.0 , |
||
double | beta = 0.0 , |
||
double | threshold = 0.0 |
||
) |
this := alpha*matA*matB+ beta*this (GEMM)
matA | first mat. |
matB | second mat. |
memory_pool | memory pool for intermediates. |
alpha | scaling factor. |
beta | scaling factor. |
threshold | for flushing small values. |
void NTPoly::Matrix_ps::GetMatrixBlock | ( | TripletList_c & | triplet_list, |
int | start_row, | ||
int | end_row, | ||
int | start_column, | ||
int | end_column | ||
) |
Extract an arbitrary block of a matrix into a triplet list. Block is defined by the row/column start/end values. This is slower than GetTripletList, because communication is required. Data is returned with absolute coordinates.
triplet_list | the list to fill. |
start_row | the starting row for data to store on this process. |
end_row | the ending row for data to store on this process. |
start_column | the starting col for data to store on this process |
end_column | the ending col for data to store on this process |
void NTPoly::Matrix_ps::GetMatrixBlock | ( | TripletList_r & | triplet_list, |
int | start_row, | ||
int | end_row, | ||
int | start_column, | ||
int | end_column | ||
) |
Extract an arbitrary block of a matrix into a triplet list. Block is defined by the row/column start/end values. This is slower than GetTripletList, because communication is required. Data is returned with absolute coordinates.
triplet_list | the list to fill. |
start_row | the starting row for data to store on this process. |
end_row | the ending row for data to store on this process. |
start_column | the starting col for data to store on this process |
end_column | the ending col for data to store on this process |
void NTPoly::Matrix_ps::GetMatrixSlice | ( | Matrix_ps & | submatrix, |
int | start_row, | ||
int | end_row, | ||
int | start_column, | ||
int | end_column | ||
) |
Copy an arbitrary slice from a matrix into a new smaller matrix. NTPoly only works with square matrices, so if the number of rows and columns is different the matrix is resized to the maximum size.
submatrix | the slice to fill. |
start_row | the starting row to include in this matrix. |
end_row | the ending row to include in this matrix. |
start_column | the starting column to include in this matrix. |
end_column | the last column to include in this matrix. |
void NTPoly::Matrix_ps::GetTripletList | ( | TripletList_c & | triplet_list | ) | const |
Extracts a triplet list of the data that is stored on this process. Data is returned with absolute coordinates.
triplet_list | the list to fill. |
void NTPoly::Matrix_ps::GetTripletList | ( | TripletList_r & | triplet_list | ) | const |
Extracts a triplet list of the data that is stored on this process. Data is returned with absolute coordinates.
triplet_list | the list to fill. |
void NTPoly::Matrix_ps::Increment | ( | const Matrix_ps & | matB, |
double | alpha = 1.0 , |
||
double | threshold = 0.0 |
||
) |
this = alpha*MatB + this (AXPY)
matB | the matrix to add. |
alpha | scaling factor. |
threshold | for flushing small values. |
Elementwise multiplication. C_ij = A_ij * B_ij. Also known as a Hadamard.
matA | first mat. |
matB | second mat. |
void NTPoly::Matrix_ps::Resize | ( | int | new_size | ) |
Change the size of a matrix. If the new size is smaller, then values outside that range are deleted. IF the new size is bigger, zero padding is applied. Warning: this requires a full data redistribution.
void NTPoly::Matrix_ps::Scale | ( | double | constant | ) |
scale the matrix by a constatn. constant the value to scale by.
void NTPoly::Matrix_ps::WriteToBinary | ( | std::string | file_name | ) | const |
Write the matrix to a custom binary format.
file_name | file to write to. |
void NTPoly::Matrix_ps::WriteToMatrixMarket | ( | std::string | file_name | ) | const |
Write the matrix to the matrix market format.
file_name | file to write to. |