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>
31#include <cusp/detail/utils.h>
37template<
typename,
typename,
typename>
class array2d;
38template<
typename,
typename>
class array2d_view;
39template<
typename,
typename,
typename,
typename,
typename>
class ell_matrix_view;
41template<
typename T,
class MemorySpace,
class Orientation>
42array2d_view<typename cusp::array1d_view<typename cusp::array1d<T,MemorySpace>::iterator>, Orientation>
45template<
typename T,
class MemorySpace,
class Orientation>
46array2d_view<typename cusp::array1d_view<typename cusp::array1d<T,MemorySpace>::const_iterator>, Orientation>
118template <
typename IndexType,
typename ValueType,
typename MemorySpace>
119class ell_matrix :
public cusp::detail::matrix_base<IndexType,ValueType,MemorySpace,cusp::ell_format>
123 typedef cusp::detail::matrix_base<IndexType,ValueType,MemorySpace,cusp::ell_format> Parent;
138 typename column_indices_array_type::view,
139 typename values_array_type::view,
140 IndexType, ValueType, MemorySpace> view;
143 typename column_indices_array_type::const_view,
144 typename values_array_type::const_view,
145 IndexType, ValueType, MemorySpace> const_view;
148 typename column_indices_array_type::values_array_type,
149 typename values_array_type::values_array_type,
150 cusp::ell_format>::view coo_view_type;
152 typename column_indices_array_type::values_array_type,
153 typename values_array_type::values_array_type,
154 cusp::ell_format>::view const_coo_view_type;
156 template<
typename MemorySpace2>
184 ell_matrix(
const size_t num_rows,
const size_t num_cols,
const size_t num_entries,
185 const size_t num_entries_per_row,
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_entries_per_row);
212 void resize(
const size_t num_rows,
const size_t num_cols,
const size_t num_entries,
213 const size_t num_entries_per_row,
const size_t alignment);
227 template <
typename MatrixType>
317template <
typename ArrayType1,
319 typename IndexType =
typename ArrayType1::value_type,
320 typename ValueType =
typename ArrayType2::value_type,
321 typename MemorySpace =
typename cusp::minimum_space<typename ArrayType1::memory_space, typename ArrayType2::memory_space>::type >
322class ell_matrix_view :
public cusp::detail::matrix_base<IndexType,ValueType,MemorySpace,cusp::ell_format>
326 typedef cusp::detail::matrix_base<IndexType,ValueType,MemorySpace,cusp::ell_format> Parent;
331 typedef ArrayType1 column_indices_array_type;
332 typedef ArrayType2 values_array_type;
339 typename column_indices_array_type::values_array_type,
340 typename values_array_type::values_array_type,
341 cusp::ell_format>::view coo_view_type;
343 typename column_indices_array_type::values_array_type,
344 typename values_array_type::values_array_type,
345 cusp::ell_format>::view const_coo_view_type;
377 template <
typename OtherArrayType1,
typename OtherArrayType2>
378 ell_matrix_view(
const size_t num_rows,
const size_t num_cols,
const size_t num_entries,
380 : Parent(num_rows, num_cols, num_entries),
427 void resize(
size_t num_rows,
size_t num_cols,
size_t num_entries,
428 size_t num_entries_per_row);
438 void resize(
size_t num_rows,
size_t num_cols,
size_t num_entries,
439 size_t num_entries_per_row,
size_t alignment);
456template <
typename ArrayType1,
typename ArrayType2>
459 ArrayType1 column_indices, ArrayType2 values)
462 view(num_rows, num_cols, num_entries, column_indices, values);
482template <
typename ArrayType1,
486 typename MemorySpace>
487ell_matrix_view<ArrayType1,ArrayType2,IndexType,ValueType,MemorySpace>
505template <
typename IndexType,
typename ValueType,
typename MemorySpace>
506typename ell_matrix<IndexType,ValueType,MemorySpace>::view
510 (m.num_rows, m.num_cols, m.num_entries,
527template <
typename IndexType,
typename ValueType,
typename MemorySpace>
528typename ell_matrix<IndexType,ValueType,MemorySpace>::const_view
532 (m.num_rows, m.num_cols, m.num_entries,
542#include <cusp/detail/ell_matrix.inl>
1D array of elements that may reside in "host" or "device" memory space
The array2d class is a 2D vector container that may contain elements stored in "host" or "device" mem...
ell_matrix_view(ell_matrix_view &matrix)
void resize(size_t num_rows, size_t num_cols, size_t num_entries, size_t num_entries_per_row, size_t alignment)
ell_matrix_view(const size_t num_rows, const size_t num_cols, const size_t num_entries, const OtherArrayType1 &column_indices, const OtherArrayType2 &values)
static const IndexType invalid_index
column_indices_array_type column_indices
ell_matrix_view(const ell_matrix< IndexType, ValueType, MemorySpace > &matrix)
ell_matrix_view(const ell_matrix_view &matrix)
void resize(size_t num_rows, size_t num_cols, size_t num_entries, size_t num_entries_per_row)
ell_matrix_view(ell_matrix< IndexType, ValueType, MemorySpace > &matrix)
Packed row (ELLPACK/ITPACK) representation of a sparse matrix.
static const IndexType invalid_index
ell_matrix & operator=(const MatrixType &matrix)
column_indices_array_type column_indices
ell_matrix(const MatrixType &matrix)
void resize(const size_t num_rows, const size_t num_cols, const size_t num_entries, const size_t num_entries_per_row, const size_t alignment)
void swap(ell_matrix &matrix)
ell_matrix(const size_t num_rows, const size_t num_cols, const size_t num_entries, const size_t num_entries_per_row, const size_t alignment=32)
void resize(const size_t num_rows, const size_t num_cols, const size_t num_entries, const size_t num_entries_per_row)
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)
ell_matrix_view< ArrayType1, ArrayType2 > make_ell_matrix_view(size_t num_rows, size_t num_cols, size_t num_entries, ArrayType1 column_indices, ArrayType2 values)