#include <atlas/array/LocalView.h>
template<typename Value, int Rank>
LocalView class
Multi-dimensional access existing POD array pointer.
A LocalView is a wrapper around data that enables multidimensional access, and has the exact same API as ArrayView.
The data may be strided.
Example 1:
int[] array = { 1, 2, 3, 4, 5, 6, 7, 8, 9}; int[2] strides = { 3, 1 }; int[2] shape = { 3, 3 }; LocalView<int,2> matrix( array, shape, strides ); for( idx_t i=0; i<matrix.shape(0); ++i ) { for( idx_t j=0; j<matrix.shape(1); ++j ) { matrix(i,j) *= 10; } }
Strides can also be omitted as for most common cases it can be inferred from the shape.
Example 2:
int[] array = { 1, 2, 3, 4, 5, 6, 7, 8, 9}; int[2] shape = { 3, 3 }; LocalView<int,2> matrix( array, shape ); which is identical for this matrix to previous Example 1
Public types
- using value_type = Value
- using return_type = value_type
Public static variables
- static int RANK constexpr
Public static functions
Constructors, destructors, conversion operators
-
template<typename ValueTp, typename = std::LocalView(const LocalView<ValueTp, Rank>& other)
enable_if_t<std::is_convertible_v<ValueTp*, Value*>>> -
template<typename ValueTp, typename Int1, typename Int2, typename = std::LocalView(ValueTp* data, const Int1 shape[], const Int2 strides[])
enable_if_t<std::is_convertible_v<ValueTp*, Value*>&& std::is_integral_v<Int1>&& std::is_integral_v<Int2>>> -
template<typename ValueTp, typename Int, typename = std::LocalView(ValueTp* data, const Int shape[])
enable_if_t<std::is_convertible_v<ValueTp*, Value*>&& std::is_integral_v<Int>>> -
template<typename ValueTp, typename ArrayShape, typename = std::LocalView(ValueTp* data, const ArrayShape& shape)
enable_if_t<std::is_convertible_v<ValueTp*, Value*>>> - ENABLE_IF_CONST_WITH_NON_CONST(value_type) operator const LocalView< value_type
- return(const LocalView<value_type, Rank>&)
Public functions
-
template<typename... Idx, int Rank_ = Rank, typename = std::auto operator()(Idx... idx) -> value_type&
enable_if_t<sizeof...(Idx) == Rank_>> -
template<typename... Idx, int Rank_ = Rank, typename = std::auto operator()(Idx... idx) const -> const value_type&
enable_if_t<sizeof...(Idx) == Rank_>> -
template<typename Idx, int Rank_ = Rank, typename = std::auto operator[](Idx idx) const -> const value_type&
enable_if_t<Rank_ == 1>> -
template<typename Idx, int Rank_ = Rank, typename = std::auto operator[](Idx idx) -> value_type&
enable_if_t<Rank_ == 1>> -
auto size() const -> idx_
t -
template<typename Int>auto shape(Int idx) const -> idx_
t -
template<typename Int>auto stride(Int idx) const -> idx_
t -
auto shape() const -> const idx_
t* -
auto strides() const -> const idx_
t* - auto data() const -> value_type const *
- auto data() -> value_type*
- auto contiguous() const -> bool
- auto assign(const value_type& value) -> ENABLE_IF_NON_CONST void
-
void dump(std::
ostream& os) const -
template<typename... Args>auto slice(Args... args) -> slice_t<Args...>::type
-
template<typename... Args>auto slice(Args... args) const -> const_slice_t<Args...>::type
Public variables
- Rank& const
Friends
-
auto operator<<(std::
ostream& out, const LocalView& x) -> std:: ostream&