SparseLibrary
Version 1.6.0
|
The triplet scheme; a storage scheme for sparse matrices using triplets. More...
#include <TS.hpp>
Public Member Functions | |
TS () | |
Base constructor. More... | |
TS (std::string file, T zero=0) | |
Base constructor. More... | |
TS (std::vector< Triplet< T > > &input, ULI m, ULI n, T zero=0) | |
Base constructor. More... | |
virtual void | load (std::vector< Triplet< T > > &input, const ULI m, const ULI n, const T zero) |
virtual void | getFirstIndexPair (ULI &row, ULI &col) |
Returns the first nonzero index, per reference. More... | |
virtual void | zxa (const T *x, T *z) |
In-place z=xA calculation algorithm. More... | |
virtual void | zax (const T *x, T *z) |
In-place z=Ax calculation algorithm. More... | |
template<size_t k> | |
void | ZaX (const T *__restrict__ const *__restrict__ const X, T *__restrict__ const *__restrict__ const Z) |
template<size_t k> | |
void | ZXa (const T *__restrict__ const *__restrict__ const X, T *__restrict__ const *__restrict__ const Z) |
virtual size_t | bytesUsed () |
~TS () | |
Base destructor. More... | |
Public Member Functions inherited from SparseMatrix< T, ULI > | |
SparseMatrix () | |
Base constructor. More... | |
SparseMatrix (const ULInzs, const ULInr, const ULInc, const T zero) | |
Base constructor. More... | |
virtual | ~SparseMatrix () |
Base deconstructor. More... | |
void | loadFromFile (const std::string file, const T zero=0) |
Function which loads a matrix from a matrix market file. More... | |
virtual unsigned long int | m () |
Queries the number of rows this matrix contains. More... | |
virtual unsigned long int | n () |
Queries the number of columns this matrix contains. More... | |
virtual unsigned long int | nzs () |
Queries the number of nonzeroes stored in this matrix. More... | |
virtual T * | mv (const T *x) |
Calculates and returns z=Ax. More... | |
virtual void | zax (const T *__restrict__ x, T *__restrict__ z)=0 |
In-place z=Ax function. More... | |
virtual void | zxa (const T *__restrict__ x, T *__restrict__ z)=0 |
In-place z=xA function. More... | |
Public Member Functions inherited from Matrix< T > | |
Matrix () | |
Base constructor. More... | |
virtual | ~Matrix () |
Base deconstructor. More... | |
virtual void | zax (const T *__restrict__ x, T *__restrict__ z, const size_t k, const clockid_t clock_id=0, double *elapsed_time=NULL) |
Wrapper function to call the zax kernel multiple times successively, while timing the duration of the operation. More... | |
template<size_t k> | |
void | ZaX (const T *__restrict__ const *__restrict__ const X, T *__restrict__ const *__restrict__ const Z) |
In-place Z=AX function, where A is m x n, Z = m x k, and X is n x k. More... | |
template<size_t k> | |
void | ZXa (const T *__restrict__ const *__restrict__ const X, T *__restrict__ const *__restrict__ const Z) |
In-place Z=XA function, where A is m x n, Z = k x n, and X is k x m. More... | |
virtual void | zxa (const T *__restrict__ x, T *__restrict__ z, const unsigned long int repeat, const clockid_t clock_id=0, double *elapsed_time=NULL) |
Wrapper function to call the zxa kernel multiple times successively, while timing the operation duration. More... | |
Protected Attributes | |
ULI * | i |
The row indices of the nonzeros. More... | |
ULI * | j |
The column indices of the nonzeros. More... | |
T * | ds |
The values of the nonzeros. More... | |
Protected Attributes inherited from SparseMatrix< T, ULI > | |
ULI | nor |
Number of rows. More... | |
ULI | noc |
Number of columns. | |
ULI | nnz |
Number of non-zeros. More... | |
Additional Inherited Members | |
Public Attributes inherited from SparseMatrix< T, ULI > | |
T | zero_element |
The element considered to be zero. More... | |
The triplet scheme; a storage scheme for sparse matrices using triplets.
Base constructor.
Will read in from Matrix Market file.
References SparseMatrix< T, ULI >::loadFromFile().
|
inline |
Base constructor.
input | std::vector of triplets to be stored in this scheme. |
m | total number of rows. |
n | total number of columns. |
zero | what is to be considered the zero element. |
References TS< T >::load().
Base destructor.
References TS< T >::ds, TS< T >::i, and TS< T >::j.
|
inlinevirtual |
|
inlinevirtual |
Returns the first nonzero index, per reference.
Implements SparseMatrix< T, ULI >.
References TS< T >::i, and TS< T >::j.
|
inlinevirtual |
Implements SparseMatrix< T, ULI >.
References TS< T >::ds, TS< T >::i, TS< T >::j, SparseMatrix< T, ULI >::m(), SparseMatrix< T, ULI >::n(), SparseMatrix< T, ULI >::nnz, SparseMatrix< T, ULI >::noc, SparseMatrix< T, ULI >::nor, and SparseMatrix< T, ULI >::zero_element.
Referenced by TS< T >::TS().
|
inlinevirtual |
In-place z=Ax calculation algorithm.
x | The vector x supplied for calculation of Ax. |
z | The result vector z. Should be pre-allocated with entries set to zero. |
References TS< T >::ds, TS< T >::i, TS< T >::j, SparseMatrix< T, ULI >::nnz, SparseMatrix< T, ULI >::noc, and SparseMatrix< T, ULI >::nor.
|
inline |
References TS< T >::ds, TS< T >::i, TS< T >::j, SparseMatrix< T, ULI >::nnz, SparseMatrix< T, ULI >::noc, and SparseMatrix< T, ULI >::nor.
|
inlinevirtual |
In-place z=xA calculation algorithm.
x | The vector x supplied for calculation of xA. |
z | The result vector z. Should be pre-allocated with entries set to zero. |
References TS< T >::ds, TS< T >::i, TS< T >::j, SparseMatrix< T, ULI >::nnz, SparseMatrix< T, ULI >::noc, and SparseMatrix< T, ULI >::nor.
|
inline |
References TS< T >::ds, TS< T >::i, TS< T >::j, SparseMatrix< T, ULI >::nnz, SparseMatrix< T, ULI >::noc, and SparseMatrix< T, ULI >::nor.
|
protected |
The values of the nonzeros.
Referenced by TS< T >::load(), TS< T >::zax(), TS< T >::ZaX(), TS< T >::zxa(), TS< T >::ZXa(), and TS< T >::~TS().
|
protected |
The row indices of the nonzeros.
Referenced by TS< T >::getFirstIndexPair(), TS< T >::load(), TS< T >::zax(), TS< T >::ZaX(), TS< T >::zxa(), TS< T >::ZXa(), and TS< T >::~TS().
|
protected |
The column indices of the nonzeros.
Referenced by TS< T >::getFirstIndexPair(), TS< T >::load(), TS< T >::zax(), TS< T >::ZaX(), TS< T >::zxa(), TS< T >::ZXa(), and TS< T >::~TS().