Diagonal (DIA) representation a sparse matrix.
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 ) |
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.dia_matrix
on the host with 3 diagonals (6 total nonzeros) and then copies the matrix to the device.Definition at line 119 of file dia_matrix.h.
#include <dia_matrix.h>
Public Methods | |
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) |
Public Members | |
diagonal_offsets_array_type | diagonal_offsets |
values_array_type | values |
|
inline |
Construct an empty dia_matrix_view
.
Definition at line 165 of file dia_matrix.h.
cusp::dia_matrix< IndexType, ValueType, MemorySpace >::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 |
||
) |
Construct a dia_matrix
with a specific shape, number of nonzero entries, and number of occupied diagonals.
num_rows | Number of rows. |
num_cols | Number of columns. |
num_entries | Number of nonzero matrix entries. |
num_diagonals | Number of occupied diagonals. |
alignment | Amount of padding used to align the data structure (default 32). |
cusp::dia_matrix< IndexType, ValueType, MemorySpace >::dia_matrix | ( | const MatrixType & | matrix | ) |
Construct a dia_matrix
from another matrix.
matrix | Another sparse or dense matrix. |
dia_matrix& cusp::dia_matrix< IndexType, ValueType, MemorySpace >::operator= | ( | const MatrixType & | matrix | ) |
Assignment from another matrix.
matrix | Another sparse or dense matrix. |
void cusp::dia_matrix< IndexType, ValueType, MemorySpace >::resize | ( | const size_t | num_rows, |
const size_t | num_cols, | ||
const size_t | num_entries, | ||
const size_t | num_diagonals | ||
) |
Resize matrix dimensions and underlying storage
num_rows | Number of rows. |
num_cols | Number of columns. |
num_entries | Number of nonzero matrix entries. |
num_diagonals | Number of occupied diagonals. |
void cusp::dia_matrix< IndexType, ValueType, MemorySpace >::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 | ||
) |
Resize matrix dimensions and underlying storage
num_rows | Number of rows. |
num_cols | Number of columns. |
num_entries | Number of nonzero matrix entries. |
num_diagonals | Number of occupied diagonals. |
alignment | Amount of padding used to align the data structure (default 32). |
void cusp::dia_matrix< IndexType, ValueType, MemorySpace >::swap | ( | dia_matrix< IndexType, ValueType, MemorySpace > & | matrix | ) |
Swap the contents of two dia_matrix
objects.
matrix | Another dia_matrix with the same IndexType and ValueType. |
diagonal_offsets_array_type cusp::dia_matrix< IndexType, ValueType, MemorySpace >::diagonal_offsets |
Storage for the diagonal offsets.
Definition at line 156 of file dia_matrix.h.
values_array_type cusp::dia_matrix< IndexType, ValueType, MemorySpace >::values |
Storage for the nonzero entries of the DIA data structure.
Definition at line 160 of file dia_matrix.h.