SparseLibrary  Version 1.6.0
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
CCSWrapper< T, SparseMatrixType, IND > Class Template Reference

Automatically transforms a row-major scheme into an column-major scheme. More...

#include <CCSWrapper.hpp>

Inheritance diagram for CCSWrapper< T, SparseMatrixType, IND >:
Inheritance graph
[legend]
Collaboration diagram for CCSWrapper< T, SparseMatrixType, IND >:
Collaboration graph
[legend]

Public Member Functions

 CCSWrapper ()
 Default constructor (initialises with invalid data). More...
 
 CCSWrapper (std::string file, T zero=0)
 Base file-based constructor. More...
 
 CCSWrapper (const IND nnz, const IND nor, const IND noc, T zero)
 Base empty matrix constructor (sets nnz, rows, columns only). More...
 
 CCSWrapper (std::vector< Triplet< T > > &input, IND m, IND n, T zero)
 Base Triplet-based constructor. More...
 
virtual ~CCSWrapper ()
 Base destructor. More...
 
virtual void load (std::vector< Triplet< T > > &input, IND m, IND n, T zero)
 Triplet-based loader; first transposes, then calls nested constructor. More...
 
virtual void loadFromFile (const std::string file, const T zero=0)
 File-based loader; reads file, then passes to Triplet-based loader. More...
 
virtual ULI m ()
 Returns the number of matrix rows (taking into account transposition). More...
 
virtual ULI n ()
 Returns the number of matrix columns (taking into account transposition). More...
 
virtual ULI nzs ()
 Returns the number of nonzeroes. More...
 
virtual void getFirstIndexPair (IND &row, IND &col)
 
virtual T * mv (const T *x)
 
virtual void zax (const T *__restrict__ x, T *__restrict__ z)
 
virtual void zxa (const T *__restrict__ x, T *__restrict__ z)
 
virtual size_t bytesUsed ()
 
- Public Member Functions inherited from SparseMatrix< T, IND >
 SparseMatrix ()
 Base constructor. More...
 
 SparseMatrix (const IND nzs, const IND nr, const IND nc, 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...
 
- 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 Member Functions

void transposeVector (std::vector< Triplet< T > > &input)
 Helper function that transposes an input matrix in Triplet format, in-place. More...
 

Protected Attributes

SparseMatrixType * ds
 Pointer to the underlying data structure. More...
 
- Protected Attributes inherited from SparseMatrix< T, IND >
IND nor
 Number of rows. More...
 
IND noc
 Number of columns.
 
IND nnz
 Number of non-zeros. More...
 

Additional Inherited Members

- Public Attributes inherited from SparseMatrix< T, IND >
zero_element
 The element considered to be zero. More...
 

Detailed Description

template<typename T, typename SparseMatrixType, typename IND>
class CCSWrapper< T, SparseMatrixType, IND >

Automatically transforms a row-major scheme into an column-major scheme.

Can wrap around any SparseMatrix type, and automatically switches input row indices with input column indices, and switches the z=Ax operation with z=xA, and vice versa.

Constructor & Destructor Documentation

template<typename T, typename SparseMatrixType, typename IND>
CCSWrapper< T, SparseMatrixType, IND >::CCSWrapper ( )
inline

Default constructor (initialises with invalid data).

template<typename T, typename SparseMatrixType, typename IND>
CCSWrapper< T, SparseMatrixType, IND >::CCSWrapper ( std::string  file,
zero = 0 
)
inline

Base file-based constructor.

References CCSWrapper< T, SparseMatrixType, IND >::loadFromFile().

template<typename T, typename SparseMatrixType, typename IND>
CCSWrapper< T, SparseMatrixType, IND >::CCSWrapper ( const IND  nnz,
const IND  nor,
const IND  noc,
zero 
)
inline

Base empty matrix constructor (sets nnz, rows, columns only).

References CCSWrapper< T, SparseMatrixType, IND >::ds.

template<typename T, typename SparseMatrixType, typename IND>
CCSWrapper< T, SparseMatrixType, IND >::CCSWrapper ( std::vector< Triplet< T > > &  input,
IND  m,
IND  n,
zero 
)
inline

Base Triplet-based constructor.

References CCSWrapper< T, SparseMatrixType, IND >::load().

template<typename T, typename SparseMatrixType, typename IND>
virtual CCSWrapper< T, SparseMatrixType, IND >::~CCSWrapper ( )
inlinevirtual

Base destructor.

References CCSWrapper< T, SparseMatrixType, IND >::ds.

Member Function Documentation

template<typename T, typename SparseMatrixType, typename IND>
virtual size_t CCSWrapper< T, SparseMatrixType, IND >::bytesUsed ( )
inlinevirtual
template<typename T, typename SparseMatrixType, typename IND>
virtual void CCSWrapper< T, SparseMatrixType, IND >::getFirstIndexPair ( IND &  row,
IND &  col 
)
inlinevirtual
template<typename T, typename SparseMatrixType, typename IND>
virtual void CCSWrapper< T, SparseMatrixType, IND >::load ( std::vector< Triplet< T > > &  input,
IND  m,
IND  n,
zero 
)
inlinevirtual
template<typename T, typename SparseMatrixType, typename IND>
virtual void CCSWrapper< T, SparseMatrixType, IND >::loadFromFile ( const std::string  file,
const T  zero = 0 
)
inlinevirtual
template<typename T, typename SparseMatrixType, typename IND>
virtual ULI CCSWrapper< T, SparseMatrixType, IND >::m ( )
inlinevirtual

Returns the number of matrix rows (taking into account transposition).

Reimplemented from SparseMatrix< T, IND >.

References CCSWrapper< T, SparseMatrixType, IND >::ds.

Referenced by CCSWrapper< T, SparseMatrixType, IND >::loadFromFile(), and CCSWrapper< T, SparseMatrixType, IND >::mv().

template<typename T, typename SparseMatrixType, typename IND>
virtual T* CCSWrapper< T, SparseMatrixType, IND >::mv ( const T *  x)
inlinevirtual
template<typename T, typename SparseMatrixType, typename IND>
virtual ULI CCSWrapper< T, SparseMatrixType, IND >::n ( )
inlinevirtual

Returns the number of matrix columns (taking into account transposition).

Reimplemented from SparseMatrix< T, IND >.

References CCSWrapper< T, SparseMatrixType, IND >::ds.

Referenced by CCSWrapper< T, SparseMatrixType, IND >::loadFromFile().

template<typename T, typename SparseMatrixType, typename IND>
virtual ULI CCSWrapper< T, SparseMatrixType, IND >::nzs ( )
inlinevirtual

Returns the number of nonzeroes.

Reimplemented from SparseMatrix< T, IND >.

References CCSWrapper< T, SparseMatrixType, IND >::ds.

template<typename T, typename SparseMatrixType, typename IND>
void CCSWrapper< T, SparseMatrixType, IND >::transposeVector ( std::vector< Triplet< T > > &  input)
inlineprotected

Helper function that transposes an input matrix in Triplet format, in-place.

Parameters
inputThe input matrix.

Referenced by CCSWrapper< T, SparseMatrixType, IND >::load().

template<typename T, typename SparseMatrixType, typename IND>
virtual void CCSWrapper< T, SparseMatrixType, IND >::zax ( const T *__restrict__  x,
T *__restrict__  z 
)
inlinevirtual
See also
Matrix::zax (takes into account transposition)

Implements SparseMatrix< T, IND >.

References CCSWrapper< T, SparseMatrixType, IND >::ds.

template<typename T, typename SparseMatrixType, typename IND>
virtual void CCSWrapper< T, SparseMatrixType, IND >::zxa ( const T *__restrict__  x,
T *__restrict__  z 
)
inlinevirtual
See also
Matrix::zxa (takes into account transposition)

Implements SparseMatrix< T, IND >.

References CCSWrapper< T, SparseMatrixType, IND >::ds.

Member Data Documentation

template<typename T, typename SparseMatrixType, typename IND>
SparseMatrixType* CCSWrapper< T, SparseMatrixType, IND >::ds
protected

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