16 #ifndef OPENKALMAN_CONTRACT_IN_PLACE_HPP 17 #define OPENKALMAN_CONTRACT_IN_PLACE_HPP 28 template<
bool on_the_right = true, square_shaped<Applicability::permitted> A, square_shaped<Applicability::permitted> B> requires
29 vector_space_descriptors_may_match_with<A, B> and (not triangular_matrix<A> or triangle_type_of_v<A> == triangle_type_of_v<A, B>) and
30 (index_count_v<A> ==
dynamic_size or index_count_v<A> <= 2) and (index_count_v<B> ==
dynamic_size or index_count_v<B> <= 2)
32 template<
bool on_the_right =
true,
typename A,
typename B, std::enable_if_t<
33 square_shaped<A, Applicability::permitted> and square_shaped<B, Applicability::permitted> and
40 if constexpr (not square_shaped<A> or not square_shaped<B> or not vector_space_descriptors_match_with<A, B>)
if (not
vector_space_descriptors_match(a, b))
41 throw std::invalid_argument {
"Arguments to contract_in_place must match in size and be square matrices"};
43 if constexpr (zero<A> or identity_matrix<B>)
47 else if constexpr (zero<B> and writable<A>)
49 assign(a, std::forward<B>(b));
51 else if constexpr (interface::contract_in_place_defined_for<A, on_the_right, A&, B&&>)
59 return std::forward<A>(a);
66 #endif //OPENKALMAN_CONTRACT_IN_PLACE_HPP decltype(auto) constexpr contract(A &&a, B &&b)
Matrix multiplication of A * B.
Definition: contract.hpp:54
constexpr bool value
T is numerical value or is reducible to a numerical value.
Definition: value.hpp:31
decltype(auto) constexpr to_dense_object(Arg &&arg)
Convert the argument to a dense, writable matrix of a particular scalar type.
Definition: to_dense_object.hpp:37
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
constexpr bool vector_space_descriptors_match(const Ts &...ts)
Return true if every set of coordinates::pattern of a set of objects match.
Definition: vector_space_descriptors_match.hpp:62
constexpr A && contract_in_place(A &&a, B &&b)
In-place matrix multiplication of A * B, storing the result in A.
Definition: contract_in_place.hpp:38
constexpr To && assign(To &&a, From &&b)
Assign a writable object from an indexible object.
Definition: assign.hpp:51
constexpr std::size_t dynamic_size
A constant indicating that a size or index is dynamic.
Definition: global-definitions.hpp:33