SparseLibrary
Version 1.6.0
|
Hierarchical BICRS with fixed subblock size and distribution. More...
#include <FBICRS.hpp>
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... | |
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).
_sub_ds | Defaults 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) |
logBeta | The 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 |
|
inline |
Base constructor (initialises with invalid data).
|
inline |
Base file-based constructor.
References SparseMatrix< _t_value, _i_value >::loadFromFile().
|
inline |
Base COO-based constructor.
References FBICRS< _t_value, _i_value, _sub_ds, logBeta >::load().
|
inline |
Base Triplet-based constructor.
References FBICRS< _t_value, _i_value, _sub_ds, logBeta >::load().
|
inline |
Base hierarchical constructor.
References FBICRS< _t_value, _i_value, _sub_ds, logBeta >::load().
|
inlinevirtual |
Function to query the amount of storage required by this sparse matrix.
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().
|
inlinevirtual |
Returns the first nonzero index, per reference.
Implements SparseMatrix< _t_value, _i_value >.
References FBICRS< _t_value, _i_value, _sub_ds, logBeta >::c_start, and FBICRS< _t_value, _i_value, _sub_ds, logBeta >::r_start.
|
inlinevirtual |
Builds input matrix from Triplet input.
input | Input matrix in triplet form. |
m | Number of rows in the input matrix. |
n | Number of columns in the input matrix. |
zero | The zero element of this matrix instance. |
Implements SparseMatrix< _t_value, _i_value >.
References FBICRS< _t_value, _i_value, _sub_ds, logBeta >::beta_m, FBICRS< _t_value, _i_value, _sub_ds, logBeta >::beta_n, FBICRS< _t_value, _i_value, _sub_ds, logBeta >::c_inc, FBICRS< _t_value, _i_value, _sub_ds, logBeta >::c_start, FBICRS< _t_value, _i_value, _sub_ds, logBeta >::dss, SparseMatrix< _t_value, _i_value >::m(), SparseMatrix< _t_value, _i_value >::n(), FBICRS< _t_value, _i_value, _sub_ds, logBeta >::n_overflow, SparseMatrix< _t_value, _i_value >::nnz, SparseMatrix< _t_value, _i_value >::noc, SparseMatrix< _t_value, _i_value >::nor, FBICRS< _t_value, _i_value, _sub_ds, logBeta >::r_inc, FBICRS< _t_value, _i_value, _sub_ds, logBeta >::r_start, and SparseMatrix< _t_value, _i_value >::zero_element.
Referenced by FBICRS< _t_value, _i_value, _sub_ds, logBeta >::FBICRS(), and FBICRS< _t_value, _i_value, _sub_ds, logBeta >::load().
|
inline |
Builds input matrix from COO input.
row | COO row index array. |
col | COO column index array. |
val | COO nonzero value array. |
m | Number of rows in the input matrix. |
n | Number of columns in the input matrix. |
nz | The number of nonzeroes in the COO input. |
zero | The zero element of this matrix instance. |
References FBICRS< _t_value, _i_value, _sub_ds, logBeta >::load().
|
inline |
Builds input matrix from Triplet input.
input | Hierarchical input matrix in triplet form. |
m | Number of rows in the input matrix. |
n | Number of columns in the input matrix. |
zero | The zero element of this matrix instance. |
References FBICRS< _t_value, _i_value, _sub_ds, logBeta >::beta_m, FBICRS< _t_value, _i_value, _sub_ds, logBeta >::beta_n, FBICRS< _t_value, _i_value, _sub_ds, logBeta >::c_end, FBICRS< _t_value, _i_value, _sub_ds, logBeta >::c_inc, FBICRS< _t_value, _i_value, _sub_ds, logBeta >::c_start, FBICRS< _t_value, _i_value, _sub_ds, logBeta >::dss, FBICRS< _t_value, _i_value, _sub_ds, logBeta >::fillIn, FBICRS< _t_value, _i_value, _sub_ds, logBeta >::jumps, SparseMatrix< _t_value, _i_value >::m(), SparseMatrix< _t_value, _i_value >::n(), FBICRS< _t_value, _i_value, _sub_ds, logBeta >::n_overflow, SparseMatrix< _t_value, _i_value >::nnz, SparseMatrix< _t_value, _i_value >::noc, SparseMatrix< _t_value, _i_value >::nor, FBICRS< _t_value, _i_value, _sub_ds, logBeta >::r_end, FBICRS< _t_value, _i_value, _sub_ds, logBeta >::r_inc, FBICRS< _t_value, _i_value, _sub_ds, logBeta >::r_start, and SparseMatrix< _t_value, _i_value >::zero_element.
|
inlinevirtual |
In-place z=Ax function.
x | The x vector to multiply current matrix with. |
z | The result vector. Must be pre-allocated and its elements should be initialised to zero. |
Implements SparseMatrix< _t_value, _i_value >.
References FBICRS< _t_value, _i_value, _sub_ds, logBeta >::c_inc, FBICRS< _t_value, _i_value, _sub_ds, logBeta >::c_start, FBICRS< _t_value, _i_value, _sub_ds, logBeta >::dss, FBICRS< _t_value, _i_value, _sub_ds, logBeta >::n_overflow, SparseMatrix< _t_value, _i_value >::nnz, SparseMatrix< _t_value, _i_value >::noc, FBICRS< _t_value, _i_value, _sub_ds, logBeta >::r_inc, and FBICRS< _t_value, _i_value, _sub_ds, logBeta >::r_start.
Referenced by FBICRS< _t_value, _i_value, _sub_ds, logBeta >::zax_fb().
|
inline |
References FBICRS< _t_value, _i_value, _sub_ds, logBeta >::c_inc, FBICRS< _t_value, _i_value, _sub_ds, logBeta >::c_start, FBICRS< _t_value, _i_value, _sub_ds, logBeta >::dss, FBICRS< _t_value, _i_value, _sub_ds, logBeta >::n_overflow, SparseMatrix< _t_value, _i_value >::nnz, SparseMatrix< _t_value, _i_value >::noc, FBICRS< _t_value, _i_value, _sub_ds, logBeta >::r_inc, and FBICRS< _t_value, _i_value, _sub_ds, logBeta >::r_start.
|
inlinevirtual |
Interleaved zax kernel for use with the BetaHilbert scheme.
References FBICRS< _t_value, _i_value, _sub_ds, logBeta >::c_end, FBICRS< _t_value, _i_value, _sub_ds, logBeta >::c_inc, FBICRS< _t_value, _i_value, _sub_ds, logBeta >::c_start, FBICRS< _t_value, _i_value, _sub_ds, logBeta >::dss, FBICRS< _t_value, _i_value, _sub_ds, logBeta >::jumps, FBICRS< _t_value, _i_value, _sub_ds, logBeta >::n_overflow, SparseMatrix< _t_value, _i_value >::nnz, SparseMatrix< _t_value, _i_value >::noc, FBICRS< _t_value, _i_value, _sub_ds, logBeta >::r_end, FBICRS< _t_value, _i_value, _sub_ds, logBeta >::r_inc, FBICRS< _t_value, _i_value, _sub_ds, logBeta >::r_start, and FBICRS< _t_value, _i_value, _sub_ds, logBeta >::zax().
Referenced by BetaHilbert< T >::thread().
|
inlinevirtual |
In-place z=xA function.
x | The x vector to apply in left-multiplication to A |
z | The result vector. Must be pre-allocated and its elements should be initialised to zero. |
Implements SparseMatrix< _t_value, _i_value >.
References FBICRS< _t_value, _i_value, _sub_ds, logBeta >::c_inc, FBICRS< _t_value, _i_value, _sub_ds, logBeta >::c_start, FBICRS< _t_value, _i_value, _sub_ds, logBeta >::dss, FBICRS< _t_value, _i_value, _sub_ds, logBeta >::n_overflow, SparseMatrix< _t_value, _i_value >::nnz, SparseMatrix< _t_value, _i_value >::noc, FBICRS< _t_value, _i_value, _sub_ds, logBeta >::r_inc, and FBICRS< _t_value, _i_value, _sub_ds, logBeta >::r_start.
Referenced by FBICRS< _t_value, _i_value, _sub_ds, logBeta >::zxa_fb().
|
inline |
References FBICRS< _t_value, _i_value, _sub_ds, logBeta >::c_inc, FBICRS< _t_value, _i_value, _sub_ds, logBeta >::c_start, FBICRS< _t_value, _i_value, _sub_ds, logBeta >::dss, FBICRS< _t_value, _i_value, _sub_ds, logBeta >::n_overflow, SparseMatrix< _t_value, _i_value >::nnz, SparseMatrix< _t_value, _i_value >::noc, FBICRS< _t_value, _i_value, _sub_ds, logBeta >::r_inc, and FBICRS< _t_value, _i_value, _sub_ds, logBeta >::r_start.
|
inlinevirtual |
Interleaved zxa kernel for use with the BetaHilbert scheme.
References FBICRS< _t_value, _i_value, _sub_ds, logBeta >::c_end, FBICRS< _t_value, _i_value, _sub_ds, logBeta >::c_inc, FBICRS< _t_value, _i_value, _sub_ds, logBeta >::c_start, FBICRS< _t_value, _i_value, _sub_ds, logBeta >::dss, FBICRS< _t_value, _i_value, _sub_ds, logBeta >::jumps, FBICRS< _t_value, _i_value, _sub_ds, logBeta >::n_overflow, SparseMatrix< _t_value, _i_value >::nnz, SparseMatrix< _t_value, _i_value >::noc, FBICRS< _t_value, _i_value, _sub_ds, logBeta >::r_end, FBICRS< _t_value, _i_value, _sub_ds, logBeta >::r_inc, FBICRS< _t_value, _i_value, _sub_ds, logBeta >::r_start, and FBICRS< _t_value, _i_value, _sub_ds, logBeta >::zxa().
Referenced by BetaHilbert< T >::thread().
|
protected |
Column index of the last nonzero.
Referenced by FBICRS< _t_value, _i_value, _sub_ds, logBeta >::load(), FBICRS< _t_value, _i_value, _sub_ds, logBeta >::zax_fb(), and FBICRS< _t_value, _i_value, _sub_ds, logBeta >::zxa_fb().
|
protected |
Column increment array.
Referenced by FBICRS< _t_value, _i_value, _sub_ds, logBeta >::load(), FBICRS< _t_value, _i_value, _sub_ds, logBeta >::zax(), FBICRS< _t_value, _i_value, _sub_ds, logBeta >::ZaX(), FBICRS< _t_value, _i_value, _sub_ds, logBeta >::zax_fb(), FBICRS< _t_value, _i_value, _sub_ds, logBeta >::zxa(), FBICRS< _t_value, _i_value, _sub_ds, logBeta >::ZXa(), FBICRS< _t_value, _i_value, _sub_ds, logBeta >::zxa_fb(), and FBICRS< _t_value, _i_value, _sub_ds, logBeta >::~FBICRS().
|
protected |
Column index of the first nonzero.
Referenced by FBICRS< _t_value, _i_value, _sub_ds, logBeta >::getFirstIndexPair(), FBICRS< _t_value, _i_value, _sub_ds, logBeta >::load(), FBICRS< _t_value, _i_value, _sub_ds, logBeta >::zax(), FBICRS< _t_value, _i_value, _sub_ds, logBeta >::ZaX(), FBICRS< _t_value, _i_value, _sub_ds, logBeta >::zax_fb(), FBICRS< _t_value, _i_value, _sub_ds, logBeta >::zxa(), FBICRS< _t_value, _i_value, _sub_ds, logBeta >::ZXa(), and FBICRS< _t_value, _i_value, _sub_ds, logBeta >::zxa_fb().
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().
|
protected |
|
protected |
Row index of the last nonzero.
Referenced by FBICRS< _t_value, _i_value, _sub_ds, logBeta >::load(), FBICRS< _t_value, _i_value, _sub_ds, logBeta >::zax_fb(), and FBICRS< _t_value, _i_value, _sub_ds, logBeta >::zxa_fb().
|
protected |
Row increment array.
Referenced by FBICRS< _t_value, _i_value, _sub_ds, logBeta >::load(), FBICRS< _t_value, _i_value, _sub_ds, logBeta >::zax(), FBICRS< _t_value, _i_value, _sub_ds, logBeta >::ZaX(), FBICRS< _t_value, _i_value, _sub_ds, logBeta >::zax_fb(), FBICRS< _t_value, _i_value, _sub_ds, logBeta >::zxa(), FBICRS< _t_value, _i_value, _sub_ds, logBeta >::ZXa(), FBICRS< _t_value, _i_value, _sub_ds, logBeta >::zxa_fb(), and FBICRS< _t_value, _i_value, _sub_ds, logBeta >::~FBICRS().
|
protected |
Row index of the first nonzero.
Referenced by FBICRS< _t_value, _i_value, _sub_ds, logBeta >::getFirstIndexPair(), FBICRS< _t_value, _i_value, _sub_ds, logBeta >::load(), FBICRS< _t_value, _i_value, _sub_ds, logBeta >::zax(), FBICRS< _t_value, _i_value, _sub_ds, logBeta >::ZaX(), FBICRS< _t_value, _i_value, _sub_ds, logBeta >::zax_fb(), FBICRS< _t_value, _i_value, _sub_ds, logBeta >::zxa(), FBICRS< _t_value, _i_value, _sub_ds, logBeta >::ZXa(), and FBICRS< _t_value, _i_value, _sub_ds, logBeta >::zxa_fb().