ELLPACK sparse matrix format. More...
#include <spm.h>
Public Member Functions | |
EllSpM (int nrows, int ncols, int nonzero) | |
Creates a sparse matrix with the specified number of rows and (nonzero) diagonals. | |
void | realloc (int nrows, int ncols, int nonzero) |
Reallocates memory (if needed). | |
void | set (int row, int col, TD v, int i) |
Sets a matrix element. | |
const TD * | internalArray () const |
Gets the data array. | |
TD * | internalArray () |
Gets the data array. | |
const TI * | internalColumnIndexArray () const |
Gets the indices array. | |
TI * | internalColumnIndexArray () |
Gets the indices array. | |
int | arrayLength () const |
Gets the length of the internal data array. | |
int | countNonzerosInRow (int row) const |
Gets the number of nonzeros in the specified row. | |
void | gmv (TD *y, TD alpha, const TD *x, TD beta, const TD *b) const |
General matrix-vector operation. | |
int | getMaxNonzerosPerRow () const |
Gets the maximum number of nonzero elements per row. | |
void | toDenseMatrix (TD *mat) const |
Converts the sparse matrix to a dense matrix. |
ELLPACK sparse matrix format.
See N. Bell and M. Garland, "Efficient Sparse Matrix-Vector Multiplication on CUDA", NVIDIA Technical Report NVR-2008-004.
gridripper::math::EllSpM< TD, TI >::EllSpM | ( | int | nrows, | |
int | ncols, | |||
int | nonzero | |||
) | [inline] |
Creates a sparse matrix with the specified number of rows and (nonzero) diagonals.
nrows | the number of rows | |
ncols | the number of columns | |
nonzero | maximum number of nonzero elements per row |
int gridripper::math::EllSpM< TD, TI >::arrayLength | ( | ) | const [inline] |
Gets the length of the internal data array.
int gridripper::math::EllSpM< TD, TI >::countNonzerosInRow | ( | int | row | ) | const [inline, virtual] |
Gets the number of nonzeros in the specified row.
row | the row index |
Implements gridripper::math::SpM< TD >.
int gridripper::math::EllSpM< TD, TI >::getMaxNonzerosPerRow | ( | ) | const [inline] |
Gets the maximum number of nonzero elements per row.
void gridripper::math::EllSpM< TD, TI >::gmv | ( | TD * | y, | |
TD | alpha, | |||
const TD * | x, | |||
TD | beta, | |||
const TD * | b | |||
) | const [inline, virtual] |
General matrix-vector operation.
Computes y = alpha*A*x + beta*b.
y | the output vector | |
alpha | scalar multiplier applied to A | |
x | the x vector | |
beta | scalar multiplier applied to b | |
b | the b vector or NULL |
Implements gridripper::math::SpM< TD >.
TD* gridripper::math::EllSpM< TD, TI >::internalArray | ( | ) | [inline] |
Gets the data array.
const TD* gridripper::math::EllSpM< TD, TI >::internalArray | ( | ) | const [inline] |
Gets the data array.
const TI* gridripper::math::EllSpM< TD, TI >::internalColumnIndexArray | ( | ) | const [inline] |
Gets the indices array.
TI* gridripper::math::EllSpM< TD, TI >::internalColumnIndexArray | ( | ) | [inline] |
Gets the indices array.
void gridripper::math::EllSpM< TD, TI >::realloc | ( | int | nrows, | |
int | ncols, | |||
int | nonzero | |||
) | [inline] |
Reallocates memory (if needed).
nrows | new number of rows | |
ncols | new number of columns | |
nonzero | maximum number of nonzero elements per row |
void gridripper::math::EllSpM< TD, TI >::set | ( | int | row, | |
int | col, | |||
TD | v, | |||
int | i | |||
) | [inline] |
Sets a matrix element.
row | the row index | |
col | the column | |
v | the value | |
i | index |
void gridripper::math::EllSpM< TD, TI >::toDenseMatrix | ( | TD * | mat | ) | const [inline, virtual] |
Converts the sparse matrix to a dense matrix.
mat | output array for the dense matrix |
Implements gridripper::math::SpM< TD >.