18
19
20
24#include "./concepts.hpp"
25#include "./stdutil/array.hpp"
33
34
35
38
39
40
41
42
43
44 template <
int R,
typename F>
46 static_assert(CallableWithLongs<F, R>,
"Error in nda::array_adapter: Lambda should be callable with R integers");
49 std::array<
long, R> myshape;
56
57
58
59
60
61
62 template <
typename Int>
63 array_adapter(std::array<Int, R>
const &shape, F f) : myshape(stdutil::make_std_array<
long>(shape)), f(f) {}
66
67
68
72
73
74
78
79
80
81
82
83
84 template <
typename... Ints>
86 static_assert((std::is_convertible_v<Ints,
long>
and ...),
"Error in nda::array_adapter: Arguments must be convertible to long");
92 template <
auto R,
typename Int,
typename F>
98
99
100
101 template <
int R,
typename F>
Adapter that consists of a shape and a callable object, which takes R integers as arguments (just lik...
array_adapter(std::array< Int, R > const &shape, F f)
Construct a new array adapter object.
auto operator()(long i0, Ints... is) const
Function call operator simply forwards the arguments to the callable object.
long size() const
Get the total size of the adapter.
auto const & shape() const
Get shape of the adapter.
constexpr char get_algebra< array_adapter< R, F > >
Specialization of nda::get_algebra for nda::array_adapter.