16 #ifndef OPENKALMAN_TRANSPOSE_HPP 17 #define OPENKALMAN_TRANSPOSE_HPP 26 template<
typename C,
typename Arg, std::size_t...Is>
27 constexpr decltype(
auto) transpose_constant(C&& c, Arg&& arg,
std::index_sequence<Is...>)
29 return make_constant<Arg>(std::forward<C>(c),
30 get_vector_space_descriptor<1>(arg), get_vector_space_descriptor<0>(arg), get_vector_space_descriptor<Is + 2>(arg)...);
35 #ifndef __cpp_concepts 38 template<
typename T,
typename Arg,
typename =
void>
41 template<
typename T,
typename Arg>
43 constant_matrix<decltype(interface::library_interface<T>::transpose(std::declval<Arg>()))>>>
54 template<indexible Arg> requires (max_tensor_order_v<Arg> <= 2)
56 template<
typename Arg, std::enable_if_t<indexible<Arg> and (max_tensor_order_v<Arg> <= 2),
int> = 0>
58 constexpr decltype(auto) transpose(Arg&& arg)
60 if constexpr (((diagonal_matrix<Arg> or constant_matrix<Arg>) and square_shaped<Arg>) or
61 (hermitian_matrix<Arg> and not values::complex<scalar_type_of_t<Arg>>))
63 return std::forward<Arg>(arg);
65 else if constexpr (hermitian_matrix<Arg>)
67 return conjugate(std::forward<Arg>(arg));
70 else if constexpr (constant_matrix<Arg> and
71 not requires { {
interface::library_
interface<std::decay_t<Arg>>::transpose(std::forward<Arg>(arg))} ->
constant_matrix; })
76 constexpr std::make_index_sequence<std::max({index_count_v<Arg>, 2_uz}) - 2_uz> seq;
88 #endif //OPENKALMAN_TRANSPOSE_HPP constexpr bool constant_matrix
Specifies that all components of an object are the same constant value.
Definition: constant_matrix.hpp:31
Definition: tuple_reverse.hpp:103
The constant associated with T, assuming T is a constant_matrix.
Definition: constant_coefficient.hpp:36
decltype(auto) constexpr transpose(Arg &&arg)
Take the transpose of a matrix.
Definition: transpose.hpp:58
Definition: transpose.hpp:39
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:37