33#ifndef GKO_PUBLIC_CORE_BASE_RANGE_ACCESSORS_HPP_
34#define GKO_PUBLIC_CORE_BASE_RANGE_ACCESSORS_HPP_
40#include <ginkgo/core/base/range.hpp>
41#include <ginkgo/core/base/types.hpp>
68template <
typename ValueType,
size_type Dimensionality>
74 "This accessor is only implemented for matrices");
121 return GKO_ASSERT(row <
lengths[0]), GKO_ASSERT(col <
lengths[1]),
136 return GKO_ASSERT(rows.is_valid()), GKO_ASSERT(
cols.is_valid()),
140 rows.end - rows.begin,
cols.end -
cols.begin,
168 template <
typename OtherAccessor>
186 const std::array<const size_type, dimensionality>
lengths;
A row_major accessor is a bridge between a range and the row-major memory layout.
Definition range_accessors.hpp:69
constexpr range< row_major > operator()(const span &rows, const span &cols) const
Returns the sub-range spanning the range (rows, cols)
Definition range_accessors.hpp:133
constexpr size_type length(size_type dimension) const
Returns the length in dimension dimension.
Definition range_accessors.hpp:151
const std::array< const size_type, dimensionality > lengths
An array of dimension sizes.
Definition range_accessors.hpp:186
const size_type stride
Distance between consecutive rows.
Definition range_accessors.hpp:191
ValueType value_type
Type of values returned by the accessor.
Definition range_accessors.hpp:79
void copy_from(const OtherAccessor &other) const
Copies data from another accessor.
Definition range_accessors.hpp:169
const data_type data
Reference to the underlying data.
Definition range_accessors.hpp:181
static constexpr size_type dimensionality
Number of dimensions of the accessor.
Definition range_accessors.hpp:89
constexpr value_type & operator()(size_type row, size_type col) const
Returns the data element at position (row, col)
Definition range_accessors.hpp:118
value_type * data_type
Type of underlying data storage.
Definition range_accessors.hpp:84
A range is a multidimensional view of the memory.
Definition range.hpp:326
The Ginkgo namespace.
Definition abstract_factory.hpp:48
constexpr T one()
Returns the multiplicative identity for T.
Definition math.hpp:803
std::size_t size_type
Integral type used for allocation quantities.
Definition types.hpp:120
A span is a lightweight structure used to create sub-ranges from other ranges.
Definition range.hpp:75