Coordinate sparse matrix format. More...
#include <spm.h>
Public Member Functions | |
| CooSpM (int nrows, int ncols, int maxnonzero) | |
| 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. | |
| int | arrayLength () const |
| Gets the length of the internal data array. | |
| const TI * | internalRowIndexArray () const |
| Gets the row indices array. | |
| TI * | internalRowIndexArray () |
| Gets the row indices array. | |
| const TI * | internalColumnIndexArray () const |
| Gets the column indices array. | |
| TI * | internalColumnIndexArray () |
| Gets the column indices 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 | getNonzeroCount () const |
| Gets the maximum number of nonzero elements. | |
| void | toDenseMatrix (TD *mat) const |
| Converts the sparse matrix to a dense matrix. | |
Coordinate sparse matrix format.
See N. Bell and M. Garland, "Efficient Sparse Matrix-Vector Multiplication on CUDA", NVIDIA Technical Report NVR-2008-004.
| gridripper::math::CooSpM< TD, TI >::CooSpM | ( | int | nrows, | |
| int | ncols, | |||
| int | maxnonzero | |||
| ) | [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 | number of nonzero elements per row |
| int gridripper::math::CooSpM< TD, TI >::arrayLength | ( | ) | const [inline] |
Gets the length of the internal data array.
| int gridripper::math::CooSpM< 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::CooSpM< TD, TI >::getNonzeroCount | ( | ) | const [inline] |
Gets the maximum number of nonzero elements.
| void gridripper::math::CooSpM< 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 >.
| const TD* gridripper::math::CooSpM< TD, TI >::internalArray | ( | ) | const [inline] |
Gets the data array.
| TD* gridripper::math::CooSpM< TD, TI >::internalArray | ( | ) | [inline] |
Gets the data array.
| TI* gridripper::math::CooSpM< TD, TI >::internalColumnIndexArray | ( | ) | [inline] |
Gets the column indices array.
| const TI* gridripper::math::CooSpM< TD, TI >::internalColumnIndexArray | ( | ) | const [inline] |
Gets the column indices array.
| TI* gridripper::math::CooSpM< TD, TI >::internalRowIndexArray | ( | ) | [inline] |
Gets the row indices array.
| const TI* gridripper::math::CooSpM< TD, TI >::internalRowIndexArray | ( | ) | const [inline] |
Gets the row indices array.
| void gridripper::math::CooSpM< 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 |
| void gridripper::math::CooSpM< 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::CooSpM< 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