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

A datatype for storing a CSR matrix. More...

#include <SMatrix.h>

Public Member Functions

 Matrix_lsr (int columns, int rows)
 
 Matrix_lsr (std::string file_name)
 
 Matrix_lsr (const NTPoly::TripletList_r &list, int rows, int columns)
 
 Matrix_lsr (const NTPoly::Matrix_lsr &matB)
 
int GetRows () const
 Get the number of rows in a matrix.
 
int GetColumns () const
 Get the number of columns in a matrix.
 
void ExtractRow (int row_number, Matrix_lsr &row_out) const
 
void ExtractColumn (int column_number, Matrix_lsr &column_out) const
 
void Scale (double constant)
 
void Increment (const NTPoly::Matrix_lsr &matB, double alpha, double threshold)
 
double Dot (const NTPoly::Matrix_lsr &matB) const
 
void PairwiseMultiply (const NTPoly::Matrix_lsr &matA, const NTPoly::Matrix_lsr &matB)
 
void Gemm (const NTPoly::Matrix_lsr &matA, const NTPoly::Matrix_lsr &matB, bool isATransposed, bool isBTransposed, double alpha, double beta, double threshold, NTPoly::MatrixMemoryPool_r &memory_pool)
 
void Transpose (const NTPoly::Matrix_lsr &matA)
 Transpose a sparse matrix.
 
void Print () const
 Print the sparse matrix to the console.
 
void WriteToMatrixMarket (std::string file_name) const
 
void MatrixToTripletList (NTPoly::TripletList_r &triplet_list) const
 
 ~Matrix_lsr ()
 Standard destructor.
 

Detailed Description

A datatype for storing a CSR matrix.

Constructor & Destructor Documentation

◆ Matrix_lsr() [1/4]

NTPoly::Matrix_lsr::Matrix_lsr ( int  columns,
int  rows 
)

Basic constructor.

Parameters
columnsnumber of columns for the matrix.
rowsnumber of rows for the matrix.

◆ Matrix_lsr() [2/4]

NTPoly::Matrix_lsr::Matrix_lsr ( std::string  file_name)

Construct from a matrix market file.

Parameters
file_namematrix market file name.

◆ Matrix_lsr() [3/4]

NTPoly::Matrix_lsr::Matrix_lsr ( const NTPoly::TripletList_r list,
int  rows,
int  columns 
)

Construct from a triplet list.

Parameters
lista list of triplet values to set in the matrix.
columnsnumber of columns for the matrix.
rowsnumber of rows for the matrix.

◆ Matrix_lsr() [4/4]

NTPoly::Matrix_lsr::Matrix_lsr ( const NTPoly::Matrix_lsr matB)

Copy constructor.

Parameters
matBthe matrix to copy from.

Member Function Documentation

◆ Dot()

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

Matrix dot product.

Parameters
matBmatrix to dot with.
Returns
the dot product of this and matB.

◆ ExtractColumn()

void NTPoly::Matrix_lsr::ExtractColumn ( int  column_number,
Matrix_lsr column_out 
) const

Extract a column from the matrix into the compressed vector representation

Parameters
column_numberthe column to extract
column_outthe matrix representing that column

◆ ExtractRow()

void NTPoly::Matrix_lsr::ExtractRow ( int  row_number,
Matrix_lsr row_out 
) const

Extract a row from the matrix into the compressed vector representation.

Parameters
row_numberthe row to extract
row_outthe matrix representing that row

◆ Gemm()

void NTPoly::Matrix_lsr::Gemm ( const NTPoly::Matrix_lsr matA,
const NTPoly::Matrix_lsr matB,
bool  isATransposed,
bool  isBTransposed,
double  alpha,
double  beta,
double  threshold,
NTPoly::MatrixMemoryPool_r memory_pool 
)

This := alpha*matA*op( matB ) + beta*this

Parameters
matA
matB
isATransposedtrue if A is already transposed.
isBTransposedtrue if B is already transposed.
alphascaling value.
betascaling value.
thresholdfor flushing small values.
memory_poola memory pool to use for storing intermediates.

◆ Increment()

void NTPoly::Matrix_lsr::Increment ( const NTPoly::Matrix_lsr matB,
double  alpha,
double  threshold 
)

This = alpha*MatrixB + This(AXPY).

Parameters
matBmatrix to add.
alphascale for the matrix.
thresholdfor flushing small values.

◆ MatrixToTripletList()

void NTPoly::Matrix_lsr::MatrixToTripletList ( NTPoly::TripletList_r triplet_list) const

Compute a triplet list from the entries in a matrix.

Parameters
triplet_listoutput.

◆ PairwiseMultiply()

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

Pairwise multiply two sparse matrices.

Parameters
matA
matB

◆ Scale()

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

Scale the matrix by a constant.

Parameters
constantvalue to scale by.

◆ WriteToMatrixMarket()

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

Write the sparse matrix to file.

Parameters
file_namefile to print to.

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