23#include <cusp/detail/config.h>
26#include <cusp/memory.h>
28#include <cusp/detail/format.h>
29#include <cusp/detail/matrix_base.h>
30#include <cusp/detail/type_traits.h>
36template <
typename ArrayType1,
typename ArrayType2,
typename ArrayType3,
typename IndexType,
typename ValueType,
typename MemorySpace>
class csr_matrix_view;
106template <
typename IndexType,
typename ValueType,
class MemorySpace>
107class csr_matrix :
public cusp::detail::matrix_base<IndexType,ValueType,MemorySpace,cusp::csr_format>
111 typedef cusp::detail::matrix_base<IndexType,ValueType,MemorySpace,cusp::csr_format> Parent;
123 typename column_indices_array_type::view,
124 typename values_array_type::view,
125 IndexType, ValueType, MemorySpace> view;
128 typename column_indices_array_type::const_view,
129 typename values_array_type::const_view,
130 IndexType, ValueType, MemorySpace> const_view;
133 column_indices_array_type,
135 cusp::csr_format>::view coo_view_type;
137 column_indices_array_type,
139 cusp::csr_format>::view const_coo_view_type;
141 template<
typename MemorySpace2>
170 csr_matrix(
size_t num_rows,
size_t num_cols,
size_t num_entries)
171 : Parent(num_rows, num_cols, num_entries),
183 template <
typename MatrixType>
192 void resize(
const size_t num_rows,
const size_t num_cols,
const size_t num_entries);
207 template <
typename MatrixType>
299template <
typename ArrayType1,
302 typename IndexType =
typename ArrayType1::value_type,
303 typename ValueType =
typename ArrayType3::value_type,
304 typename MemorySpace =
typename cusp::minimum_space<
305 typename ArrayType1::memory_space,
306 typename ArrayType2::memory_space,
307 typename ArrayType3::memory_space>::type >
308class csr_matrix_view :
public cusp::detail::matrix_base<IndexType,ValueType,MemorySpace,cusp::csr_format>
312 typedef cusp::detail::matrix_base<IndexType,ValueType,MemorySpace,cusp::csr_format> Parent;
317 typedef ArrayType1 row_offsets_array_type;
318 typedef ArrayType2 column_indices_array_type;
319 typedef ArrayType3 values_array_type;
326 column_indices_array_type,
328 cusp::csr_format>::view coo_view_type;
330 column_indices_array_type,
332 cusp::csr_format>::view const_coo_view_type;
368 const size_t num_cols,
369 const size_t num_entries,
373 : Parent(num_rows, num_cols, num_entries),
424 void resize(
const size_t num_rows,
const size_t num_cols,
const size_t num_entries);
445template <
typename ArrayType1,
452 ArrayType1 row_offsets,
453 ArrayType2 column_indices,
457 view(num_rows, num_cols, num_entries, row_offsets, column_indices, values);
478template <
typename ArrayType1,
483 typename MemorySpace>
484csr_matrix_view<ArrayType1,ArrayType2,ArrayType3,IndexType,ValueType,MemorySpace>
502template <
typename IndexType,
typename ValueType,
class MemorySpace>
503typename csr_matrix<IndexType,ValueType,MemorySpace>::view
507 (m.num_rows, m.num_cols, m.num_entries,
525template <
typename IndexType,
typename ValueType,
class MemorySpace>
526typename csr_matrix<IndexType,ValueType,MemorySpace>::const_view
530 (m.num_rows, m.num_cols, m.num_entries,
540#include <cusp/detail/csr_matrix.inl>
1D array of elements that may reside in "host" or "device" memory space
The array1d class is a 1D vector container that may contain elements stored in "host" or "device" mem...
csr_matrix_view(const csr_matrix< IndexType, ValueType, MemorySpace > &matrix)
csr_matrix_view(const size_t num_rows, const size_t num_cols, const size_t num_entries, ArrayType1 row_offsets, ArrayType2 column_indices, ArrayType3 values)
csr_matrix_view(const csr_matrix_view &matrix)
csr_matrix_view(csr_matrix_view &matrix)
row_offsets_array_type row_offsets
void resize(const size_t num_rows, const size_t num_cols, const size_t num_entries)
csr_matrix_view(csr_matrix< IndexType, ValueType, MemorySpace > &matrix)
column_indices_array_type column_indices
Compressed sparse row (CSR) representation a sparse matrix.
void swap(csr_matrix &matrix)
row_offsets_array_type row_offsets
column_indices_array_type column_indices
csr_matrix(size_t num_rows, size_t num_cols, size_t num_entries)
csr_matrix(const MatrixType &matrix)
void resize(const size_t num_rows, const size_t num_cols, const size_t num_entries)
csr_matrix & operator=(const MatrixType &matrix)
array1d_view< Iterator > make_array1d_view(Iterator first, Iterator last)
csr_matrix_view< ArrayType1, ArrayType2, ArrayType3 > make_csr_matrix_view(size_t num_rows, size_t num_cols, size_t num_entries, ArrayType1 row_offsets, ArrayType2 column_indices, ArrayType3 values)