18
19
20
24#include "./concepts.hpp"
25#include "./layout/range.hpp"
26#include "./macros.hpp"
27#include "./traits.hpp"
37 template <
typename F, Array... A>
47 template <
typename... Char>
48 constexpr char _impl_find_common_algebra(
char x0, Char... x) {
49 return (((x == x0) && ...) ? x0 :
'N');
55
56
57
58
59
60
61
62
67
68
69
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89 template <
typename F, Array... As>
95 std::tuple<
const As...>
a;
99 template <size_t... Is,
typename... Args>
100 [[gnu::always_inline]] [[nodiscard]]
auto _call(std::index_sequence<Is...>, Args
const &...args)
const {
102 if constexpr ((is_range_or_ellipsis<Args>
or ...
or false)) {
103 return mapped<F>{
f}(std::get<Is>(
a)(args...)...);
105 return f(std::get<Is>(
a)(args...)...
);
110 template <size_t... Is,
typename Arg>
111 [[gnu::always_inline]]
auto _call_bra(std::index_sequence<Is...>, Arg
const &arg)
const {
112 return f(std::get<Is>(
a)[arg]...
);
117
118
119
120
121
122
123
124
125
126
127
128 template <
typename... Args>
130 return _call(std::make_index_sequence<
sizeof...(As)>{}, args...);
134
135
136
137
138
139
140
141
142
143
144
145 template <
typename Arg>
147 return _call_bra(std::make_index_sequence<
sizeof...(As)>{}, arg);
152
153
154
158
159
160
165
166
167
174
175
176
177
178
179
180
181
182 template <Array A0, Array... As>
184 EXPECTS(((as.shape() == a0.shape()) && ...));
185 return {
f, {std::forward<A0>(a0), std::forward<As>(as)...}};
190
191
192
193
194
195
196
197
200 return {std::move(f)};
#define CUBLAS_CHECK(X,...)
#define NDA_RUNTIME_ERROR
mapped< F > map(F f)
Create a lazy function call expression on arrays/views.
constexpr bool is_regular_v
Constexpr variable that is true if type A is a regular array, i.e. an nda::basic_array.
constexpr char get_algebra
Constexpr variable that specifies the algebra of a type.
constexpr bool is_matrix_or_view_v
Constexpr variable that is true if type A is a regular matrix or a view of a matrix.
constexpr bool have_same_value_type_v
Constexpr variable that is true if all types in As have the same value type as A0.
constexpr int get_rank
Constexpr variable that specifies the rank of an nda::Array or of a contiguous 1-dimensional range.
constexpr bool have_same_rank_v
Constexpr variable that is true if all types in As have the same rank as A0.
constexpr bool is_view_v
Constexpr variable that is true if type A is a view, i.e. an nda::basic_array_view.
constexpr bool is_regular_or_view_v
Constexpr variable that is true if type A is either a regular array or a view.
constexpr char get_algebra< expr_call< F, As... > >
Get the resulting algebra of a function call expression involving arrays/views.
decltype(auto) get_first_element(A const &a)
Get the first element of an array/view or simply return the scalar if a scalar is given.
constexpr bool layout_property_compatible(layout_prop_e from, layout_prop_e to)
Checks if two layout properties are compatible with each other.
constexpr bool has_contiguous(layout_prop_e lp)
Checks if a layout property has the contiguous property.
constexpr bool has_layout_smallest_stride_is_one
Constexpr variable that is true if type A has the smallest_stride_is_one nda::layout_prop_e guarantee...
constexpr bool has_strided_1d(layout_prop_e lp)
Checks if a layout property has the strided_1d property.
constexpr bool has_layout_strided_1d
Constexpr variable that is true if type A has the strided_1d nda::layout_prop_e guarantee.
constexpr layout_prop_e operator&(layout_prop_e lhs, layout_prop_e rhs)
Bitwise AND operator for two layout properties.
constexpr layout_info_t operator&(layout_info_t lhs, layout_info_t rhs)
Bitwise AND operator for layout infos.
constexpr layout_prop_e operator|(layout_prop_e lhs, layout_prop_e rhs)
Bitwise OR operator for two layout properties.
constexpr layout_info_t get_layout_info
Constexpr variable that specifies the nda::layout_info_t of type A.
constexpr bool has_smallest_stride_is_one(layout_prop_e lp)
Checks if a layout property has the smallest_stride_is_one property.
constexpr bool has_contiguous_layout
Constexpr variable that is true if type A has the contiguous nda::layout_prop_e guarantee.
layout_prop_e
Compile-time guarantees of the memory layout of an array/view.
int get_ld(A const &a)
Get the leading dimension in LAPACK jargon of an nda::MemoryMatrix.
static constexpr bool has_C_layout
Constexpr variable that is true if the given nda::Array type has a C memory layout.
static constexpr bool is_conj_array_expr
Constexpr variable that is true if the given type is a conjugate lazy expression.
int get_ncols(A const &a)
Get the number of columns in LAPACK jargon of an nda::MemoryMatrix.
static constexpr bool is_conj_array_expr< expr_call< conj_f, A > >
Specialization of nda::blas::is_conj_array_expr for the conjugate lazy expressions.
static constexpr bool has_F_layout
Constexpr variable that is true if the given nda::Array type has a Fortran memory layout.
const char get_op
Variable template that determines the BLAS matrix operation tag ('N','T','C') based on the given bool...
AddressSpace
Enum providing identifiers for the different memory address spaces.
constexpr bool is_instantiation_of_v
Constexpr variable that is true if type T is an instantiation of TMPLT (see nda::is_instantiation_of)...
constexpr bool is_complex_v
Constexpr variable that is true if type T is a std::complex type.
constexpr bool is_blas_lapack_v
Alias for nda::is_double_or_complex_v.
static constexpr bool always_false
Constexpr variable that is always false regardless of the types in Ts (used to trigger static_assert)...
constexpr bool is_scalar_for_v
Constexpr variable used to check requirements when initializing an nda::basic_array or nda::basic_arr...
static constexpr bool is_any_of
Constexpr variable that is true if type T is contained in the parameter pack Ts.
constexpr bool is_double_or_complex_v
Constexpr variable that is true if type T is a std::complex type or a double type.
static constexpr bool always_true
Constexpr variable that is always true regardless of the types in Ts.
constexpr bool is_scalar_v
Constexpr variable that is true if type S is a scalar type, i.e. arithmetic or complex.
constexpr bool is_scalar_or_convertible_v
Constexpr variable that is true if type S is a scalar type (see nda::is_scalar_v) or if a std::comple...
A small wrapper around a single long integer to be used as a linear index.
A lazy function call expression on arrays/views.
long size() const
Get the total size of the nda::Array objects.
auto shape() const
Get the shape of the nda::Array objects.
auto operator()(Args const &...args) const
Function call operator.
std::tuple< const As... > a
Tuple containing the nda::Array arguments.
F f
Callable object of the expression.
auto operator[](Arg const &arg) const
Subscript operator.
Check if type T is of type TMPLT<...>.
Stores information about the memory layout and the stride order of an array/view.
uint64_t stride_order
Stride order of the array/view.
layout_prop_e prop
Memory layout properties of the array/view.
Functor that is returned by the nda::map function.
expr_call< F, A0, As... > operator()(A0 &&a0, As &&...as) const
Function call operator that returns a lazy function call expression.
Memory block consisting of a pointer and its size.