23#include <cusp/detail/config.h>
27#include <cusp/detail/format.h>
28#include <cusp/detail/matrix_base.h>
29#include <cusp/detail/utils.h>
30#include <cusp/detail/type_traits.h>
36template <
typename ArrayType1,
typename ArrayType2,
typename IndexType,
typename ValueType,
typename MemorySpace>
class dia_matrix_view;
119template <
typename IndexType,
typename ValueType,
class MemorySpace>
120class dia_matrix :
public cusp::detail::matrix_base<IndexType,ValueType,MemorySpace,cusp::dia_format>
124 typedef cusp::detail::matrix_base<IndexType,ValueType,MemorySpace,cusp::dia_format> Parent;
136 typename diagonal_offsets_array_type::view,
137 typename values_array_type::view,
138 IndexType, ValueType, MemorySpace> view;
141 typename diagonal_offsets_array_type::const_view,
142 typename values_array_type::const_view,
143 IndexType, ValueType, MemorySpace> const_view;
146 diagonal_offsets_array_type,
147 typename values_array_type::values_array_type,
148 cusp::dia_format>::view coo_view_type;
151 diagonal_offsets_array_type,
152 typename values_array_type::values_array_type,
153 cusp::dia_format>::view const_coo_view_type;
155 template<
typename MemorySpace2>
184 dia_matrix(
const size_t num_rows,
const size_t num_cols,
const size_t num_entries,
185 const size_t num_diagonals,
const size_t alignment = 32);
191 template <
typename MatrixType>
201 void resize(
const size_t num_rows,
const size_t num_cols,
const size_t num_entries,
202 const size_t num_diagonals);
212 void resize(
const size_t num_rows,
const size_t num_cols,
const size_t num_entries,
213 const size_t num_diagonals,
const size_t alignment);
225 template <
typename MatrixType>
322template <
typename ArrayType1,
324 typename IndexType =
typename ArrayType1::value_type,
325 typename ValueType =
typename ArrayType2::value_type,
326 typename MemorySpace =
typename cusp::minimum_space<typename ArrayType1::memory_space, typename ArrayType2::memory_space>::type >
327class dia_matrix_view :
public cusp::detail::matrix_base<IndexType,ValueType,MemorySpace,cusp::dia_format>
331 typedef cusp::detail::matrix_base<IndexType,ValueType,MemorySpace,cusp::dia_format> Parent;
335 typedef ArrayType1 diagonal_offsets_array_type;
336 typedef ArrayType2 values_array_type;
342 diagonal_offsets_array_type,
343 typename values_array_type::values_array_type,
344 cusp::dia_format>::view coo_view_type;
347 diagonal_offsets_array_type,
348 typename values_array_type::values_array_type,
349 cusp::dia_format>::view const_coo_view_type;
376 template <
typename OtherArrayType1,
typename OtherArrayType2>
379 : Parent(num_rows, num_cols, num_entries),
392 template <
typename OtherArrayType1,
typename OtherArrayType2>
395 : Parent(num_rows, num_cols, num_entries),
442 void resize(
const size_t num_rows,
const size_t num_cols,
const size_t num_entries,
443 const size_t num_diagonals);
453 void resize(
const size_t num_rows,
const size_t num_cols,
const size_t num_entries,
454 const size_t num_diagonals,
const size_t alignment);
473template <
typename ArrayType1,
479 ArrayType1 diagonal_offsets,
483 view(num_rows, num_cols, num_entries, diagonal_offsets, values);
503template <
typename ArrayType1,
507 typename MemorySpace>
508dia_matrix_view<ArrayType1,ArrayType2,IndexType,ValueType,MemorySpace>
526template <
typename IndexType,
typename ValueType,
class MemorySpace>
527typename dia_matrix<IndexType,ValueType,MemorySpace>::view
531 (m.num_rows, m.num_cols, m.num_entries,
548template <
typename IndexType,
typename ValueType,
class MemorySpace>
549typename dia_matrix<IndexType,ValueType,MemorySpace>::const_view
553 (m.num_rows, m.num_cols, m.num_entries,
563#include <cusp/detail/dia_matrix.inl>
1D array of elements that may reside in "host" or "device" memory space
2D 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...
The array2d class is a 2D vector container that may contain elements stored in "host" or "device" mem...
dia_matrix_view(dia_matrix< IndexType, ValueType, MemorySpace > &matrix)
void resize(const size_t num_rows, const size_t num_cols, const size_t num_entries, const size_t num_diagonals, const size_t alignment)
dia_matrix_view(const dia_matrix< IndexType, ValueType, MemorySpace > &matrix)
dia_matrix_view(size_t num_rows, size_t num_cols, size_t num_entries, OtherArrayType1 &diagonal_offsets, OtherArrayType2 &values)
dia_matrix_view(const dia_matrix_view &matrix)
void resize(const size_t num_rows, const size_t num_cols, const size_t num_entries, const size_t num_diagonals)
dia_matrix_view(size_t num_rows, size_t num_cols, size_t num_entries, const OtherArrayType1 &diagonal_offsets, const OtherArrayType2 &values)
dia_matrix_view(dia_matrix_view &matrix)
diagonal_offsets_array_type diagonal_offsets
Diagonal (DIA) representation a sparse matrix.
void resize(const size_t num_rows, const size_t num_cols, const size_t num_entries, const size_t num_diagonals, const size_t alignment)
diagonal_offsets_array_type diagonal_offsets
void resize(const size_t num_rows, const size_t num_cols, const size_t num_entries, const size_t num_diagonals)
dia_matrix(const MatrixType &matrix)
void swap(dia_matrix &matrix)
dia_matrix & operator=(const MatrixType &matrix)
dia_matrix(const size_t num_rows, const size_t num_cols, const size_t num_entries, const size_t num_diagonals, const size_t alignment=32)
array1d_view< Iterator > make_array1d_view(Iterator first, Iterator last)
array2d_view< typename cusp::array1d_view< Iterator >, Orientation > make_array2d_view(size_t num_rows, size_t num_cols, size_t pitch, const cusp::array1d_view< Iterator > &values, Orientation)
dia_matrix_view< ArrayType1, ArrayType2 > make_dia_matrix_view(size_t num_rows, size_t num_cols, size_t num_entries, ArrayType1 diagonal_offsets, ArrayType2 values)