SparseLibrary
Version 1.6.0
|
Hierarchical Bi-directional Incremental Compressed Row Storage scheme. More...
#include <HBICRS.hpp>
Public Member Functions | |
~HBICRS () | |
Base deconstructor. More... | |
HBICRS () | |
Base constructor. More... | |
HBICRS (std::string file, _t_value zero=0) | |
Base constructor. More... | |
HBICRS (std::vector< Triplet< _t_value > > &input, LI m, LI n, _t_value zero) | |
Base constructor. More... | |
HBICRS (std::vector< std::vector< Triplet< _t_value > > > &input, signed char *group_type, LI m, LI n, _t_value zero=0) | |
Base constructor. More... | |
virtual void | load (std::vector< Triplet< _t_value > > &input, LI m, LI n, _t_value zero) |
This function will rewrite the std::vector< Triplet > structure to one suitable for the other load function. More... | |
virtual void | load (std::vector< std::vector< Triplet< _t_value > > > &input, signed char *group_type, LI m, LI n, _t_value zero) |
Constructs the hierarchical part. More... | |
void | load (LI *row, LI *col, LI m, LI n, LI nb) |
Builds the BICRS structure. More... | |
virtual void | getFirstIndexPair (LI &i, LI &j) |
virtual void | zxa (const _t_value *__restrict__ x_p, _t_value *__restrict__ y_p) |
Calculates y=xA, but does not allocate y itself. More... | |
virtual void | zax (const _t_value *__restrict__ x_p, _t_value *__restrict__ y_p) |
Calculates y=Ax, but does not allocate y itself. 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, LI > | |
SparseMatrix () | |
Base constructor. More... | |
SparseMatrix (const LInzs, const LInr, const LInc, 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... | |
Protected Attributes | |
size_t | jumps |
The number of row jumps. More... | |
LI * | r_inc |
Stores the row jumps; size is at maximum the number of nonzeros. More... | |
LI * | c_inc |
Stores the column jumps; size is exactly the number of nonzeros. More... | |
Matrix< _t_value > ** | vals |
Stores the values individual storage schemes. More... | |
ULI | ntt |
Caches n times two. More... | |
Protected Attributes inherited from SparseMatrix< _t_value, LI > | |
LI | nor |
Number of rows. More... | |
LI | noc |
Number of columns. | |
LI | nnz |
Number of non-zeros. More... | |
Additional Inherited Members | |
Public Attributes inherited from SparseMatrix< _t_value, LI > | |
_t_value | zero_element |
The element considered to be zero. More... | |
Hierarchical Bi-directional Incremental Compressed Row Storage scheme.
Stores other SparseMatrix data structures, can include other HBICRS schemes, but this is not recommended with regards to efficiency. Supports jumping back and forward within columns. Supports jumping back and forward between rows. Main storage direction in column-wise. Storage requirements are 2nz plus the number of row jumps required, plus the storage requirements for each stored data structure, of course. Many row jumps are disadvantageous to storage as well as speed.
_t_value | The type of the nonzeros in the matrix. |
This class is based on the BICRS as per revision 75. BICRS was chosen since it is an all-round improvement over Triplets, with the additional advantage of being pointer based (no jumps required when going recursive into deeper storage schemes).
Warning: this class uses assertions! For optimal performance, define the NDEBUG flag (e.g., pass -DNDEBUG as a compiler flag).
|
inline |
Base constructor.
Will read in from Matrix Market file.
|
inline |
Base constructor.
|
inline |
Base constructor.
|
inlinevirtual |
Function to query the amount of storage required by this sparse matrix.
Implements Matrix< _t_value >.
Referenced by HBICRS< T >::bytesUsed(), and BlockHilbert< T >::bytesUsed().
|
inlinevirtual |
Implements SparseMatrix< _t_value, LI >.
Referenced by BlockHilbert< T >::getFirstIndexPair().
|
inlinevirtual |
This function will rewrite the std::vector< Triplet > structure to one suitable for the other load function.
Implements SparseMatrix< _t_value, LI >.
Referenced by HBICRS< T >::HBICRS(), and HBICRS< T >::load().
|
inlinevirtual |
Constructs the hierarchical part.
Note that this function does not do anything with offsets, due to lack of support in the other datastructures used.
|
inline |
Builds the BICRS structure.
|
inlinevirtual |
Calculates y=Ax, but does not allocate y itself.
x_p | The input vector should be initialised and of correct measurements. |
y_p | The output vector should be preallocated and of size m. Furthermore, y[i]=0 for all i, 0<=i<m. |
Implements SparseMatrix< _t_value, LI >.
Referenced by BlockHilbert< T >::zax().
|
inlinevirtual |
Calculates y=xA, but does not allocate y itself.
x_p | The input vector should be initialised and of correct measurements. |
y_p | The output vector should be preallocated and of size m. Furthermore, y[i]=0 for all i, 0<=i<m. |
Implements SparseMatrix< _t_value, LI >.
Referenced by BlockHilbert< T >::zxa().
|
protected |
Stores the column jumps; size is exactly the number of nonzeros.
Referenced by HBICRS< T >::getFirstIndexPair(), HBICRS< T >::load(), HBICRS< T >::zax(), HBICRS< T >::zxa(), and HBICRS< T >::~HBICRS().
|
protected |
The number of row jumps.
Referenced by HBICRS< T >::bytesUsed(), and HBICRS< T >::load().
|
protected |
Caches n times two.
Referenced by HBICRS< T >::load(), HBICRS< T >::zax(), and HBICRS< T >::zxa().
|
protected |
Stores the row jumps; size is at maximum the number of nonzeros.
Referenced by HBICRS< T >::getFirstIndexPair(), HBICRS< T >::load(), HBICRS< T >::zax(), HBICRS< T >::zxa(), and HBICRS< T >::~HBICRS().
Stores the values individual storage schemes.
Referenced by HBICRS< T >::bytesUsed(), HBICRS< T >::load(), HBICRS< T >::zax(), HBICRS< T >::zxa(), and HBICRS< T >::~HBICRS().