A sparse square matrix in compressed sparse rows format.
More...
#include <compressed_matrix.hpp>
Public Member Functions |
| | compressed_matrix () |
| | Default construction of a compressed matrix. No memory is allocated.
|
| | compressed_matrix (std::size_t rows, std::size_t cols, std::size_t nonzeros=0) |
| | Construction of a compressed matrix with the supplied number of rows and columns. If the number of nonzeros is positive, memory is allocated.
|
| | compressed_matrix (cl_mem mem_row_buffer, cl_mem mem_col_buffer, cl_mem mem_elements, std::size_t rows, std::size_t cols, std::size_t nonzeros) |
| void | set (cl_uint *row_jumper, cl_uint *col_buffer, SCALARTYPE *elements, std::size_t rows, std::size_t cols, std::size_t nonzeros) |
| | Sets the row, column and value arrays of the compressed matrix.
|
| void | reserve (std::size_t new_nonzeros) |
| | Allocate memory for the supplied number of nonzeros in the matrix. Old values are preserved.
|
| void | resize (std::size_t new_size1, std::size_t new_size2, bool preserve=true) |
| | Resize the matrix.
|
| const std::size_t & | size1 () const |
| | Returns the number of rows.
|
| const std::size_t & | size2 () const |
| | Returns the number of columns.
|
| const std::size_t & | nnz () const |
| | Returns the number of nonzero entries.
|
const viennacl::ocl::handle
< cl_mem > & | handle1 () const |
| | Returns the OpenCL handle to the row index array.
|
const viennacl::ocl::handle
< cl_mem > & | handle2 () const |
| | Returns the OpenCL handle to the column index array.
|
const viennacl::ocl::handle
< cl_mem > & | handle () const |
| | Returns the OpenCL handle to the matrix entry array.
|
Detailed Description
template<class SCALARTYPE, unsigned int ALIGNMENT>
class viennacl::compressed_matrix< SCALARTYPE, ALIGNMENT >
A sparse square matrix in compressed sparse rows format.
- Template Parameters
-
| SCALARTYPE | The floating point type (either float or double, checked at compile time) |
| ALIGNMENT | The internal memory size for the entries in each row is given by (size()/ALIGNMENT + 1) * ALIGNMENT. ALIGNMENT must be a power of two. Best values or usually 4, 8 or 16, higher values are usually a waste of memory. |
Member Typedef Documentation
Constructor & Destructor Documentation
Default construction of a compressed matrix. No memory is allocated.
Construction of a compressed matrix with the supplied number of rows and columns. If the number of nonzeros is positive, memory is allocated.
- Parameters
-
| rows | Number of rows |
| cols | Number of columns |
| nonzeros | Optional number of nonzeros for memory preallocation |
| compressed_matrix |
( |
cl_mem |
mem_row_buffer, |
|
|
cl_mem |
mem_col_buffer, |
|
|
cl_mem |
mem_elements, |
|
|
std::size_t |
rows, |
|
|
std::size_t |
cols, |
|
|
std::size_t |
nonzeros |
|
) |
| |
|
inlineexplicit |
Member Function Documentation
Returns the OpenCL handle to the matrix entry array.
Returns the OpenCL handle to the row index array.
Returns the OpenCL handle to the column index array.
| const std::size_t& nnz |
( |
| ) |
const |
|
inline |
Returns the number of nonzero entries.
| void reserve |
( |
std::size_t |
new_nonzeros | ) |
|
|
inline |
Allocate memory for the supplied number of nonzeros in the matrix. Old values are preserved.
| void resize |
( |
std::size_t |
new_size1, |
|
|
std::size_t |
new_size2, |
|
|
bool |
preserve = true |
|
) |
| |
|
inline |
Resize the matrix.
- Parameters
-
| new_size1 | New number of rows |
| new_size2 | New number of columns |
| preserve | If true, the old values are preserved. At present, old values are always discarded. |
| void set |
( |
cl_uint * |
row_jumper, |
|
|
cl_uint * |
col_buffer, |
|
|
SCALARTYPE * |
elements, |
|
|
std::size_t |
rows, |
|
|
std::size_t |
cols, |
|
|
std::size_t |
nonzeros |
|
) |
| |
|
inline |
Sets the row, column and value arrays of the compressed matrix.
- Parameters
-
| row_jumper | Pointer to an array holding the indices of the first element of each row (starting with zero). E.g. row_jumper[10] returns the index of the first entry of the 11th row. The array length is 'cols + 1' |
| col_buffer | Pointer to an array holding the column index of each entry. The array length is 'nonzeros' |
| elements | Pointer to an array holding the entries of the sparse matrix. The array length is 'elements' |
| rows | Number of rows of the sparse matrix |
| cols | Number of columns of the sparse matrix |
| nonzeros | Number of nonzeros |
| const std::size_t& size1 |
( |
| ) |
const |
|
inline |
Returns the number of rows.
| const std::size_t& size2 |
( |
| ) |
const |
|
inline |
Returns the number of columns.
The documentation for this class was generated from the following file: