SparseLibrary
Version 1.6.0
|
Interface common to all sparse matrix storage schemes. More...
#include <SparseMatrix.hpp>
Public Member Functions | |
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... | |
virtual void | load (std::vector< Triplet< T > > &input, const IND m, const IND n, const T zero)=0 |
Function reading in from std::vector< Triplet< T > > format. More... | |
void | loadFromFile (const std::string file, const T zero=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 void | getFirstIndexPair (IND &row, IND &col)=0 |
Returns the first nonzero index, per reference. More... | |
virtual T * | mv (const T *x) |
Calculates and returns z=Ax. More... | |
virtual void | zax (const T *__restrict__ x, T *__restrict__ z)=0 |
In-place z=Ax function. More... | |
virtual void | zxa (const T *__restrict__ x, T *__restrict__ z)=0 |
In-place z=xA function. 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... | |
virtual size_t | bytesUsed ()=0 |
Function to query the amount of storage required by this sparse matrix. More... | |
Public Attributes | |
T | zero_element |
The element considered to be zero. More... | |
Protected Attributes | |
IND | nor |
Number of rows. More... | |
IND | noc |
Number of columns. | |
IND | nnz |
Number of non-zeros. More... | |
Interface common to all sparse matrix storage schemes.
|
inline |
Base constructor.
|
inline |
Base constructor.
|
inlinevirtual |
Base deconstructor.
|
pure virtual |
Returns the first nonzero index, per reference.
Implemented in BetaHilbert< T >, RDBHilbert< T, MatrixType >, RDScheme< T, DS >, vecBICRS< T, block_length_row, block_length_column, _i_value >, RDCSB< T >, BlockHilbert< T >, CBICRS< _t_value, _master_i_value, _master_j_value, _i_value, _j_value >, FBICRS< _t_value, _i_value, _sub_ds, logBeta >, HBICRS< _t_value >, HBICRS< T >, ICRS< T, _i_value >, McCRS< T >, ZZ_ICRS< T >, SVM< T >, CRS< T >, BICRS< _t_value, _i_value >, DD_MATRIX< T, number_of_diagonals, diagonal_offsets >, ZZ_CRS< T, _i_value >, HTS< T >, Hilbert< T >, CuHyb, CompressedHilbert< T >, CCSWrapper< T, SparseMatrixType, IND >, and TS< T >.
|
pure virtual |
Function reading in from std::vector< Triplet< T > > format.
input | The input matrix in triplet format. |
m | The number of rows of the input matrix. |
n | The number of columns of the input matrix. |
zero | Which element is to be considered zero. |
Implemented in vecBICRS< T, block_length_row, block_length_column, _i_value >, BlockHilbert< T >, RDBHilbert< T, MatrixType >, BetaHilbert< T >, RDScheme< T, DS >, CBICRS< _t_value, _master_i_value, _master_j_value, _i_value, _j_value >, RDCSB< T >, McCRS< T >, SVM< T >, ICRS< T, _i_value >, FBICRS< _t_value, _i_value, _sub_ds, logBeta >, CRS< T >, ZZ_ICRS< T >, ZZ_CRS< T, _i_value >, HTS< T >, HBICRS< _t_value >, HBICRS< T >, BICRS< _t_value, _i_value >, DD_MATRIX< T, number_of_diagonals, diagonal_offsets >, Hilbert< T >, CCSWrapper< T, SparseMatrixType, IND >, CompressedHilbert< T >, and TS< T >.
Referenced by SparseMatrix< double, size_t >::loadFromFile().
|
inline |
Function which loads a matrix from a matrix market file.
file | Filename (including path) to the matrix market file. |
zero | Which element is to be considered zero. |
|
inlinevirtual |
Queries the number of rows this matrix contains.
Implements Matrix< T >.
Reimplemented in CCSWrapper< T, SparseMatrixType, IND >.
Referenced by SparseMatrix< double, size_t >::loadFromFile().
|
inlinevirtual |
Calculates and returns z=Ax.
The vectors x should have appropiately set length; this is not enforced. Memory leaks, segmentation faults, the works; one or more of these will occur if dimensions do not make sense. The return array is allocated to length equal to the number of rows in this function.
Warning The output vector is aligned to 64-byte boundaries. Free the assigned memory using _mm_free!
x | The input (dense) x-vector. |
Implements Matrix< T >.
Reimplemented in BetaHilbert< T >, RDBHilbert< T, MatrixType >, RDScheme< T, DS >, RDCSB< T >, McCRS< T >, MKLCRS< T >, and CCSWrapper< T, SparseMatrixType, IND >.
|
inlinevirtual |
Queries the number of columns this matrix contains.
Implements Matrix< T >.
Reimplemented in CCSWrapper< T, SparseMatrixType, IND >.
Referenced by SparseMatrix< double, size_t >::loadFromFile().
|
inlinevirtual |
Queries the number of nonzeroes stored in this matrix.
Reimplemented from Matrix< T >.
Reimplemented in CCSWrapper< T, SparseMatrixType, IND >.
|
pure virtual |
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 Matrix< T >.
Implemented in vecBICRS< T, block_length_row, block_length_column, _i_value >, FBICRS< _t_value, _i_value, _sub_ds, logBeta >, CBICRS< _t_value, _master_i_value, _master_j_value, _i_value, _j_value >, HBICRS< _t_value >, HBICRS< T >, ICRS< T, _i_value >, ZZ_ICRS< T >, McCRS< T >, BICRS< _t_value, _i_value >, SVM< T >, CRS< T >, MKLCRS< T >, CCSWrapper< T, SparseMatrixType, IND >, and CuHyb.
Referenced by SparseMatrix< double, size_t >::mv().
|
pure virtual |
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 Matrix< T >.
Implemented in vecBICRS< T, block_length_row, block_length_column, _i_value >, CBICRS< _t_value, _master_i_value, _master_j_value, _i_value, _j_value >, FBICRS< _t_value, _i_value, _sub_ds, logBeta >, ICRS< T, _i_value >, HBICRS< _t_value >, HBICRS< T >, McCRS< T >, ZZ_ICRS< T >, SVM< T >, CRS< T >, BICRS< _t_value, _i_value >, MKLCRS< T >, CCSWrapper< T, SparseMatrixType, IND >, and CuHyb.
|
protected |
Number of non-zeros.
Referenced by SparseMatrix< double, size_t >::nzs().
|
protected |
Number of rows.
Referenced by SparseMatrix< double, size_t >::m(), and SparseMatrix< double, size_t >::mv().
T SparseMatrix< T, IND >::zero_element |
The element considered to be zero.
Referenced by SparseMatrix< double, size_t >::mv().