SparseLibrary  Version 1.6.0
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
HilbertArray< T, I, hI, mI > Class Template Reference

Actual storage implementation. More...

#include <HilbertArray.hpp>

Inheritance diagram for HilbertArray< T, I, hI, mI >:
Inheritance graph
[legend]
Collaboration diagram for HilbertArray< T, I, hI, mI >:
Collaboration graph
[legend]

Public Member Functions

 HilbertArray (const std::vector< unsigned long int > &input)
 Base constructor. More...
 
virtual ULI getFirstRowIndex ()
 Gets the start-location of the first nonzero in this array. More...
 
virtual ULI getFirstColumnIndex ()
 Gets the start-location of the first nonzero in this array. More...
 
virtual void zxa (const T *__restrict__ const &x, T *__restrict__ const &y, const T *__restrict__ &v, const T *__restrict__ const &v_end)
 Flat implementation of the zax. More...
 
virtual void zax (const T *__restrict__ const &x, T *__restrict__ const &y, const T *__restrict__ &v, const T *__restrict__ const &v_end)
 Flat implementation of the zax. More...
 
virtual size_t bytesUsed ()
 
virtual void moveToStart (const T *__restrict__ &x, T *__restrict__ &y, const T &v)
 Moves this interface to the start location and perform a single multiply-add there. More...
 
virtual void moveToNext (const T *__restrict__ &x, T *__restrict__ &y, const T &v)
 Moves this interface and the two given vectors to the next position. More...
 
virtual ~HilbertArray ()
 Base deconstructor. More...
 
- Public Member Functions inherited from HilbertArrayInterface< T >
virtual ~HilbertArrayInterface ()
 Base deconstructor. More...
 

Protected Member Functions

void decode (const hI coor, mI &row, mI &col)
 Translates a Hilbert coordinate into a row and column index. More...
 
void decode (hI &cur, const I &inc, mI &row, mI &col)
 Translates a Hilbert coordinate into a row and column index. More...
 

Protected Attributes

hI start_coor
 Hilbert start coordinate. More...
 
I * array
 Index storage array. More...
 
I *__restrict__ curpos
 Current position in the array. More...
 
hI curcoor
 Current Hilbert coordinate. More...
 
mI currow
 Current row position. More...
 
mI curcol
 Current column position. More...
 
size_t bytes
 Keeps track of memory use. More...
 

Detailed Description

template<typename T, typename I, typename hI, typename mI>
class HilbertArray< T, I, hI, mI >

Actual storage implementation.

Template Parameters
TNonzero data type.
IHilbert-coordinate increment type.
hIFull Hilbert-coordinate data type.
mIFull matrix coordinate data type.

Constructor & Destructor Documentation

template<typename T , typename I , typename hI , typename mI >
HilbertArray< T, I, hI, mI >::HilbertArray ( const std::vector< unsigned long int > &  input)
inline
template<typename T , typename I , typename hI , typename mI >
virtual HilbertArray< T, I, hI, mI >::~HilbertArray ( )
inlinevirtual

Base deconstructor.

References HilbertArray< T, I, hI, mI >::array.

Member Function Documentation

template<typename T , typename I , typename hI , typename mI >
virtual size_t HilbertArray< T, I, hI, mI >::bytesUsed ( )
inlinevirtual
Returns
The number of bytes used by this Hilbert array

Implements HilbertArrayInterface< T >.

References HilbertArray< T, I, hI, mI >::bytes.

template<typename T , typename I , typename hI , typename mI >
void HilbertArray< T, I, hI, mI >::decode ( const hI  coor,
mI &  row,
mI &  col 
)
inlineprotected

Translates a Hilbert coordinate into a row and column index.

Parameters
coorInput Hilbert coordinate.
rowWhere to decode the row index.
colWhere to decode the column index.

Referenced by HilbertArray< T, I, hI, mI >::getFirstColumnIndex(), HilbertArray< T, I, hI, mI >::getFirstRowIndex(), HilbertArray< T, I, hI, mI >::moveToNext(), HilbertArray< T, I, hI, mI >::moveToStart(), HilbertArray< T, I, hI, mI >::zax(), and HilbertArray< T, I, hI, mI >::zxa().

template<typename T , typename I , typename hI , typename mI >
void HilbertArray< T, I, hI, mI >::decode ( hI &  cur,
const I &  inc,
mI &  row,
mI &  col 
)
inlineprotected

Translates a Hilbert coordinate into a row and column index.

Only updates the bits necessary to be updated, i.e., skips the first startPos bits of row and col. Assumes the bits that will be skipped already have the correct value (of course), i.e., this only works with the incremental scheme!

Parameters
curCurrent input Hilbert coordinate.
incHilbert coordinate increment
rowWhere to decode the row index.
colWhere to decode the column index.
template<typename T , typename I , typename hI , typename mI >
virtual ULI HilbertArray< T, I, hI, mI >::getFirstColumnIndex ( )
inlinevirtual

Gets the start-location of the first nonzero in this array.

Returns
The column-position of this location.

Implements HilbertArrayInterface< T >.

References HilbertArray< T, I, hI, mI >::curcol, HilbertArray< T, I, hI, mI >::currow, HilbertArray< T, I, hI, mI >::decode(), and HilbertArray< T, I, hI, mI >::start_coor.

template<typename T , typename I , typename hI , typename mI >
virtual ULI HilbertArray< T, I, hI, mI >::getFirstRowIndex ( )
inlinevirtual

Gets the start-location of the first nonzero in this array.

Returns
The row-position of this location.

Implements HilbertArrayInterface< T >.

References HilbertArray< T, I, hI, mI >::curcol, HilbertArray< T, I, hI, mI >::currow, HilbertArray< T, I, hI, mI >::decode(), and HilbertArray< T, I, hI, mI >::start_coor.

template<typename T , typename I , typename hI , typename mI >
virtual void HilbertArray< T, I, hI, mI >::moveToNext ( const T *__restrict__ &  x,
T *__restrict__ &  y,
const T &  v 
)
inlinevirtual

Moves this interface and the two given vectors to the next position.

Parameters
xPoints to the start of the input vector.
yPoints to the start of the output vector.
vNon-zero value to use.

Implements HilbertArrayInterface< T >.

References HilbertArray< T, I, hI, mI >::curcol, HilbertArray< T, I, hI, mI >::curcoor, HilbertArray< T, I, hI, mI >::curpos, HilbertArray< T, I, hI, mI >::currow, and HilbertArray< T, I, hI, mI >::decode().

template<typename T , typename I , typename hI , typename mI >
virtual void HilbertArray< T, I, hI, mI >::moveToStart ( const T *__restrict__ &  x,
T *__restrict__ &  y,
const T &  v 
)
inlinevirtual

Moves this interface to the start location and perform a single multiply-add there.

Parameters
xPoints to the start of the input vector.
yPoints to the start of the output vector.
vNonzero value to use.

Implements HilbertArrayInterface< T >.

References HilbertArray< T, I, hI, mI >::array, HilbertArray< T, I, hI, mI >::curcol, HilbertArray< T, I, hI, mI >::curcoor, HilbertArray< T, I, hI, mI >::curpos, HilbertArray< T, I, hI, mI >::currow, HilbertArray< T, I, hI, mI >::decode(), and HilbertArray< T, I, hI, mI >::start_coor.

template<typename T , typename I , typename hI , typename mI >
virtual void HilbertArray< T, I, hI, mI >::zax ( const T *__restrict__ const &  x,
T *__restrict__ const &  y,
const T *__restrict__ &  v,
const T *__restrict__ const &  v_end 
)
inlinevirtual

Flat implementation of the zax.

Might perform better than using the moveToStart and moveToNext functions from an outside class.

Parameters
xPointer to the input vector.
yPointer to the output vector.
vPointer to the nonzero values array. Warning: the pointer position will be altered!
v_endEnd-location of the nonzero values array (equal to v+nnz).

Implements HilbertArrayInterface< T >.

References HilbertArray< T, I, hI, mI >::array, HilbertArray< T, I, hI, mI >::curcol, HilbertArray< T, I, hI, mI >::curcoor, HilbertArray< T, I, hI, mI >::curpos, HilbertArray< T, I, hI, mI >::currow, HilbertArray< T, I, hI, mI >::decode(), Matrix2HilbertCoordinates::IntegerToHilbert(), and HilbertArray< T, I, hI, mI >::start_coor.

template<typename T , typename I , typename hI , typename mI >
virtual void HilbertArray< T, I, hI, mI >::zxa ( const T *__restrict__ const &  x,
T *__restrict__ const &  y,
const T *__restrict__ &  v,
const T *__restrict__ const &  v_end 
)
inlinevirtual

Flat implementation of the zax.

Might perform better than using the moveToStart and moveToNext functions from an outside class.

Parameters
xPointer to the input vector.
yPointer to the output vector.
vPointer to the nonzero values array. Warning: the pointer position will be altered!
v_endEnd-location of the nonzero values array (equal to v+nnz).

Implements HilbertArrayInterface< T >.

References HilbertArray< T, I, hI, mI >::array, HilbertArray< T, I, hI, mI >::curcol, HilbertArray< T, I, hI, mI >::curcoor, HilbertArray< T, I, hI, mI >::curpos, HilbertArray< T, I, hI, mI >::currow, HilbertArray< T, I, hI, mI >::decode(), and HilbertArray< T, I, hI, mI >::start_coor.

Member Data Documentation

template<typename T , typename I , typename hI , typename mI >
I* HilbertArray< T, I, hI, mI >::array
protected
template<typename T , typename I , typename hI , typename mI >
size_t HilbertArray< T, I, hI, mI >::bytes
protected
template<typename T , typename I , typename hI , typename mI >
mI HilbertArray< T, I, hI, mI >::curcol
protected
template<typename T , typename I , typename hI , typename mI >
hI HilbertArray< T, I, hI, mI >::curcoor
protected
template<typename T , typename I , typename hI , typename mI >
I* __restrict__ HilbertArray< T, I, hI, mI >::curpos
protected
template<typename T , typename I , typename hI , typename mI >
mI HilbertArray< T, I, hI, mI >::currow
protected
template<typename T , typename I , typename hI , typename mI >
hI HilbertArray< T, I, hI, mI >::start_coor
protected

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