Hybrid (HYB) 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 ) |
hyb_matrix
is a combination of the ell_matrix
and coo_matrix
formats. Specifically, the hyb_matrix
format splits a matrix into two portions, one stored in ELL format and one stored in COO format.While the ELL format is well-suited to vector and SIMD architectures, its efficiency rapidly degrades when the number of nonzeros per matrix row varies. In contrast, the storage efficiency of the COO format is invariant to the distribution of nonzeros per row, and the use of segmented reduction makes its performance largely invariant as well. To obtain the advantages of both, we combine these into a hybrid ELL/COO format.
The purpose of the HYB format is to store the typical number of nonzeros per row in the ELL data structure and the remaining entries of exceptional rows in the COO format.
ell_matrix
entries must be sorted by column index. ell_matrix
entries within each row should be shifted to the left. coo_matrix
entries must be sorted by row index. hyb_matrix
. In practice we usually do not construct the HYB format directly and instead convert from a simpler format such as (COO, CSR) into HYB.ell_matrix
coo_matrix
Definition at line 142 of file hyb_matrix.h.
#include <hyb_matrix.h>
Public Methods | |
hyb_matrix (void) | |
hyb_matrix (IndexType num_rows, IndexType num_cols, IndexType num_ell_entries, IndexType num_coo_entries, IndexType num_entries_per_row, IndexType alignment=32) | |
template<typename MatrixType > | |
hyb_matrix (const MatrixType &matrix) | |
void | resize (IndexType num_rows, IndexType num_cols, IndexType num_ell_entries, IndexType num_coo_entries, IndexType num_entries_per_row, IndexType alignment=32) |
void | swap (hyb_matrix &matrix) |
template<typename MatrixType > | |
hyb_matrix & | operator= (const MatrixType &matrix) |
Public Members | |
ell_matrix_type | ell |
coo_matrix_type | coo |
|
inline |
Construct an empty hyb_matrix
.
Definition at line 186 of file hyb_matrix.h.
|
inline |
Construct a hyb_matrix
with a specific shape and separation into ELL and COO portions.
num_rows | Number of rows. |
num_cols | Number of columns. |
num_ell_entries | Number of nonzero matrix entries in the ELL portion. |
num_coo_entries | Number of nonzero matrix entries in the ELL portion. |
num_entries_per_row | Maximum number of nonzeros per row in the ELL portion. |
alignment | Amount of padding used to align the ELL data structure (default 32). |
Definition at line 197 of file hyb_matrix.h.
cusp::hyb_matrix< IndexType, ValueType, MemorySpace >::hyb_matrix | ( | const MatrixType & | matrix | ) |
Construct a hyb_matrix
from another matrix.
matrix | Another sparse or dense matrix. |
hyb_matrix& cusp::hyb_matrix< IndexType, ValueType, MemorySpace >::operator= | ( | const MatrixType & | matrix | ) |
Assignment from another matrix.
matrix | Another sparse or dense matrix. |
|
inline |
Resize matrix dimensions and underlying storage
Definition at line 215 of file hyb_matrix.h.
|
inline |
Swap the contents of two hyb_matrix
objects.
matrix | Another hyb_matrix with the same IndexType and ValueType. |
Definition at line 228 of file hyb_matrix.h.
coo_matrix_type cusp::hyb_matrix< IndexType, ValueType, MemorySpace >::coo |
Storage for the ell_matrix
portion.
Definition at line 182 of file hyb_matrix.h.
ell_matrix_type cusp::hyb_matrix< IndexType, ValueType, MemorySpace >::ell |
Storage for the ell_matrix
portion.
Definition at line 178 of file hyb_matrix.h.