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>
35template <
typename IndexType,
typename ValueType,
class MemorySpace>
class ell_matrix;
36template <
typename IndexType,
typename ValueType,
class MemorySpace>
class coo_matrix;
37template <
typename MatrixType1,
typename MatrixType2,
typename IndexType,
typename ValueType,
class MemorySpace>
class hyb_matrix_view;
141template <
typename IndexType,
typename ValueType,
class MemorySpace>
142class hyb_matrix :
public cusp::detail::matrix_base<IndexType,ValueType,MemorySpace,cusp::hyb_format>
146 typedef cusp::detail::matrix_base<IndexType,ValueType,MemorySpace,cusp::hyb_format> Parent;
159 IndexType, ValueType, MemorySpace> view;
164 IndexType, ValueType, MemorySpace> const_view;
167 typename coo_matrix_type::column_indices_array_type,
168 typename coo_matrix_type::values_array_type,
169 cusp::hyb_format>::view coo_view_type;
171 typename coo_matrix_type::column_indices_array_type,
172 typename coo_matrix_type::values_array_type,
173 cusp::hyb_format>::view const_coo_view_type;
175 template<
typename MemorySpace2>
204 IndexType num_ell_entries, IndexType num_coo_entries,
205 IndexType num_entries_per_row, IndexType alignment = 32)
206 : Parent(num_rows, num_cols, num_ell_entries + num_coo_entries),
207 ell(num_rows, num_cols, num_ell_entries, num_entries_per_row, alignment),
208 coo(num_rows, num_cols, num_coo_entries) {}
216 template <
typename MatrixType>
221 void resize(IndexType num_rows, IndexType num_cols,
222 IndexType num_ell_entries, IndexType num_coo_entries,
223 IndexType num_entries_per_row, IndexType alignment = 32)
225 Parent::resize(num_rows, num_cols, num_ell_entries + num_coo_entries);
226 ell.resize(num_rows, num_cols, num_ell_entries, num_entries_per_row, alignment);
227 coo.resize(num_rows, num_cols, num_coo_entries);
236 Parent::swap(matrix);
245 template <
typename MatrixType>
343template <
typename MatrixType1,
344 typename MatrixType2,
345 typename IndexType =
typename MatrixType1::index_type,
346 typename ValueType =
typename MatrixType1::value_type,
347 typename MemorySpace =
typename cusp::minimum_space<typename MatrixType1::memory_space, typename MatrixType2::memory_space>::type >
348class hyb_matrix_view :
public cusp::detail::matrix_base<IndexType,ValueType,MemorySpace,cusp::hyb_format>
352 typedef cusp::detail::matrix_base<IndexType,ValueType,MemorySpace,cusp::hyb_format> Parent;
357 typedef MatrixType1 ell_matrix_type;
358 typedef MatrixType2 coo_matrix_type;
365 typename coo_matrix_type::column_indices_array_type,
366 typename coo_matrix_type::values_array_type,
367 cusp::hyb_format>::view coo_view_type;
369 typename coo_matrix_type::column_indices_array_type,
370 typename coo_matrix_type::values_array_type,
371 cusp::hyb_format>::view const_coo_view_type;
395 template <
typename OtherMatrixType1,
typename OtherMatrixType2>
408 template <
typename OtherMatrixType1,
typename OtherMatrixType2>
449 void resize(
size_t num_rows,
size_t num_cols,
450 size_t num_ell_entries,
size_t num_coo_entries,
451 size_t num_entries_per_row,
size_t alignment = 32);
458#include <cusp/detail/hyb_matrix.inl>
1D array of elements that may reside in "host" or "device" memory space
Coordinate (COO) representation a sparse matrix.
Packed row (ELLPACK/ITPACK) representation of a sparse matrix.
void resize(size_t num_rows, size_t num_cols, size_t num_ell_entries, size_t num_coo_entries, size_t num_entries_per_row, size_t alignment=32)
hyb_matrix_view(const hyb_matrix_view &matrix)
hyb_matrix_view(hyb_matrix< IndexType, ValueType, MemorySpace > &matrix)
hyb_matrix_view(const hyb_matrix< IndexType, ValueType, MemorySpace > &matrix)
hyb_matrix_view(hyb_matrix_view &matrix)
hyb_matrix_view(const OtherMatrixType1 &ell, const OtherMatrixType2 &coo)
hyb_matrix_view(OtherMatrixType1 &ell, OtherMatrixType2 &coo)
Hybrid (HYB) representation a sparse matrix.
hyb_matrix(const MatrixType &matrix)
hyb_matrix & operator=(const MatrixType &matrix)
void swap(hyb_matrix &matrix)
hyb_matrix(IndexType num_rows, IndexType num_cols, IndexType num_ell_entries, IndexType num_coo_entries, IndexType num_entries_per_row, IndexType alignment=32)
void resize(IndexType num_rows, IndexType num_cols, IndexType num_ell_entries, IndexType num_coo_entries, IndexType num_entries_per_row, IndexType alignment=32)