|
SparseLibrary
Version 1.6.0
|
The dense diagonal matrix scheme; a storage scheme for sparse matrices consisting of only dense diagonals. More...
#include <DD_MATRIX.hpp>


Public Member Functions | |
| DD_MATRIX () | |
| Base constructor. More... | |
| DD_MATRIX (std::string file, T zero=0) | |
| Base constructor. More... | |
| DD_MATRIX (std::vector< Triplet< T > > &input, ULI m, ULI n, T zero) | |
| Base constructor. More... | |
| DD_MATRIX (T **nonzeroes, ULI m, ULI n, T zero) | |
| Dense diagonal matrix specific constructor. More... | |
| virtual void | load (std::vector< Triplet< T > > &input, const ULI m, const ULI n, const T zero) |
| virtual void | getFirstIndexPair (unsigned long int &row, unsigned long int &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... | |
| size_t | bytesUsed () |
| ~DD_MATRIX () | |
| Base destructor. More... | |
Public Member Functions inherited from SparseMatrix< T, unsigned long int > | |
| SparseMatrix () | |
| Base constructor. More... | |
| SparseMatrix (const unsigned long intnzs, const unsigned long intnr, const unsigned long intnc, 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 | |
| T ** | nzs |
| The values of the nonzeros. More... | |
| ULI | full |
| How many full length diagonals this (possible not square matrix) contains. More... | |
| ULI | d |
| What the main diagonal length is (longest diagonal). More... | |
| bool | SELF_ALLOCATED |
| Whether or not nzs was allocated by this instance itself. More... | |
| size_t | bytes |
| Keeps track of the number of bytes spent for this matrix. More... | |
Protected Attributes inherited from SparseMatrix< T, unsigned long int > | |
| unsigned long int | nor |
| Number of rows. More... | |
| unsigned long int | noc |
| Number of columns. | |
| unsigned long int | nnz |
| Number of non-zeros. More... | |
Additional Inherited Members | |
Public Attributes inherited from SparseMatrix< T, unsigned long int > | |
| T | zero_element |
| The element considered to be zero. More... | |
The dense diagonal matrix scheme; a storage scheme for sparse matrices consisting of only dense diagonals.
| T | type of numerical values to store in the matrix (int, unsigned int, float, double, ...) |
| number_of_diagonals | number of (assumed) dense diagonals in the matrix |
| diagonal_offsets | must be defined global in calling code, so that it is ensured constant at compiletime (necessary when template is used) |
|
inline |
Base constructor.
References DD_MATRIX< T, number_of_diagonals, diagonal_offsets >::load().
|
inline |
Base constructor.
Will read in from Matrix Market file.
References SparseMatrix< T, unsigned long int >::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 DD_MATRIX< T, number_of_diagonals, diagonal_offsets >::load().
|
inline |
Dense diagonal matrix specific constructor.
| nonzeroes | The to this matrix belonging k times max(m,n) dense matrix representation. |
| m | Number of matrix rows. |
| n | Number of matrix columns. |
| zero | What is considered to be the zero element. |
References DD_MATRIX< T, number_of_diagonals, diagonal_offsets >::bytes, DD_MATRIX< T, number_of_diagonals, diagonal_offsets >::d, DD_MATRIX< T, number_of_diagonals, diagonal_offsets >::full, SparseMatrix< T, unsigned long int >::m(), SparseMatrix< T, unsigned long int >::n(), SparseMatrix< T, unsigned long int >::nnz, SparseMatrix< T, unsigned long int >::noc, SparseMatrix< T, unsigned long int >::nor, SparseMatrix< T, unsigned long int >::nzs(), DD_MATRIX< T, number_of_diagonals, diagonal_offsets >::SELF_ALLOCATED, and SparseMatrix< T, unsigned long int >::zero_element.
|
inline |
Base destructor.
References SparseMatrix< T, unsigned long int >::nzs(), and DD_MATRIX< T, number_of_diagonals, diagonal_offsets >::SELF_ALLOCATED.
|
inlinevirtual |
Implements Matrix< T >.
References DD_MATRIX< T, number_of_diagonals, diagonal_offsets >::bytes.
|
inlinevirtual |
Returns the first nonzero index, per reference.
Implements SparseMatrix< T, unsigned long int >.
|
inlinevirtual |
Implements SparseMatrix< T, unsigned long int >.
References DD_MATRIX< T, number_of_diagonals, diagonal_offsets >::bytes, DD_MATRIX< T, number_of_diagonals, diagonal_offsets >::d, DD_MATRIX< T, number_of_diagonals, diagonal_offsets >::full, SparseMatrix< T, unsigned long int >::m(), SparseMatrix< T, unsigned long int >::n(), SparseMatrix< T, unsigned long int >::nnz, SparseMatrix< T, unsigned long int >::noc, SparseMatrix< T, unsigned long int >::nor, SparseMatrix< T, unsigned long int >::nzs(), DD_MATRIX< T, number_of_diagonals, diagonal_offsets >::SELF_ALLOCATED, and SparseMatrix< T, unsigned long int >::zero_element.
Referenced by DD_MATRIX< T, number_of_diagonals, diagonal_offsets >::DD_MATRIX().
|
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 DD_MATRIX< T, number_of_diagonals, diagonal_offsets >::d, SparseMatrix< T, unsigned long int >::noc, and SparseMatrix< T, unsigned long int >::nzs().
|
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 DD_MATRIX< T, number_of_diagonals, diagonal_offsets >::d, SparseMatrix< T, unsigned long int >::nor, and SparseMatrix< T, unsigned long int >::nzs().
|
protected |
Keeps track of the number of bytes spent for this matrix.
Referenced by DD_MATRIX< T, number_of_diagonals, diagonal_offsets >::bytesUsed(), DD_MATRIX< T, number_of_diagonals, diagonal_offsets >::DD_MATRIX(), and DD_MATRIX< T, number_of_diagonals, diagonal_offsets >::load().
|
protected |
What the main diagonal length is (longest diagonal).
Referenced by DD_MATRIX< T, number_of_diagonals, diagonal_offsets >::DD_MATRIX(), DD_MATRIX< T, number_of_diagonals, diagonal_offsets >::load(), DD_MATRIX< T, number_of_diagonals, diagonal_offsets >::zax(), and DD_MATRIX< T, number_of_diagonals, diagonal_offsets >::zxa().
|
protected |
How many full length diagonals this (possible not square matrix) contains.
Referenced by DD_MATRIX< T, number_of_diagonals, diagonal_offsets >::DD_MATRIX(), and DD_MATRIX< T, number_of_diagonals, diagonal_offsets >::load().
|
protected |
The values of the nonzeros.
|
protected |
Whether or not nzs was allocated by this instance itself.
Referenced by DD_MATRIX< T, number_of_diagonals, diagonal_offsets >::DD_MATRIX(), DD_MATRIX< T, number_of_diagonals, diagonal_offsets >::load(), and DD_MATRIX< T, number_of_diagonals, diagonal_offsets >::~DD_MATRIX().
1.8.7