16 #ifndef OPENKALMAN_LIBRARY_INTERFACE_HPP 17 #define OPENKALMAN_LIBRARY_INTERFACE_HPP 19 #ifdef DOXYGEN_SHOULD_SKIP_THIS 20 #include "patterns/patterns.hpp" 40 template<
typename T,
typename =
void>
44 #ifdef DOXYGEN_SHOULD_SKIP_THIS 53 template<
typename Derived>
54 using library_base = std::monostate;
75 to_diagonal = []<
typename Arg> requires std::same_as<std::remove_cvref_t<Arg>, T>
93 diagonal_of = []<
typename Arg> requires std::same_as<std::remove_cvref_t<Arg>, T>
105 static constexpr
auto 106 conjugate = []<
typename Arg> requires std::same_as<std::remove_cvref_t<Arg>, T>
107 (Arg&& arg) -> constexpr patterns_may_match_with<Arg>
121 template<std::
size_t indexa, std::
size_t indexb>
122 static constexpr
auto 124 std::same_as<std::remove_cvref_t<Arg>, T> and
137 static constexpr
auto 153 template<triangle_type tri>
154 static constexpr
auto 156 (Arg&& arg) -> triangular_matrix<tri> decltype(
auto)
170 template<HermitianAdapterType h>
171 static constexpr
auto 172 make_hermitian_adapter = []<
typename Arg> requires std::same_as<std::remove_cvref_t<Arg>, T>
173 (Arg&& arg) -> hermitian_matrix<h> decltype(
auto)
219 static constexpr
auto 220 to_euclidean = []<
typename Arg> requires std::same_as<std::remove_cvref_t<Arg>, T>
221 (Arg&& arg) -> has_untyped_index<0> decltype(
auto)
234 static constexpr
auto 235 from_euclidean = []<
typename Arg> requires std::same_as<std::remove_cvref_t<Arg>, T> and all_fixed_indices_are_euclidean<T>
236 (Arg&& arg,
const has_untyped_index<0>
auto& v) ->
indexible decltype(
auto)
247 static constexpr
auto 248 wrap_angles = []<
typename Arg> requires std::same_as<std::remove_cvref_t<Arg>, T>
249 (Arg&& arg) -> std::convertible_to<const T&> decltype(
auto)
260 static constexpr
auto 261 slice = []<
typename Arg> requires std::same_as<std::remove_cvref_t<Arg>, T>
262 (Arg&& arg,
const index_collection_for<Arg>
auto& begin,
const collections::index_collection
auto&
size)
277 static constexpr
auto 279 (T& t,
indexible auto&& block,
const index_collection_for<T>
auto& offsets) ->
void 293 template<triangle_type tri>
294 static constexpr
auto 295 set_triangle = [] requires writable<T>
296 (T& t, patterns_may_match_with<T>
auto&& b) ->
void 309 static constexpr
auto 310 broadcast = []<
typename Arg> requires std::same_as<std::remove_cvref_t<Arg>, T>
311 (Arg&& arg,
const collections::index_collection
auto& factors) ->
indexible auto 331 static constexpr
auto 333 compares_with_pattern_collection<Patterns>...Args>
335 std::invocable<Operation&&, element_type_of_t<Args>...> or
336 std::invocable<Operation&&, std::array<std::size_t, collections::size_of_v<Patterns>>,
element_type_of_t<Args>...> or
338 (
const Patterns& patterns, Operation&& op, Args&&...args)
339 -> compares_with_pattern_collection<Patterns>
auto 355 template<std::size_t...indices,
typename BinaryFunction>
356 static constexpr
auto 357 reduce = []<
typename Arg,
typename BinaryFunction>
358 requires std::same_as<std::remove_cvref_t<Arg>, T> and
360 (Arg&& arg, BinaryFunction&& binary_function)
370 static constexpr
auto 371 determinant = [] requires square_shaped<T, 2, applicability::permitted>
383 static constexpr
auto 385 (Args&&...args) -> patterns_may_match_with<Args...> decltype(
auto)
396 static constexpr
auto 397 scalar_product = [](
const T& t, std::convertible_to<element_type_of_t<T>>
const auto& s)
398 -> patterns_may_match_with<T> decltype(
auto)
409 static constexpr
auto 410 scalar_quotient = [](
const T& t, std::convertible_to<element_type_of_t<T>>
const auto& s)
411 -> patterns_may_match_with<T> decltype(
auto)
422 static constexpr
auto 424 (
const T& a,
const dimension_size_of_index_is<0, index_dimension_of<T, 1>, &stdex::is_eq,
applicability::permitted>
auto& b)
436 template<
bool on_the_right>
437 static constexpr
auto 452 template<triangle_type tri>
453 static constexpr
auto 473 template<HermitianAdapterType significant_triangle>
474 static constexpr
auto 476 requires std::same_as<std::remove_cvref_t<A>, T> and
504 static constexpr
auto 506 requires std::same_as<std::remove_cvref_t<A>, T> and
511 -> triangular_matrix<triangle> decltype(
auto)
531 template<
bool must_be_unique = false,
bool must_be_exact = false>
532 static constexpr
auto 534 (
const T& a,
const dimension_size_of_index_is<0, index_dimension_of_v<A, 0>, &stdex::is_eq,
applicability::permitted>
auto& b)
547 static constexpr
auto 548 LQ_decomposition = []<
typename Arg> requires std::same_as<std::remove_cvref_t<Arg>, T>
549 (Arg&& arg) -> triangular_matrix<triangle_type::lower>
auto 561 static constexpr
auto 562 QR_decomposition = []<
typename Arg> requires std::same_as<std::remove_cvref_t<Arg>, T>
563 (Arg&& arg) -> triangular_matrix<triangle_type::upper>
auto 568 #endif // DOXYGEN_SHOULD_SKIP_THIS Definition for internal::slice_specifier.
decltype(auto) constexpr from_euclidean(Arg &&arg, const V &v)
Project the Euclidean vector space associated with index 0 to patterns::pattern v after applying dire...
Definition: from_euclidean.hpp:35
constexpr auto n_ary_operation(const std::tuple< Ds... > &d_tup, Operation &&operation, Args &&...args)
Perform a component-wise n-ary operation, using broadcasting to match the size of a pattern matrix...
Definition: n_ary_operation.hpp:325
constexpr bool pattern_collection
An object describing a sized collection of /ref sized_pattern objects.
Definition: pattern_collection.hpp:66
decltype(auto) constexpr contract(A &&a, B &&b)
Matrix multiplication of A * B.
Definition: contract.hpp:54
Definition: basics.hpp:41
decltype(auto) rank_update_hermitian(A &&a, U &&u, scalar_type_of_t< A > alpha=1)
Do a rank update on a hermitian matrix.
Definition: rank_update_hermitian.hpp:45
Definition for layout_mapping_policy.
constexpr bool diagonal_matrix
Specifies that a type is a diagonal matrix or tensor.
Definition: diagonal_matrix.hpp:32
A lower-left triangular matrix.
decltype(auto) constexpr conjugate(Arg &&arg)
Take the complex conjugate of an indexible object.
Definition: conjugate.hpp:44
The concept, trait, or restraint is permitted, but whether it applies is not necessarily known at com...
constexpr bool indexible
T is a multidimensional array type.
Definition: indexible.hpp:32
decltype(auto) constexpr QR_decomposition(A &&a)
Perform a QR decomposition of matrix A=Q[U,0], U is a upper-triangular matrix, and Q is orthogonal...
Definition: QR_decomposition.hpp:33
decltype(auto) constexpr conjugate_transpose(Arg &&arg)
Take the conjugate-transpose of an indexible_object.
Definition: conjugate_transpose.hpp:35
decltype(auto) constexpr copy_from(Dest &&dest, Source &&source)
Copy elements from one object to another.
Definition: copy_from.hpp:59
decltype(auto) constexpr reduce(BinaryFunction &&b, Arg &&arg)
Perform a partial reduction based on an associative binary function, across one or more indices...
Definition: reduce.hpp:143
Enumerations relating to linear algebra.
decltype(auto) constexpr broadcast(Arg &&arg, const Factors &...factors)
Broadcast an object by replicating it by factors specified for each index.
Definition: broadcast.hpp:49
constexpr bool hermitian_matrix
Specifies that a type is a hermitian matrix.
Definition: hermitian_matrix.hpp:59
Definition for element_type_of.
constexpr bool patterns_may_match_with
Specifies that indexible objects may have equivalent extents and patterns.
Definition: patterns_may_match_with.hpp:57
constexpr bool dimension_size_of_index_is
Specifies that a given index of T has a specified size.
Definition: dimension_size_of_index_is.hpp:35
An interface to various routines from the linear algebra library associated with indexible object T...
Definition: library_interface.hpp:42
decltype(auto) constexpr transpose(Arg &&arg)
Swap any two indices of an indexible_object.
Definition: transpose.hpp:49
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
decltype(auto) constexpr diagonal_of(Arg &&arg)
Extract a column vector (or column slice for rank>2 tensors) comprising the diagonal elements...
Definition: diagonal_of.hpp:44
constexpr auto solve(A &&a, B &&b)
Solve the equation AX = B for X, which may or may not be a unique solution.
Definition: solve.hpp:87
constexpr auto determinant(Arg &&arg)
Take the determinant of a matrix.
Definition: determinant.hpp:44
constexpr bool size
T is either an index representing a size, or unbounded_size_t, which indicates that the size is unbou...
Definition: size.hpp:71
decltype(auto) constexpr to_euclidean(Arg &&arg)
Project the vector space associated with index 0 to a Euclidean space for applying directional statis...
Definition: to_euclidean.hpp:38
constexpr detail::slice_adapter slice
a RangeAdapterObject associated with slice_view.
Definition: slice.hpp:423
An upper-right triangular matrix.
decltype(auto) constexpr sum(Ts &&...ts)
Element-by-element sum of one or more objects.
Definition: sum.hpp:112
decltype(auto) constexpr LQ_decomposition(A &&a)
Perform an LQ decomposition of matrix A=[L,0]Q, L is a lower-triangular matrix, and Q is orthogonal...
Definition: LQ_decomposition.hpp:33
decltype(auto) rank_update_triangular(A &&a, U &&u, scalar_type_of_t< A > alpha=1)
Do a rank update on triangular matrix.
Definition: rank_update_triangular.hpp:48
decltype(auto) constexpr to_diagonal(Arg &&arg, P &&p)
Convert a column vector (or any other array with a 1D second index) into a diagonal_matrix.
Definition: to_diagonal.hpp:46
typename element_type_of< T >::type element_type_of_t
helper template for element_type_of.
Definition: element_type_of.hpp:54
A matrix with typed rows and columns.
Definition: forward-class-declarations.hpp:292
decltype(auto) constexpr make_triangular_matrix(Arg &&arg)
Create a triangular_matrix from a general matrix.
Definition: make_triangular_matrix.hpp:35
decltype(auto) constexpr cholesky_factor(A &&a)
Take the Cholesky factor of a matrix.
Definition: cholesky_factor.hpp:38
constexpr Arg && set_slice(Arg &&arg, Block &&block, const Begin &...begin)
Assign an object to a particular slice of a matrix or tensor.
Definition: set_slice.hpp:56