template<typename IndexType, typename ValueType, typename MemorySpace>
class cusp::ell_matrix< IndexType, ValueType, MemorySpace >
Packed row (ELLPACK/ITPACK) representation of a sparse matrix.
- Template Parameters
-
IndexType | Type used for matrix indices (e.g. int ). |
ValueType | Type used for matrix values (e.g. float ). |
MemorySpace | A memory space (e.g. cusp::host_memory or cusp::device_memory ) |
- Overview
- Note
- The matrix entries must be sorted by column index.
-
The matrix entries within each row should be shifted to the left.
-
The matrix should not contain duplicate entries.
- Example
- The following code snippet demonstrates how to create a 4-by-3
ell_matrix
on the host with 3 nonzeros per row (6 total nonzeros) and then copies the matrix to the device.
int main()
{
A.column_indices(0,0) = 0; A.
values(0,0) = 10;
A.column_indices(0,1) = 2; A.
values(0,1) = 20;
A.column_indices(0,2) = X; A.
values(0,2) = 0;
A.column_indices(1,0) = X; A.
values(1,0) = 0;
A.column_indices(1,1) = X; A.
values(1,1) = 0;
A.column_indices(1,2) = X; A.
values(1,2) = 0;
A.column_indices(2,0) = 2; A.
values(2,0) = 30;
A.column_indices(2,1) = X; A.
values(2,1) = 0;
A.column_indices(2,2) = X; A.
values(2,2) = 0;
A.column_indices(3,0) = 0; A.
values(3,0) = 40;
A.column_indices(3,1) = 1; A.
values(3,1) = 50;
A.column_indices(3,2) = 2; A.
values(3,2) = 60;
}
- Examples:
- ell.cu, and hyb.cu.
Definition at line 122 of file ell_matrix.h.
|
| ell_matrix (void) |
|
| ell_matrix (const size_t num_rows, const size_t num_cols, const size_t num_entries, const size_t num_entries_per_row, const size_t alignment=32) |
|
template<typename MatrixType > |
| ell_matrix (const MatrixType &matrix) |
|
void | resize (const size_t num_rows, const size_t num_cols, const size_t num_entries, const size_t num_entries_per_row) |
|
void | resize (const size_t num_rows, const size_t num_cols, const size_t num_entries, const size_t num_entries_per_row, const size_t alignment) |
|
void | swap (ell_matrix &matrix) |
|
template<typename MatrixType > |
ell_matrix & | operator= (const MatrixType &matrix) |
|