Compressed sparse row (CSR) 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 ) |
csr_matrix
is a sparse matrix container that stores an offset to the first entry of each row in matrix and one column entry per nonzero. The matrix may reside in either "host" or "device" memory depending on the MemorySpace. All entries in the csr_matrix
are sorted according to row and internally sorted within each row by column index.csr_matrix
on the host with 6 nonzeros and then copies the matrix to the device.Definition at line 105 of file csr_matrix.h.
#include <csr_matrix.h>
Public Methods | |
csr_matrix (void) | |
csr_matrix (size_t num_rows, size_t num_cols, size_t num_entries) | |
template<typename MatrixType > | |
csr_matrix (const MatrixType &matrix) | |
void | resize (const size_t num_rows, const size_t num_cols, const size_t num_entries) |
void | swap (csr_matrix &matrix) |
template<typename MatrixType > | |
csr_matrix & | operator= (const MatrixType &matrix) |
Public Members | |
row_offsets_array_type | row_offsets |
column_indices_array_type | column_indices |
values_array_type | values |
|
inline |
Construct an empty csr_matrix
.
Definition at line 154 of file csr_matrix.h.
|
inline |
Construct a csr_matrix
with a specific shape and number of nonzero entries.
num_rows | Number of rows. |
num_cols | Number of columns. |
num_entries | Number of nonzero matrix entries. |
Definition at line 162 of file csr_matrix.h.
cusp::csr_matrix< IndexType, ValueType, MemorySpace >::csr_matrix | ( | const MatrixType & | matrix | ) |
Construct a csr_matrix
from another matrix.
MatrixType | Type of input matrix used to create this csr_matrix . |
matrix | Another sparse or dense matrix. |
csr_matrix& cusp::csr_matrix< IndexType, ValueType, MemorySpace >::operator= | ( | const MatrixType & | matrix | ) |
Assignment from another matrix.
MatrixType | Type of input matrix to copy into this csr_matrix . |
matrix | Another sparse or dense matrix. |
void cusp::csr_matrix< IndexType, ValueType, MemorySpace >::resize | ( | const size_t | num_rows, |
const size_t | num_cols, | ||
const size_t | num_entries | ||
) |
Resize matrix dimensions and underlying storage
num_rows | Number of rows. |
num_cols | Number of columns. |
num_entries | Number of nonzero matrix entries. |
void cusp::csr_matrix< IndexType, ValueType, MemorySpace >::swap | ( | csr_matrix< IndexType, ValueType, MemorySpace > & | matrix | ) |
Swap the contents of two csr_matrix
objects.
matrix | Another csr_matrix with the same IndexType and ValueType. |
column_indices_array_type cusp::csr_matrix< IndexType, ValueType, MemorySpace >::column_indices |
Storage for the column indices of the CSR data structure.
Definition at line 146 of file csr_matrix.h.
row_offsets_array_type cusp::csr_matrix< IndexType, ValueType, MemorySpace >::row_offsets |
Storage for the row offsets of the CSR data structure. Also called the "row pointer" array.
Definition at line 142 of file csr_matrix.h.
values_array_type cusp::csr_matrix< IndexType, ValueType, MemorySpace >::values |
Storage for the nonzero entries of the CSR data structure.
Definition at line 150 of file csr_matrix.h.