16 #ifndef OPENKALMAN_GET_EUCLIDEAN_DIMENSION_HPP 17 #define OPENKALMAN_GET_EUCLIDEAN_DIMENSION_HPP 30 #ifndef __cpp_lib_ranges 31 template<
typename T,
typename =
void>
36 : std::bool_constant<values::fixed_value_compares_with<decltype(internal::get_descriptor_stat_dimension(
37 std::declval<stdex::ranges::range_value_t<T>>())), 0>> {};
41 template<std::
size_t i = 0,
typename T>
42 static constexpr
auto get_stat_dimension_fixed(
const T& t)
44 if constexpr (i < collections::size_of_v<T>)
48 internal::get_descriptor_stat_dimension(collections::get<i>(t)),
49 get_stat_dimension_fixed<i + 1>(t));
51 else return std::integral_constant<std::size_t, 0_uz>{};
61 template<pattern Arg> requires descriptor<Arg> or collections::sized<Arg> or
62 values::fixed_value_compares_with<decltype(internal::get_descriptor_stat_dimension(std::declval<stdex::ranges::range_value_t<Arg>>())), 0>
65 template<
typename Arg, std::enable_if_t<descriptor<Arg> or
71 if constexpr (descriptor<Arg>)
73 return internal::get_descriptor_stat_dimension(arg);
75 else if constexpr (collections::size_of_v<Arg> == 0)
77 return std::integral_constant<std::size_t, 0_uz>{};
79 else if constexpr (not collections::sized<Arg> or collections::size_of_v<Arg> == stdex::dynamic_extent)
81 using C = decltype(internal::get_descriptor_stat_dimension(std::declval<stdex::ranges::range_value_t<Arg>>()));
82 if constexpr (not values::fixed<C>)
83 #ifdef __cpp_lib_ranges_fold 85 [](
const auto& a,
const auto& b) {
return a + internal::get_descriptor_stat_dimension(b); });
88 std::size_t ret = 0_uz;
93 else if constexpr (values::fixed_value_of_v<C> == 0)
94 return std::integral_constant<std::size_t, 0_uz>{};
100 return detail::get_stat_dimension_fixed(arg);
constexpr auto get_stat_dimension(const Arg &arg)
Get the vector dimension of coordinates::pattern Arg when transformed into statistical space...
Definition: get_stat_dimension.hpp:69
The fixed value associated with a fixed.
Definition: fixed_value_of.hpp:44
Definition for coordinates::pattern.
Definition for coordinates::descriptor.
The namespace for features relating to coordinates::pattern object.
Definition: compares_with.hpp:25
constexpr detail::all_closure all
a std::ranges::range_adaptor_closure which returns a view to all members of its collection argument...
Definition: all.hpp:72
Definition: get_stat_dimension.hpp:32
constexpr bool index
T is an index value.
Definition: index.hpp:62
Basic definitions for OpenKalman as a whole.
constexpr auto get_size(Arg &&arg)
Get the size of a sized object (e.g, a collection)
Definition: get_size.hpp:188
constexpr auto operation(Operation &&op, Args &&...args)
A potentially constant-evaluated operation involving some number of values.
Definition: operation.hpp:98