SparseLibrary  Version 1.6.0
Public Member Functions | Protected Attributes | List of all members
DD_MATRIX< T, number_of_diagonals, diagonal_offsets > Class Template Reference

The dense diagonal matrix scheme; a storage scheme for sparse matrices consisting of only dense diagonals. More...

#include <DD_MATRIX.hpp>

Inheritance diagram for DD_MATRIX< T, number_of_diagonals, diagonal_offsets >:
Inheritance graph
[legend]
Collaboration diagram for DD_MATRIX< T, number_of_diagonals, diagonal_offsets >:
Collaboration graph
[legend]

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 >
zero_element
 The element considered to be zero. More...
 

Detailed Description

template<typename T, int number_of_diagonals, int diagonal_offsets>
class DD_MATRIX< T, number_of_diagonals, diagonal_offsets >

The dense diagonal matrix scheme; a storage scheme for sparse matrices consisting of only dense diagonals.

Parameters
Ttype of numerical values to store in the matrix (int, unsigned int, float, double, ...)
number_of_diagonalsnumber of (assumed) dense diagonals in the matrix
diagonal_offsetsmust be defined global in calling code, so that it is ensured constant at compiletime (necessary when template is used)

Constructor & Destructor Documentation

template<typename T , int number_of_diagonals, int diagonal_offsets>
DD_MATRIX< T, number_of_diagonals, diagonal_offsets >::DD_MATRIX ( )
inline
template<typename T , int number_of_diagonals, int diagonal_offsets>
DD_MATRIX< T, number_of_diagonals, diagonal_offsets >::DD_MATRIX ( std::string  file,
zero = 0 
)
inline

Base constructor.

Will read in from Matrix Market file.

See also
SparseMatrix::SparseMatrix( file, zero )

References SparseMatrix< T, unsigned long int >::loadFromFile().

template<typename T , int number_of_diagonals, int diagonal_offsets>
DD_MATRIX< T, number_of_diagonals, diagonal_offsets >::DD_MATRIX ( std::vector< Triplet< T > > &  input,
ULI  m,
ULI  n,
zero 
)
inline

Base constructor.

Parameters
inputstd::vector of triplets to be stored in this scheme.
mtotal number of rows.
ntotal number of columns.
zerowhat is to be considered the zero element.

References DD_MATRIX< T, number_of_diagonals, diagonal_offsets >::load().

template<typename T , int number_of_diagonals, int diagonal_offsets>
DD_MATRIX< T, number_of_diagonals, diagonal_offsets >::DD_MATRIX ( T **  nonzeroes,
ULI  m,
ULI  n,
zero 
)
inline
template<typename T , int number_of_diagonals, int diagonal_offsets>
DD_MATRIX< T, number_of_diagonals, diagonal_offsets >::~DD_MATRIX ( )
inline

Member Function Documentation

template<typename T , int number_of_diagonals, int diagonal_offsets>
size_t DD_MATRIX< T, number_of_diagonals, diagonal_offsets >::bytesUsed ( )
inlinevirtual
Returns
The number of bytes used to store this data structure.

Implements Matrix< T >.

References DD_MATRIX< T, number_of_diagonals, diagonal_offsets >::bytes.

template<typename T , int number_of_diagonals, int diagonal_offsets>
virtual void DD_MATRIX< T, number_of_diagonals, diagonal_offsets >::getFirstIndexPair ( unsigned long int &  row,
unsigned long int &  col 
)
inlinevirtual

Returns the first nonzero index, per reference.

Implements SparseMatrix< T, unsigned long int >.

template<typename T , int number_of_diagonals, int diagonal_offsets>
virtual void DD_MATRIX< T, number_of_diagonals, diagonal_offsets >::load ( std::vector< Triplet< T > > &  input,
const ULI  m,
const ULI  n,
const T  zero 
)
inlinevirtual
template<typename T , int number_of_diagonals, int diagonal_offsets>
virtual void DD_MATRIX< T, number_of_diagonals, diagonal_offsets >::zax ( const T *  x,
T *  z 
)
inlinevirtual

In-place z=Ax calculation algorithm.

Parameters
xThe vector x supplied for calculation of Ax.
zThe 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().

template<typename T , int number_of_diagonals, int diagonal_offsets>
virtual void DD_MATRIX< T, number_of_diagonals, diagonal_offsets >::zxa ( const T *  x,
T *  z 
)
inlinevirtual

In-place z=xA calculation algorithm.

Parameters
xThe vector x supplied for calculation of xA.
zThe 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().

Member Data Documentation

template<typename T , int number_of_diagonals, int diagonal_offsets>
size_t DD_MATRIX< T, number_of_diagonals, diagonal_offsets >::bytes
protected
template<typename T , int number_of_diagonals, int diagonal_offsets>
ULI DD_MATRIX< T, number_of_diagonals, diagonal_offsets >::d
protected
template<typename T , int number_of_diagonals, int diagonal_offsets>
ULI DD_MATRIX< T, number_of_diagonals, diagonal_offsets >::full
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().

template<typename T , int number_of_diagonals, int diagonal_offsets>
T** DD_MATRIX< T, number_of_diagonals, diagonal_offsets >::nzs
protected

The values of the nonzeros.

template<typename T , int number_of_diagonals, int diagonal_offsets>
bool DD_MATRIX< T, number_of_diagonals, diagonal_offsets >::SELF_ALLOCATED
protected

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