|
| | dia_matrix (void) |
| |
| | dia_matrix (const size_t num_rows, const size_t num_cols, const size_t num_entries, const size_t num_diagonals, const size_t alignment=32) |
| |
| template<typename MatrixType > |
| | dia_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_diagonals) |
| |
| void | resize (const size_t num_rows, const size_t num_cols, const size_t num_entries, const size_t num_diagonals, const size_t alignment) |
| |
| void | swap (dia_matrix &matrix) |
| |
| template<typename MatrixType > |
| dia_matrix & | operator= (const MatrixType &matrix) |
| |
template<typename IndexType, typename ValueType, class MemorySpace>
class cusp::dia_matrix< IndexType, ValueType, MemorySpace >
Diagonal (DIA) representation 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
- A
dia_matrix is a sparse matrix container that stores each nonzero in a dense array2d container according to the diagonal each nonzero resides, the diagonal index of an ( i , j ) entry is | i - j |. This storage format is applicable to small set of matrices with significant structure. Storing the underlying entries in a array2d container avoids additional overhead associated with row or column indices but requires the storage of invalid entries associated with incomplete diagonals.
- Note
- The diagonal offsets should not contain duplicate entries.
- Example
- The following code snippet demonstrates how to create a 4-by-3
dia_matrix on the host with 3 diagonals (6 total nonzeros) and then copies the matrix to the device.
int main()
{
A.diagonal_offsets[0] = -2;
A.diagonal_offsets[1] = 0;
A.diagonal_offsets[2] = 1;
A.values(0,2) = 0;
A.values(1,2) = 0;
A.values(2,0) = 40;
A.values(3,0) = 60;
A.values(0,1) = 10;
A.values(1,1) = 0;
A.values(2,1) = 50;
A.values(3,1) = 50;
A.values(0,2) = 20;
A.values(1,2) = 30;
A.values(2,2) = 0;
A.values(3,2) = 0;
}
Diagonal (DIA) representation a sparse matrix.
void print(const Printable &p)
print a textual representation of an object
Print textual representation of an object.
Definition at line 120 of file dia_matrix.h.