16 #ifndef OPENKALMAN_TENSOR_ORDER_HPP 17 #define OPENKALMAN_TENSOR_ORDER_HPP 26 constexpr
auto get_tensor_order_of_impl(std::index_sequence<>,
const T& t) {
return 0; }
28 template<std::size_t I, std::size_t...Is,
typename T>
29 constexpr
auto get_tensor_order_of_impl(std::index_sequence<I, Is...>,
const T& t)
31 auto dim = get_index_dimension_of<I>(t);
35 if constexpr (stat_dim == 0) return dim;
38 auto next = get_tensor_order_of_impl(std::index_sequence<Is...> {}, t);
39 if constexpr (stat_dim == 1) return next;
40 else if constexpr (values::
fixed<decltype(next)>)
41 return
std::integral_constant<
std::
size_t, 1_uz +
std::decay_t<decltype(next)>::
value> {};
48 if (dim == 0)
return dim;
51 std::size_t next = get_tensor_order_of_impl(std::index_sequence<Is...> {}, t);
52 if (dim == 1)
return next;
53 else return 1_uz + next;
68 template<
interface::count_indices_defined_for T> requires interface::get_vector_space_descriptor_defined_for<T>
71 template<
typename T, std::enable_if_t<
interface::count_indices_defined_for<T> and
interface::get_vector_space_descriptor_defined_for<T>,
int> = 0>
79 return detail::get_tensor_order_of_impl(seq, t);
83 std::size_t count = 0;
88 else if (dim == 0)
return 0;
97 #endif //OPENKALMAN_TENSOR_ORDER_HPP constexpr auto count_indices(const T &t)
Get the number of indices available to address the components of an indexible object.
Definition: count_indices.hpp:33
Definition: tuple_reverse.hpp:103
constexpr bool value
T is numerical value or is reducible to a numerical value.
Definition: value.hpp:31
constexpr auto tensor_order(const T &t)
Return the tensor order of T (i.e., the number of indices of dimension greater than 1)...
Definition: tensor_order.hpp:74
The root namespace for OpenKalman.
Definition: basics.hpp:34
constexpr bool index
T is an index value.
Definition: index.hpp:56
constexpr bool fixed
T is a values::value that is determinable at compile time.
Definition: fixed.hpp:60
constexpr auto get_index_dimension_of(const T &t, N n=N{})
Get the runtime dimensions of index N of indexible T.
Definition: get_index_dimension_of.hpp:34