23 #include <cusp/detail/config.h>
26 #include <cusp/detail/format.h>
27 #include <cusp/detail/matrix_base.h>
28 #include <cusp/detail/type_traits.h>
34 template <
typename ArrayType1,
typename ArrayType2,
typename ArrayType3,
typename IndexType,
typename ValueType,
typename MemorySpace>
class csr_matrix_view;
104 template <
typename IndexType,
typename ValueType,
class MemorySpace>
105 class csr_matrix :
public cusp::detail::matrix_base<IndexType,ValueType,MemorySpace,cusp::csr_format>
109 typedef cusp::detail::matrix_base<IndexType,ValueType,MemorySpace,cusp::csr_format> Parent;
121 typename column_indices_array_type::view,
122 typename values_array_type::view,
123 IndexType, ValueType, MemorySpace> view;
126 typename column_indices_array_type::const_view,
127 typename values_array_type::const_view,
128 IndexType, ValueType, MemorySpace> const_view;
130 typedef typename cusp::detail::coo_view_type<container,cusp::csr_format>::view coo_view_type;
131 typedef typename cusp::detail::coo_view_type<container const,cusp::csr_format>::view const_coo_view_type;
133 template<
typename MemorySpace2>
162 csr_matrix(
size_t num_rows,
size_t num_cols,
size_t num_entries)
163 : Parent(num_rows, num_cols, num_entries),
175 template <
typename MatrixType>
184 void resize(
const size_t num_rows,
const size_t num_cols,
const size_t num_entries);
199 template <
typename MatrixType>
291 template <
typename ArrayType1,
294 typename IndexType =
typename ArrayType1::value_type,
295 typename ValueType =
typename ArrayType3::value_type,
296 typename MemorySpace =
typename cusp::minimum_space<
297 typename ArrayType1::memory_space,
298 typename ArrayType2::memory_space,
299 typename ArrayType3::memory_space>::type >
300 class csr_matrix_view :
public cusp::detail::matrix_base<IndexType,ValueType,MemorySpace,cusp::csr_format>
304 typedef cusp::detail::matrix_base<IndexType,ValueType,MemorySpace,cusp::csr_format> Parent;
309 typedef ArrayType1 row_offsets_array_type;
310 typedef ArrayType2 column_indices_array_type;
311 typedef ArrayType3 values_array_type;
317 typedef typename cusp::detail::coo_view_type<view,cusp::csr_format>::view coo_view_type;
318 typedef typename cusp::detail::coo_view_type<view const,cusp::csr_format>::view const_coo_view_type;
354 const size_t num_cols,
355 const size_t num_entries,
359 : Parent(num_rows, num_cols, num_entries),
360 row_offsets(row_offsets),
361 column_indices(column_indices),
378 csr_matrix_view(
const csr_matrix<IndexType,ValueType,MemorySpace>& matrix)
410 void resize(
const size_t num_rows,
const size_t num_cols,
const size_t num_entries);
431 template <
typename ArrayType1,
438 ArrayType1 row_offsets,
439 ArrayType2 column_indices,
443 view(num_rows, num_cols, num_entries, row_offsets, column_indices, values);
464 template <
typename ArrayType1,
469 typename MemorySpace>
488 template <
typename IndexType,
typename ValueType,
class MemorySpace>
493 (m.num_rows, m.num_cols, m.num_entries,
511 template <
typename IndexType,
typename ValueType,
class MemorySpace>
516 (m.num_rows, m.num_cols, m.num_entries,
526 #include <cusp/detail/csr_matrix.inl>
row_offsets_array_type row_offsets
The array1d class is a 1D vector container that may contain elements stored in "host" or "device" mem...
void swap(csr_matrix &matrix)
row_offsets_array_type row_offsets
void resize(const size_t num_rows, const size_t num_cols, const size_t num_entries)
Compressed sparse row (CSR) representation a sparse matrix.
array1d_view< Iterator > make_array1d_view(Iterator first, Iterator last)
csr_matrix< IndexType, ValueType, MemorySpace >::const_view make_csr_matrix_view(const csr_matrix< IndexType, ValueType, MemorySpace > &m)
void resize(const size_t num_rows, const size_t num_cols, const size_t num_entries)
csr_matrix & operator=(const MatrixType &matrix)
column_indices_array_type column_indices
csr_matrix(size_t num_rows, size_t num_cols, size_t num_entries)
1D array of elements that may reside in "host" or "device" memory space
column_indices_array_type column_indices