Diagonal sparse matrix format. More...
#include <spm.h>
Public Member Functions | |
| DiaSpM (int nrows, int ncols, int ndia) | |
| Creates a sparse matrix with the specified number of rows and (nonzero) diagonals. | |
| void | realloc (int nrows, int ncols, int ndia) |
| Reallocates memory (if needed). | |
| void | setOffset (int dia, TI offset) |
| Sets the offset of a diagonal. | |
| void | set (int row, int dia, TD v) |
| Sets a matrix element. | |
| const TD * | internalArray () const |
| Gets the data array. | |
| TD * | internalArray () |
| Gets the data array. | |
| int | arrayLength () const |
| Gets the length of the internal data array. | |
| const TI * | internalOffsetArray () const |
| Gets the offset array. | |
| TI * | internalOffsetArray () |
| Gets the offset array. | |
| int | getNumDiagonals () const |
| Gets the number of diagonals with nonzero elements. | |
| 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. | |
| void | toDenseMatrix (TD *mat) const |
| Converts the sparse matrix to a dense matrix. | |
Diagonal sparse matrix format.
See N. Bell and M. Garland, "Efficient Sparse Matrix-Vector Multiplication on CUDA", NVIDIA Technical Report NVR-2008-004.
| gridripper::math::DiaSpM< TD, TI >::DiaSpM | ( | int | nrows, | |
| int | ncols, | |||
| int | ndia | |||
| ) | [inline] |
Creates a sparse matrix with the specified number of rows and (nonzero) diagonals.
| nrows | the number of rows | |
| ncols | the number of columns | |
| ndia | the number of diagonals |
| int gridripper::math::DiaSpM< TD, TI >::arrayLength | ( | ) | const [inline] |
Gets the length of the internal data array.
| int gridripper::math::DiaSpM< 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::DiaSpM< TD, TI >::getNumDiagonals | ( | ) | const [inline] |
Gets the number of diagonals with nonzero elements.
| void gridripper::math::DiaSpM< 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::DiaSpM< TD, TI >::internalArray | ( | ) | [inline] |
Gets the data array.
| const TD* gridripper::math::DiaSpM< TD, TI >::internalArray | ( | ) | const [inline] |
Gets the data array.
| TI* gridripper::math::DiaSpM< TD, TI >::internalOffsetArray | ( | ) | [inline] |
Gets the offset array.
Its length is returned by {
| const TI* gridripper::math::DiaSpM< TD, TI >::internalOffsetArray | ( | ) | const [inline] |
Gets the offset array.
Its length is returned by {
| void gridripper::math::DiaSpM< TD, TI >::realloc | ( | int | nrows, | |
| int | ncols, | |||
| int | ndia | |||
| ) | [inline] |
Reallocates memory (if needed).
| nrows | new number of rows | |
| ncols | new number of columns | |
| ndia | new number of diagonals |
| void gridripper::math::DiaSpM< TD, TI >::set | ( | int | row, | |
| int | dia, | |||
| TD | v | |||
| ) | [inline] |
Sets a matrix element.
| row | the row index | |
| dia | the diagonal index | |
| v | the value |
| void gridripper::math::DiaSpM< TD, TI >::setOffset | ( | int | dia, | |
| TI | offset | |||
| ) | [inline] |
Sets the offset of a diagonal.
| dia | the diagonal index | |
| offset | the offset |
| void gridripper::math::DiaSpM< 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 >.
1.7.1