50 template <
template <
typename...>
class TMPLT,
typename T>
54 template <
template <
typename...>
class TMPLT,
typename... U>
58 template <
template <
typename...>
class TMPLT,
typename T>
62 template <
typename T,
typename... Ts>
63 static constexpr bool is_any_of = (std::is_same_v<Ts, T> or ... or
false);
66 template <
typename... Ts>
70 template <
typename... Ts>
92 template <
typename S,
typename A>
101 template <
typename T>
125 template <
typename A>
129 template <
typename A>
130 requires(!std::is_same_v<A, std::remove_cvref_t<A>>)
131 inline constexpr char get_algebra<A> =
get_algebra<std::remove_cvref_t<A>>;
134 template <
typename A>
135 requires(std::ranges::contiguous_range<A> or
requires { std::declval<A const>().shape(); })
137 if constexpr (std::ranges::contiguous_range<A>)
140 return std::tuple_size_v<std::remove_cvref_t<decltype(std::declval<A const>().shape())>>;
144 template <
typename A>
148 template <
typename A>
149 requires(!std::is_same_v<A, std::remove_cvref_t<A>>)
150 inline constexpr bool is_regular_v<A> =
is_regular_v<std::remove_cvref_t<A>>;
153 template <
typename A>
157 template <
typename A>
158 requires(!std::is_same_v<A, std::remove_cvref_t<A>>)
159 inline constexpr bool is_view_v<A> =
is_view_v<std::remove_cvref_t<A>>;
162 template <
typename A>
166 template <
typename A>
176 template <typename A>
181 return [&a]<
auto... Is>(std::index_sequence<Is...>) ->
decltype(
auto) {
182 return a((0 * Is)...);
183 }(std::make_index_sequence<get_rank<A>>{});
191 template <
typename A>
192 using get_value_t = std::decay_t<decltype(get_first_element(std::declval<A const>()))>;
195 template <
typename A0,
typename... As>
199 template <
typename A0,
typename... As>
225 smallest_stride_is_one = 0x2,
226 contiguous = strided_1d | smallest_stride_is_one
238 if (from == layout_prop_e::contiguous)
return true;
239 return ((to == layout_prop_e::none) or (to == from));
320 template <
typename A>
324 template <
typename A>
325 requires(!std::is_same_v<A, std::remove_cvref_t<A>>)
326 inline constexpr layout_info_t get_layout_info<A> =
get_layout_info<std::remove_cvref_t<A>>;
329 template <
typename A>
333 template <
typename A>
337 template <
typename A>
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.
std::decay_t< decltype(get_first_element(std::declval< A const >()))> get_value_t
Get the value type of an array/view or a scalar type.
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.
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_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.
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.
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.