SparseLibrary  Version 1.6.0
Public Member Functions | Public Attributes | Static Public Attributes | Protected Attributes | List of all members
FBICRS< _t_value, _i_value, _sub_ds, logBeta > Class Template Reference

Hierarchical BICRS with fixed subblock size and distribution. More...

#include <FBICRS.hpp>

Inheritance diagram for FBICRS< _t_value, _i_value, _sub_ds, logBeta >:
Inheritance graph
[legend]
Collaboration diagram for FBICRS< _t_value, _i_value, _sub_ds, logBeta >:
Collaboration graph
[legend]

Public Member Functions

virtual ~FBICRS ()
 Default destructor. More...
 
 FBICRS ()
 Base constructor (initialises with invalid data). More...
 
 FBICRS (std::string file, _t_value zero=0)
 Base file-based constructor. More...
 
 FBICRS (_i_value *row, _i_value *col, _t_value *val, ULI m, ULI n, ULI nz, _t_value zero)
 Base COO-based constructor. More...
 
 FBICRS (std::vector< Triplet< _t_value > > &input, ULI m, ULI n, _t_value zero=0)
 Base Triplet-based constructor. More...
 
 FBICRS (std::vector< std::vector< Triplet< _t_value > > > &input, ULI m, ULI n, _t_value zero=0)
 Base hierarchical constructor. More...
 
virtual void load (std::vector< Triplet< _t_value > > &input, _i_value m, _i_value n, _t_value zero)
 Builds input matrix from Triplet input. More...
 
void load (_i_value *row, _i_value *col, _t_value *val, ULI m, ULI n, ULI nz, _t_value zero)
 Builds input matrix from COO input. More...
 
void load (std::vector< std::vector< Triplet< _t_value > > > &input, ULI m, ULI n, _t_value zero)
 Builds input matrix from Triplet input. More...
 
virtual void getFirstIndexPair (_i_value &row, _i_value &col)
 Returns the first nonzero index, per reference. More...
 
virtual void zxa (const _t_value *__restrict__ x_p, _t_value *__restrict__ y_p)
 In-place z=xA function. More...
 
template<size_t k>
void ZXa (const _t_value *__restrict__ const *__restrict__ const X, _t_value *__restrict__ const *__restrict__ const Z)
 
virtual void zxa_fb (const _t_value *__restrict__ x_p, _t_value *__restrict__ y_p)
 Interleaved zxa kernel for use with the BetaHilbert scheme. More...
 
virtual void zax (const _t_value *__restrict__ x_p, _t_value *__restrict__ y_p)
 In-place z=Ax function. More...
 
template<size_t k>
void ZaX (const _t_value *__restrict__ const *__restrict__ const X, _t_value *__restrict__ const *__restrict__ const Z)
 
virtual void zax_fb (const _t_value *__restrict__ x_p, _t_value *__restrict__ y_p)
 Interleaved zax kernel for use with the BetaHilbert scheme. More...
 
virtual size_t bytesUsed ()
 Function to query the amount of storage required by this sparse matrix. More...
 
- Public Member Functions inherited from SparseMatrix< _t_value, _i_value >
 SparseMatrix ()
 Base constructor. More...
 
 SparseMatrix (const _i_valuenzs, const _i_valuenr, const _i_valuenc, const _t_valuezero)
 Base constructor. More...
 
virtual ~SparseMatrix ()
 Base deconstructor. More...
 
void loadFromFile (const std::string file, const _t_valuezero=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_value * mv (const _t_value *x)
 Calculates and returns z=Ax. More...
 
- Public Member Functions inherited from Matrix< _t_value >
 Matrix ()
 Base constructor. More...
 
virtual ~Matrix ()
 Base deconstructor. More...
 
virtual void zax (const _t_value *__restrict__ x, _t_value *__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...
 
void ZaX (const _t_value *__restrict__ const *__restrict__ const X, _t_value *__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...
 
virtual void zxa (const _t_value *__restrict__ x, _t_value *__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...
 
void ZXa (const _t_value *__restrict__ const *__restrict__ const X, _t_value *__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...
 

Public Attributes

size_t fillIn
 Stores the total fillIn. More...
 
_sub_ds ** dss
 Stores the lower-level data structures.
 
ULI n_overflow
 Caches the overflow forcing value.
 
- Public Attributes inherited from SparseMatrix< _t_value, _i_value >
_t_value zero_element
 The element considered to be zero. More...
 

Static Public Attributes

static const ULI beta_m = 1l << (logBeta-1)
 Maximum matrix size for _sub_ds with the above data type; row size.
 
static const ULI beta_n = beta_m
 Maximum matrix size for _sub_ds with the above data type; column size.
 

Protected Attributes

ULI r_start
 Row index of the first nonzero. More...
 
ULI c_start
 Column index of the first nonzero. More...
 
ULI r_end
 Row index of the last nonzero. More...
 
ULI c_end
 Column index of the last nonzero. More...
 
ULI jumps
 How many row jumps are stored. More...
 
_i_value * r_inc
 Row increment array. More...
 
_i_value * c_inc
 Column increment array. More...
 
- Protected Attributes inherited from SparseMatrix< _t_value, _i_value >
_i_value nor
 Number of rows. More...
 
_i_value noc
 Number of columns.
 
_i_value nnz
 Number of non-zeros. More...
 

Detailed Description

template<typename _t_value, typename _i_value = LI, typename _sub_ds = ICRS< _t_value, uint16_t >, unsigned char logBeta = 15>
class FBICRS< _t_value, _i_value, _sub_ds, logBeta >

Hierarchical BICRS with fixed subblock size and distribution.

Uses compression on upper and lower level. Currently handles matrices with at most 39 bits indices (signed ints on upper level with unsigned chars on the lower level; it was either that or 72 bits, but the latter cannot efficiently be represented on 64-bit architectures).

Template Parameters
_sub_dsDefaults chooses a vectorised BICRS structure with unsigned short int index type as sub data type. Other options: typedef ICRS< _t_value, unsigned char > _sub_ds; typedef ICRS< _t_value, uint16_t > _sub_ds; typedef vecBICRS< _t_value, 8, 1, int16_t > _sub_ds; typedef ICRS< _t_value, unsigned int > _sub_ds; (default) typedef CRS< _t_value > _sub_ds; (using the latter with logBeta = 64 boils down to a block row distributed CRS-based parallel SpMV)
logBetaThe log of the size of the maximum block size represented by _sub_ds. Options: static const unsigned char logBeta = 7; //=max ICRS/unsigned char static const unsigned char logBeta = 11; //=2k static const unsigned char logBeta = 12; //=4k static const unsigned char logBeta = 14; //=max vecBICRS/int16_t=16k static const unsigned char logBeta = 15; //=max ICRS/uint16_t=32k static const unsigned char logBeta = 17; //=128k static const unsigned char logBeta = 31; //=max ICRS/unsigned short static const unsigned char logBeta = 64; //=max CRS

Constructor & Destructor Documentation

template<typename _t_value, typename _i_value = LI, typename _sub_ds = ICRS< _t_value, uint16_t >, unsigned char logBeta = 15>
virtual FBICRS< _t_value, _i_value, _sub_ds, logBeta >::~FBICRS ( )
inlinevirtual
template<typename _t_value, typename _i_value = LI, typename _sub_ds = ICRS< _t_value, uint16_t >, unsigned char logBeta = 15>
FBICRS< _t_value, _i_value, _sub_ds, logBeta >::FBICRS ( )
inline

Base constructor (initialises with invalid data).

template<typename _t_value, typename _i_value = LI, typename _sub_ds = ICRS< _t_value, uint16_t >, unsigned char logBeta = 15>
FBICRS< _t_value, _i_value, _sub_ds, logBeta >::FBICRS ( std::string  file,
_t_value  zero = 0 
)
inline

Base file-based constructor.

References SparseMatrix< _t_value, _i_value >::loadFromFile().

template<typename _t_value, typename _i_value = LI, typename _sub_ds = ICRS< _t_value, uint16_t >, unsigned char logBeta = 15>
FBICRS< _t_value, _i_value, _sub_ds, logBeta >::FBICRS ( _i_value *  row,
_i_value *  col,
_t_value *  val,
ULI  m,
ULI  n,
ULI  nz,
_t_value  zero 
)
inline

Base COO-based constructor.

References FBICRS< _t_value, _i_value, _sub_ds, logBeta >::load().

template<typename _t_value, typename _i_value = LI, typename _sub_ds = ICRS< _t_value, uint16_t >, unsigned char logBeta = 15>
FBICRS< _t_value, _i_value, _sub_ds, logBeta >::FBICRS ( std::vector< Triplet< _t_value > > &  input,
ULI  m,
ULI  n,
_t_value  zero = 0 
)
inline

Base Triplet-based constructor.

References FBICRS< _t_value, _i_value, _sub_ds, logBeta >::load().

template<typename _t_value, typename _i_value = LI, typename _sub_ds = ICRS< _t_value, uint16_t >, unsigned char logBeta = 15>
FBICRS< _t_value, _i_value, _sub_ds, logBeta >::FBICRS ( std::vector< std::vector< Triplet< _t_value > > > &  input,
ULI  m,
ULI  n,
_t_value  zero = 0 
)
inline

Base hierarchical constructor.

References FBICRS< _t_value, _i_value, _sub_ds, logBeta >::load().

Member Function Documentation

template<typename _t_value, typename _i_value = LI, typename _sub_ds = ICRS< _t_value, uint16_t >, unsigned char logBeta = 15>
virtual size_t FBICRS< _t_value, _i_value, _sub_ds, logBeta >::bytesUsed ( )
inlinevirtual

Function to query the amount of storage required by this sparse matrix.

Returns
The size of the sparse matrix in bytes.

Implements Matrix< _t_value >.

References FBICRS< _t_value, _i_value, _sub_ds, logBeta >::dss, FBICRS< _t_value, _i_value, _sub_ds, logBeta >::jumps, and SparseMatrix< _t_value, _i_value >::nnz.

Referenced by BetaHilbert< T >::thread().

template<typename _t_value, typename _i_value = LI, typename _sub_ds = ICRS< _t_value, uint16_t >, unsigned char logBeta = 15>
virtual void FBICRS< _t_value, _i_value, _sub_ds, logBeta >::getFirstIndexPair ( _i_value &  row,
_i_value &  col 
)
inlinevirtual
template<typename _t_value, typename _i_value = LI, typename _sub_ds = ICRS< _t_value, uint16_t >, unsigned char logBeta = 15>
virtual void FBICRS< _t_value, _i_value, _sub_ds, logBeta >::load ( std::vector< Triplet< _t_value > > &  input,
_i_value  m,
_i_value  n,
_t_value  zero 
)
inlinevirtual
template<typename _t_value, typename _i_value = LI, typename _sub_ds = ICRS< _t_value, uint16_t >, unsigned char logBeta = 15>
void FBICRS< _t_value, _i_value, _sub_ds, logBeta >::load ( _i_value *  row,
_i_value *  col,
_t_value *  val,
ULI  m,
ULI  n,
ULI  nz,
_t_value  zero 
)
inline

Builds input matrix from COO input.

Parameters
rowCOO row index array.
colCOO column index array.
valCOO nonzero value array.
mNumber of rows in the input matrix.
nNumber of columns in the input matrix.
nzThe number of nonzeroes in the COO input.
zeroThe zero element of this matrix instance.

References FBICRS< _t_value, _i_value, _sub_ds, logBeta >::load().

template<typename _t_value, typename _i_value = LI, typename _sub_ds = ICRS< _t_value, uint16_t >, unsigned char logBeta = 15>
void FBICRS< _t_value, _i_value, _sub_ds, logBeta >::load ( std::vector< std::vector< Triplet< _t_value > > > &  input,
ULI  m,
ULI  n,
_t_value  zero 
)
inline
template<typename _t_value, typename _i_value = LI, typename _sub_ds = ICRS< _t_value, uint16_t >, unsigned char logBeta = 15>
virtual void FBICRS< _t_value, _i_value, _sub_ds, logBeta >::zax ( const _t_value *__restrict__  x,
_t_value *__restrict__  z 
)
inlinevirtual
template<typename _t_value, typename _i_value = LI, typename _sub_ds = ICRS< _t_value, uint16_t >, unsigned char logBeta = 15>
template<size_t k>
void FBICRS< _t_value, _i_value, _sub_ds, logBeta >::ZaX ( const _t_value *__restrict__ const *__restrict__ const  X,
_t_value *__restrict__ const *__restrict__ const  Z 
)
inline
template<typename _t_value, typename _i_value = LI, typename _sub_ds = ICRS< _t_value, uint16_t >, unsigned char logBeta = 15>
virtual void FBICRS< _t_value, _i_value, _sub_ds, logBeta >::zax_fb ( const _t_value *__restrict__  x_p,
_t_value *__restrict__  y_p 
)
inlinevirtual
template<typename _t_value, typename _i_value = LI, typename _sub_ds = ICRS< _t_value, uint16_t >, unsigned char logBeta = 15>
virtual void FBICRS< _t_value, _i_value, _sub_ds, logBeta >::zxa ( const _t_value *__restrict__  x,
_t_value *__restrict__  z 
)
inlinevirtual
template<typename _t_value, typename _i_value = LI, typename _sub_ds = ICRS< _t_value, uint16_t >, unsigned char logBeta = 15>
template<size_t k>
void FBICRS< _t_value, _i_value, _sub_ds, logBeta >::ZXa ( const _t_value *__restrict__ const *__restrict__ const  X,
_t_value *__restrict__ const *__restrict__ const  Z 
)
inline
template<typename _t_value, typename _i_value = LI, typename _sub_ds = ICRS< _t_value, uint16_t >, unsigned char logBeta = 15>
virtual void FBICRS< _t_value, _i_value, _sub_ds, logBeta >::zxa_fb ( const _t_value *__restrict__  x_p,
_t_value *__restrict__  y_p 
)
inlinevirtual

Member Data Documentation

template<typename _t_value, typename _i_value = LI, typename _sub_ds = ICRS< _t_value, uint16_t >, unsigned char logBeta = 15>
ULI FBICRS< _t_value, _i_value, _sub_ds, logBeta >::c_end
protected
template<typename _t_value, typename _i_value = LI, typename _sub_ds = ICRS< _t_value, uint16_t >, unsigned char logBeta = 15>
_i_value* FBICRS< _t_value, _i_value, _sub_ds, logBeta >::c_inc
protected
template<typename _t_value, typename _i_value = LI, typename _sub_ds = ICRS< _t_value, uint16_t >, unsigned char logBeta = 15>
ULI FBICRS< _t_value, _i_value, _sub_ds, logBeta >::c_start
protected
template<typename _t_value, typename _i_value = LI, typename _sub_ds = ICRS< _t_value, uint16_t >, unsigned char logBeta = 15>
size_t FBICRS< _t_value, _i_value, _sub_ds, logBeta >::fillIn

Stores the total fillIn.

Referenced by FBICRS< _t_value, _i_value, _sub_ds, logBeta >::load().

template<typename _t_value, typename _i_value = LI, typename _sub_ds = ICRS< _t_value, uint16_t >, unsigned char logBeta = 15>
ULI FBICRS< _t_value, _i_value, _sub_ds, logBeta >::jumps
protected
template<typename _t_value, typename _i_value = LI, typename _sub_ds = ICRS< _t_value, uint16_t >, unsigned char logBeta = 15>
ULI FBICRS< _t_value, _i_value, _sub_ds, logBeta >::r_end
protected
template<typename _t_value, typename _i_value = LI, typename _sub_ds = ICRS< _t_value, uint16_t >, unsigned char logBeta = 15>
_i_value* FBICRS< _t_value, _i_value, _sub_ds, logBeta >::r_inc
protected
template<typename _t_value, typename _i_value = LI, typename _sub_ds = ICRS< _t_value, uint16_t >, unsigned char logBeta = 15>
ULI FBICRS< _t_value, _i_value, _sub_ds, logBeta >::r_start
protected

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