16 #ifndef OPENKALMAN_MAKE_IDENTITY_MATRIX_LIKE_HPP 17 #define OPENKALMAN_MAKE_IDENTITY_MATRIX_LIKE_HPP 28 template<indexible T, values::number Scalar = scalar_type_of_t<T>, pattern_collection Descriptors>
31 template<typename T, typename Scalar = typename scalar_type_of<T>::type,
typename Descriptors, std::enable_if_t<
32 indexible<T> and values::number<Scalar> and pattern_collection<Descriptors>,
int> = 0>
37 decltype(
auto) d = coordinates::internal::strip_1D_tail(std::forward<Descriptors>(descriptors));
38 using D = decltype(d);
41 if constexpr (coordinates::euclidean_pattern_collection<D> and interface::make_identity_matrix_defined_for<T, Scalar, D>)
43 return Trait::template make_identity_matrix<Scalar>(std::forward<D>(d));
45 else if constexpr (interface::make_identity_matrix_defined_for<T, Scalar, decltype(internal::to_euclidean_pattern_collection(d))>)
47 auto ed = internal::to_euclidean_pattern_collection(d);
48 return attach_pattern(Trait::template make_identity_matrix<Scalar>(ed), std::forward<D>(d));
62 template<indexible T, values::number Scalar = scalar_type_of_t<T>, coordinates::pattern...Ds>
65 template<typename T, typename Scalar = typename scalar_type_of<T>::type,
typename...Ds, std::enable_if_t<
66 indexible<T> and values::number<Scalar> and (... and coordinates::pattern<Ds>),
int> = 0>
71 return make_identity_matrix_like<T, Scalar>(std::tuple {std::forward<Ds>(ds)...});
83 template<values::number Scalar, indexible Arg>
86 template<
typename Scalar,
typename Arg, std::enable_if_t<values::number<Scalar> and indexible<Arg>,
int> = 0>
91 if constexpr (identity_matrix<Arg> and std::is_same_v<Scalar, scalar_type_of_t<Arg>>)
return std::forward<Arg>(arg);
92 else return make_identity_matrix_like<Arg, Scalar>(all_vector_space_descriptors(std::forward<Arg>(arg)));
102 #ifdef __cpp_concepts 103 template<indexible Arg>
106 template<
typename Arg, std::enable_if_t<indexible<Arg>,
int> = 0>
111 return make_identity_matrix_like<scalar_type_of_t<Arg>>(std::forward<Arg>(arg));
constexpr auto attach_pattern(Arg &&arg, P &&p)
Attach a pattern_collection to an indexible object.
Definition: attach_pattern.hpp:36
Definition: fixed_value.hpp:41
The root namespace for OpenKalman.
Definition: basics.hpp:34
An interface to various routines from the linear algebra library associated with indexible object T...
Definition: library_interface.hpp:42
constexpr auto make_identity_matrix_like(Descriptors &&descriptors)
Make an identity_matrix with a particular set of coordinates::pattern objects.
Definition: make_identity_matrix_like.hpp:35
constexpr bool identity_matrix
Specifies that a type is known at compile time to be a rank-2 or lower identity matrix.
Definition: identity_matrix.hpp:50