NTPoly
Public Member Functions | Friends | List of all members
NTPoly::DistributedSparseMatrix Class Reference

A Module For Performing Distributed Sparse Matrix Operations. More...

#include <DistributedSparseMatrix.h>

Public Member Functions

 DistributedSparseMatrix (int matrix_dimension)
 
 DistributedSparseMatrix (std::string file_name, bool is_binary=false)
 
 DistributedSparseMatrix (const DistributedSparseMatrix &matB)
 
void WriteToBinary (std::string file_name) const
 
void WriteToMatrixMarket (std::string file_name) const
 
void FillFromTripletList (const TripletList &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.
 
void GetTripletList (TripletList &triplet_list)
 
void GetMatrixBlock (TripletList &triplet_list, int start_row, int end_row, int start_column, int end_column)
 
void Transpose (const NTPoly::DistributedSparseMatrix &matA)
 Transpose a sparse matrix.
 
double Dot (const DistributedSparseMatrix &matB)
 
void Increment (const DistributedSparseMatrix &matB, double alpha=1.0, double threshold=0.0)
 
void PairwiseMultiply (const DistributedSparseMatrix &matA, const DistributedSparseMatrix &matB)
 Elementwise multiplication. C_ij = A_ij * B_ij. Also known as a Hadamard. More...
 
void Gemm (const DistributedSparseMatrix &matA, const DistributedSparseMatrix &matB, DistributedMatrixMemoryPool &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.
 
 ~DistributedSparseMatrix ()
 Destructor.
 

Friends

class LoadBalancer
 
class SolverBase
 
class TripletList
 

Detailed Description

A Module For Performing Distributed Sparse Matrix Operations.

Constructor & Destructor Documentation

◆ DistributedSparseMatrix() [1/3]

NTPoly::DistributedSparseMatrix::DistributedSparseMatrix ( int  matrix_dimension)

Construct an empty matrix.

Parameters
matrix_dimensionsize fo the matrix.

◆ DistributedSparseMatrix() [2/3]

NTPoly::DistributedSparseMatrix::DistributedSparseMatrix ( std::string  file_name,
bool  is_binary = false 
)

Construct a matrix from file.

Parameters
file_namename of the file to build from.
is_binarytrue if the file is a binary file.

◆ DistributedSparseMatrix() [3/3]

NTPoly::DistributedSparseMatrix::DistributedSparseMatrix ( const DistributedSparseMatrix matB)

Copy constructor.

Parameters
matBmatrix to opy from.

Member Function Documentation

◆ Dot()

double NTPoly::DistributedSparseMatrix::Dot ( const DistributedSparseMatrix matB)

this = dot(this,matB)

Parameters
matBthe matrix to dot.

◆ FillDistributedPermutation()

void NTPoly::DistributedSparseMatrix::FillDistributedPermutation ( const Permutation lb,
bool  permuterows = true 
)

Fill the matrix based on a permutation.

Parameters
lbthe permutation.
permuterowstrue if this is a row permutation matrix.

◆ FillFromTripletList()

void NTPoly::DistributedSparseMatrix::FillFromTripletList ( const TripletList triplet_list)

Fill in the matrix based on the contents of triplet lists.

Parameters
triplet_listlist of values. Need to be absolute coordinates.

◆ Gemm()

void NTPoly::DistributedSparseMatrix::Gemm ( const DistributedSparseMatrix matA,
const DistributedSparseMatrix matB,
DistributedMatrixMemoryPool memory_pool,
double  alpha = 1.0,
double  beta = 0.0,
double  threshold = 0.0 
)

this := alpha*matA*matB+ beta*this (GEMM)

Parameters
matAfirst mat.
matBsecond mat.
memory_poolmemory pool for intermediates.
alphascaling factor.
betascaling factor.
thresholdfor flushing small values.

◆ GetMatrixBlock()

void NTPoly::DistributedSparseMatrix::GetMatrixBlock ( TripletList 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.

Parameters
triplet_listthe list to fill.
start_rowthe starting row for data to store on this process.
end_rowthe ending row for data to store on this process.
start_columnthe starting col for data to store on this process
end_columnthe ending col for data to store on this process

◆ GetTripletList()

void NTPoly::DistributedSparseMatrix::GetTripletList ( TripletList triplet_list)

Extracts a triplet list of the data that is stored on this process. Data is returned with absolute coordinates.

Parameters
triplet_listthe list to fill.

◆ Increment()

void NTPoly::DistributedSparseMatrix::Increment ( const DistributedSparseMatrix matB,
double  alpha = 1.0,
double  threshold = 0.0 
)

this = alpha*MatB + this (AXPY)

Parameters
matBthe matrix to add.
alphascaling factor.
thresholdfor flushing small values.

◆ PairwiseMultiply()

void NTPoly::DistributedSparseMatrix::PairwiseMultiply ( const DistributedSparseMatrix matA,
const DistributedSparseMatrix matB 
)

Elementwise multiplication. C_ij = A_ij * B_ij. Also known as a Hadamard.

Parameters
matAfirst mat.
matBsecond mat.

◆ Scale()

void NTPoly::DistributedSparseMatrix::Scale ( double  constant)

scale the matrix by a constatn. constant the value to scale by.

◆ WriteToBinary()

void NTPoly::DistributedSparseMatrix::WriteToBinary ( std::string  file_name) const

Write the matrix to a custom binary format.

Parameters
file_namefile to write to.

◆ WriteToMatrixMarket()

void NTPoly::DistributedSparseMatrix::WriteToMatrixMarket ( std::string  file_name) const

Write the matrix to the matrix market format.

Parameters
file_namefile to write to.

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