template<typename ArrayType1, typename ArrayType2, typename ArrayType3, typename IndexType = typename ArrayType2::value_type, typename ValueType = typename ArrayType3::value_type, typename MemorySpace = typename cusp::minimum_space< typename ArrayType1::memory_space, typename ArrayType2::memory_space, typename ArrayType3::memory_space>::type>
class cusp::coo_matrix_view< ArrayType1, ArrayType2, ArrayType3, IndexType, ValueType, MemorySpace >
View of a coo_matrix
.
- Template Parameters
-
ArrayType1 | Type of row_indices array view |
ArrayType2 | Type of column_indices array view |
ArrayType3 | Type of values array view |
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 row index.
-
The matrix should not contain duplicate entries.
A coo_matrix_view
is a sparse matrix view of a matrix in COO format constructed from existing data or iterators. All entries in the coo_matrix
are sorted according to row indices and internally within each row sorted by column indices.
- Example
- The following code snippet demonstrates how to create a 4-by-3
coo_matrix_view
on the host with 6 nonzeros.
int main()
{
typedef typename IndexArray::view IndexArrayView;
typedef typename ValueArray::view ValueArrayView;
4,3,6,
}
- Examples:
- cg_raw.cu.
Definition at line 306 of file coo_matrix.h.
#include <coo_matrix.h>
|
| coo_matrix_view (void) |
|
| coo_matrix_view (const size_t num_rows, const size_t num_cols, const size_t num_entries, ArrayType1 row_indices, ArrayType2 column_indices, ArrayType3 values) |
|
| coo_matrix_view (coo_matrix< IndexType, ValueType, MemorySpace > &matrix) |
|
| coo_matrix_view (const coo_matrix< IndexType, ValueType, MemorySpace > &matrix) |
|
| coo_matrix_view (view &matrix) |
|
| coo_matrix_view (const view &matrix) |
|
template<typename MatrixType > |
| coo_matrix_view (MatrixType &matrix) |
|
template<typename MatrixType > |
| coo_matrix_view (const MatrixType &matrix) |
|
void | resize (const size_t num_rows, const size_t num_cols, const size_t num_entries) |
|
void | sort_by_row (void) |
|
void | sort_by_row_and_column (void) |
|
bool | is_sorted_by_row (void) |
|
bool | is_sorted_by_row_and_column (void) |
|
|
template<typename MatrixType > |
void | construct_from (MatrixType &matrix, csr_format) |
|
template<typename MatrixType > |
void | construct_from (MatrixType &matrix, dia_format) |
|
template<typename MatrixType > |
void | construct_from (MatrixType &matrix, ell_format) |
|
template<typename MatrixType > |
void | construct_from (MatrixType &matrix, hyb_format) |
|
template<typename ArrayType1, typename ArrayType2, typename ArrayType3, typename IndexType = typename ArrayType2::value_type, typename ValueType = typename ArrayType3::value_type, typename MemorySpace = typename cusp::minimum_space< typename ArrayType1::memory_space, typename ArrayType2::memory_space, typename ArrayType3::memory_space>::type>
template<typename ArrayType1, typename ArrayType2, typename ArrayType3, typename IndexType = typename ArrayType2::value_type, typename ValueType = typename ArrayType3::value_type, typename MemorySpace = typename cusp::minimum_space< typename ArrayType1::memory_space, typename ArrayType2::memory_space, typename ArrayType3::memory_space>::type>
cusp::coo_matrix_view< ArrayType1, ArrayType2, ArrayType3, IndexType, ValueType, MemorySpace >::coo_matrix_view |
( |
const size_t |
num_rows, |
|
|
const size_t |
num_cols, |
|
|
const size_t |
num_entries, |
|
|
ArrayType1 |
row_indices, |
|
|
ArrayType2 |
column_indices, |
|
|
ArrayType3 |
values |
|
) |
| |
|
inline |
Construct a coo_matrix_view
with a specific shape and number of nonzero entries from existing arrays denoting the row indices, column indices, and values.
- Parameters
-
num_rows | Number of rows. |
num_cols | Number of columns. |
num_entries | Number of nonzero matrix entries. |
row_indices | Array containing the row indices. |
column_indices | Array containing the column indices. |
values | Array containing the values. |
Definition at line 364 of file coo_matrix.h.
template<typename ArrayType1, typename ArrayType2, typename ArrayType3, typename IndexType = typename ArrayType2::value_type, typename ValueType = typename ArrayType3::value_type, typename MemorySpace = typename cusp::minimum_space< typename ArrayType1::memory_space, typename ArrayType2::memory_space, typename ArrayType3::memory_space>::type>
template<typename ArrayType1, typename ArrayType2, typename ArrayType3, typename IndexType = typename ArrayType2::value_type, typename ValueType = typename ArrayType3::value_type, typename MemorySpace = typename cusp::minimum_space< typename ArrayType1::memory_space, typename ArrayType2::memory_space, typename ArrayType3::memory_space>::type>
template<typename ArrayType1, typename ArrayType2, typename ArrayType3, typename IndexType = typename ArrayType2::value_type, typename ValueType = typename ArrayType3::value_type, typename MemorySpace = typename cusp::minimum_space< typename ArrayType1::memory_space, typename ArrayType2::memory_space, typename ArrayType3::memory_space>::type>
template<typename ArrayType1, typename ArrayType2, typename ArrayType3, typename IndexType = typename ArrayType2::value_type, typename ValueType = typename ArrayType3::value_type, typename MemorySpace = typename cusp::minimum_space< typename ArrayType1::memory_space, typename ArrayType2::memory_space, typename ArrayType3::memory_space>::type>
template<typename ArrayType1, typename ArrayType2, typename ArrayType3, typename IndexType = typename ArrayType2::value_type, typename ValueType = typename ArrayType3::value_type, typename MemorySpace = typename cusp::minimum_space< typename ArrayType1::memory_space, typename ArrayType2::memory_space, typename ArrayType3::memory_space>::type>
template<typename MatrixType >
Construct a coo_matrix_view
from a existing matrix in another format.
- Parameters
-
matrix | used to create view. |
template<typename ArrayType1, typename ArrayType2, typename ArrayType3, typename IndexType = typename ArrayType2::value_type, typename ValueType = typename ArrayType3::value_type, typename MemorySpace = typename cusp::minimum_space< typename ArrayType1::memory_space, typename ArrayType2::memory_space, typename ArrayType3::memory_space>::type>
template<typename MatrixType >
Construct a coo_matrix_view
from a existing const matrix in another format.
- Parameters
-
matrix | used to create view. |
template<typename ArrayType1, typename ArrayType2, typename ArrayType3, typename IndexType = typename ArrayType2::value_type, typename ValueType = typename ArrayType3::value_type, typename MemorySpace = typename cusp::minimum_space< typename ArrayType1::memory_space, typename ArrayType2::memory_space, typename ArrayType3::memory_space>::type>
template<typename MatrixType >
void cusp::coo_matrix_view< ArrayType1, ArrayType2, ArrayType3, IndexType, ValueType, MemorySpace >::construct_from |
( |
MatrixType & |
matrix, |
|
|
csr_format |
|
|
) |
| |
|
protected |
template<typename ArrayType1, typename ArrayType2, typename ArrayType3, typename IndexType = typename ArrayType2::value_type, typename ValueType = typename ArrayType3::value_type, typename MemorySpace = typename cusp::minimum_space< typename ArrayType1::memory_space, typename ArrayType2::memory_space, typename ArrayType3::memory_space>::type>
template<typename MatrixType >
void cusp::coo_matrix_view< ArrayType1, ArrayType2, ArrayType3, IndexType, ValueType, MemorySpace >::construct_from |
( |
MatrixType & |
matrix, |
|
|
dia_format |
|
|
) |
| |
|
protected |
template<typename ArrayType1, typename ArrayType2, typename ArrayType3, typename IndexType = typename ArrayType2::value_type, typename ValueType = typename ArrayType3::value_type, typename MemorySpace = typename cusp::minimum_space< typename ArrayType1::memory_space, typename ArrayType2::memory_space, typename ArrayType3::memory_space>::type>
template<typename MatrixType >
void cusp::coo_matrix_view< ArrayType1, ArrayType2, ArrayType3, IndexType, ValueType, MemorySpace >::construct_from |
( |
MatrixType & |
matrix, |
|
|
ell_format |
|
|
) |
| |
|
protected |
template<typename ArrayType1, typename ArrayType2, typename ArrayType3, typename IndexType = typename ArrayType2::value_type, typename ValueType = typename ArrayType3::value_type, typename MemorySpace = typename cusp::minimum_space< typename ArrayType1::memory_space, typename ArrayType2::memory_space, typename ArrayType3::memory_space>::type>
template<typename MatrixType >
void cusp::coo_matrix_view< ArrayType1, ArrayType2, ArrayType3, IndexType, ValueType, MemorySpace >::construct_from |
( |
MatrixType & |
matrix, |
|
|
hyb_format |
|
|
) |
| |
|
protected |
template<typename ArrayType1, typename ArrayType2, typename ArrayType3, typename IndexType = typename ArrayType2::value_type, typename ValueType = typename ArrayType3::value_type, typename MemorySpace = typename cusp::minimum_space< typename ArrayType1::memory_space, typename ArrayType2::memory_space, typename ArrayType3::memory_space>::type>
bool cusp::coo_matrix_view< ArrayType1, ArrayType2, ArrayType3, IndexType, ValueType, MemorySpace >::is_sorted_by_row |
( |
void |
| ) |
|
Determine whether matrix elements are sorted by row index
- Returns
false
, if the row indices are unsorted; true
, otherwise.
template<typename ArrayType1, typename ArrayType2, typename ArrayType3, typename IndexType = typename ArrayType2::value_type, typename ValueType = typename ArrayType3::value_type, typename MemorySpace = typename cusp::minimum_space< typename ArrayType1::memory_space, typename ArrayType2::memory_space, typename ArrayType3::memory_space>::type>
bool cusp::coo_matrix_view< ArrayType1, ArrayType2, ArrayType3, IndexType, ValueType, MemorySpace >::is_sorted_by_row_and_column |
( |
void |
| ) |
|
Determine whether matrix elements are sorted by row and column index
- Returns
false
, if the row and column indices are unsorted; true
, otherwise.
template<typename ArrayType1, typename ArrayType2, typename ArrayType3, typename IndexType = typename ArrayType2::value_type, typename ValueType = typename ArrayType3::value_type, typename MemorySpace = typename cusp::minimum_space< typename ArrayType1::memory_space, typename ArrayType2::memory_space, typename ArrayType3::memory_space>::type>
void cusp::coo_matrix_view< ArrayType1, ArrayType2, ArrayType3, 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
- Parameters
-
num_rows | Number of rows. |
num_cols | Number of columns. |
num_entries | Number of nonzero matrix entries. |
template<typename ArrayType1, typename ArrayType2, typename ArrayType3, typename IndexType = typename ArrayType2::value_type, typename ValueType = typename ArrayType3::value_type, typename MemorySpace = typename cusp::minimum_space< typename ArrayType1::memory_space, typename ArrayType2::memory_space, typename ArrayType3::memory_space>::type>
void cusp::coo_matrix_view< ArrayType1, ArrayType2, ArrayType3, IndexType, ValueType, MemorySpace >::sort_by_row |
( |
void |
| ) |
|
Sort matrix elements by row index
template<typename ArrayType1, typename ArrayType2, typename ArrayType3, typename IndexType = typename ArrayType2::value_type, typename ValueType = typename ArrayType3::value_type, typename MemorySpace = typename cusp::minimum_space< typename ArrayType1::memory_space, typename ArrayType2::memory_space, typename ArrayType3::memory_space>::type>
void cusp::coo_matrix_view< ArrayType1, ArrayType2, ArrayType3, IndexType, ValueType, MemorySpace >::sort_by_row_and_column |
( |
void |
| ) |
|
Sort matrix elements by row and column index
template<typename ArrayType1, typename ArrayType2, typename ArrayType3, typename IndexType = typename ArrayType2::value_type, typename ValueType = typename ArrayType3::value_type, typename MemorySpace = typename cusp::minimum_space< typename ArrayType1::memory_space, typename ArrayType2::memory_space, typename ArrayType3::memory_space>::type>
column_indices_array_type cusp::coo_matrix_view< ArrayType1, ArrayType2, ArrayType3, IndexType, ValueType, MemorySpace >::column_indices |
View of the column indices of the COO data structure.
Definition at line 335 of file coo_matrix.h.
template<typename ArrayType1, typename ArrayType2, typename ArrayType3, typename IndexType = typename ArrayType2::value_type, typename ValueType = typename ArrayType3::value_type, typename MemorySpace = typename cusp::minimum_space< typename ArrayType1::memory_space, typename ArrayType2::memory_space, typename ArrayType3::memory_space>::type>
cusp::array1d<typename thrust::detail::remove_const<IndexType>::type,MemorySpace> cusp::coo_matrix_view< ArrayType1, ArrayType2, ArrayType3, IndexType, ValueType, MemorySpace >::indices |
Storage for indices used to generate COO view.
Definition at line 345 of file coo_matrix.h.
template<typename ArrayType1, typename ArrayType2, typename ArrayType3, typename IndexType = typename ArrayType2::value_type, typename ValueType = typename ArrayType3::value_type, typename MemorySpace = typename cusp::minimum_space< typename ArrayType1::memory_space, typename ArrayType2::memory_space, typename ArrayType3::memory_space>::type>
row_indices_array_type cusp::coo_matrix_view< ArrayType1, ArrayType2, ArrayType3, IndexType, ValueType, MemorySpace >::row_indices |
View of the row indices of the COO data structure. Also called the "row pointer" array.
Definition at line 330 of file coo_matrix.h.
template<typename ArrayType1, typename ArrayType2, typename ArrayType3, typename IndexType = typename ArrayType2::value_type, typename ValueType = typename ArrayType3::value_type, typename MemorySpace = typename cusp::minimum_space< typename ArrayType1::memory_space, typename ArrayType2::memory_space, typename ArrayType3::memory_space>::type>
values_array_type cusp::coo_matrix_view< ArrayType1, ArrayType2, ArrayType3, IndexType, ValueType, MemorySpace >::values |
View for the nonzero entries of the COO data structure.
Definition at line 340 of file coo_matrix.h.