11 #ifndef OPENKALMAN_DEFAULT_OVERLOADS_HPP 12 #define OPENKALMAN_DEFAULT_OVERLOADS_HPP 20 #include <type_traits> 40 requires (
sizeof...(Args) > 0) and (coordinates::dimension_of_v<RowCoefficients> * coordinates::dimension_of_v<ColumnCoefficients> == sizeof...(Args))
42 template<
typename RowCoefficients,
typename ColumnCoefficients = RowCoefficients,
typename ... Args,
43 std::enable_if_t<(
sizeof...(Args) > 0) and (values::
number<Args> and ...) and
44 (coordinates::dimension_of_v<RowCoefficients> * coordinates::dimension_of_v<ColumnCoefficients> == sizeof...(Args)),
int> = 0>
46 auto make_matrix(
const Args...args)
48 using Scalar = std::common_type_t<Args...>;
49 using Mat = Eigen3::eigen_matrix_t<Scalar, coordinates::dimension_of_v<RowCoefficients>, coordinates::dimension_of_v<ColumnCoefficients>>;
50 return Matrix<RowCoefficients, ColumnCoefficients, Mat>(make_dense_object_from<Mat>(
static_cast<const Scalar
>(args)...));
63 template<
typename ... Args, std::enable_if_t<
64 (
sizeof...(Args) > 0) and (values::
number<Args> and ...),
int> = 0>
66 auto make_matrix(
const Args ... args)
68 return make_matrix<Dimensions<
sizeof...(Args)>, Axis>(args...);
82 fixed_pattern ColumnCoefficients = RowCoefficients>
84 template<
typename Scalar,
typename RowCoefficients,
typename ColumnCoefficients = RowCoefficients,
85 std::enable_if_t<values::number<Scalar> and
86 fixed_pattern<RowCoefficients> and fixed_pattern<ColumnCoefficients>,
int> = 0>
103 #ifdef __cpp_concepts 104 template<fixed_pattern StaticDescriptor,
values::number ... Args> requires
105 (
sizeof...(Args) > 0) and (
sizeof...(Args) % coordinates::dimension_of_v<StaticDescriptor> == 0)
107 template<
typename StaticDescriptor,
typename ... Args, std::enable_if_t<fixed_pattern<StaticDescriptor> and
108 (
sizeof...(Args) > 0) and (values::number<Args> and ...) and
109 (
sizeof...(Args) % coordinates::dimension_of_v<StaticDescriptor> == 0),
int> = 0>
113 using Scalar = std::decay_t<std::common_type_t<Args...>>;
114 constexpr std::size_t dim = coordinates::dimension_of_v<StaticDescriptor>;
115 constexpr std::size_t cols =
sizeof...(Args) / dim;
127 #ifdef __cpp_concepts 130 template<
typename ... Args, std::enable_if_t<
131 (
sizeof...(Args) > 0) and (values::number<Args> and ...),
int> = 0>
135 return make_mean<OpenKalman::Dimensions<
sizeof...(Args)>>(args...);
147 #ifdef __cpp_concepts 148 template<values::number Scalar, fixed_pattern StaticDescriptor, std::
size_t cols = 1>
150 template<
typename Scalar,
typename StaticDescriptor, std::size_t cols = 1, std::enable_if_t<
151 values::number<Scalar> and fixed_pattern<StaticDescriptor>,
int> = 0>
167 #ifdef __cpp_concepts 168 template<fixed_pattern StaticDescriptor,
values::number ... Args> requires
169 (
sizeof...(Args) > 0) and (
sizeof...(Args) % coordinates::stat_dimension_of_v<StaticDescriptor> == 0)
171 template<
typename StaticDescriptor,
typename ... Args, std::enable_if_t<
172 (
sizeof...(Args) > 0) and (values::number<Args> and ...) and
173 (
sizeof...(Args) % coordinates::stat_dimension_of_v<StaticDescriptor> == 0),
int> = 0>
177 using Scalar = std::decay_t<std::common_type_t<Args...>>;
178 constexpr std::size_t dim = coordinates::stat_dimension_of_v<StaticDescriptor>;
179 constexpr std::size_t cols =
sizeof...(Args) / dim;
191 #ifdef __cpp_concepts 194 template<
typename ... Args, std::enable_if_t<
195 (
sizeof...(Args) > 0) and (values::number<Args> and ...),
int> = 0>
211 #ifdef __cpp_concepts 212 template<values::number Scalar, fixed_pattern StaticDescriptor, std::
size_t cols = 1>
214 template<
typename Scalar,
typename StaticDescriptor, std::size_t cols = 1, std::enable_if_t<
215 values::number<Scalar> and fixed_pattern<StaticDescriptor>,
int> = 0>
232 #ifdef __cpp_concepts 235 (
sizeof...(Args) > 0) and (
sizeof...(Args) == coordinates::dimension_of_v<StaticDescriptor> * coordinates::dimension_of_v<StaticDescriptor>)
237 template<
typename StaticDescriptor,
TriangleType triangle_type,
typename ... Args, std::enable_if_t<
238 fixed_pattern<StaticDescriptor> and (values::number<Args> and ...) and
240 (
sizeof...(Args) > 0) and (
sizeof...(Args) == coordinates::dimension_of_v<StaticDescriptor> * coordinates::dimension_of_v<StaticDescriptor>),
int> = 0>
244 using Scalar = std::decay_t<std::common_type_t<Args...>>;
260 #ifdef __cpp_concepts 261 template<fixed_pattern StaticDescriptor,
values::number ... Args> requires
262 (
sizeof...(Args) > 0) and (
sizeof...(Args) == coordinates::dimension_of_v<StaticDescriptor> * coordinates::dimension_of_v<StaticDescriptor>)
264 template<
typename StaticDescriptor,
typename ... Args, std::enable_if_t<
265 fixed_pattern<StaticDescriptor> and (values::number<Args> and ...) and
266 (
sizeof...(Args) > 0) and (
sizeof...(Args) == coordinates::dimension_of_v<StaticDescriptor> * coordinates::dimension_of_v<StaticDescriptor>),
int> = 0>
270 using Scalar = std::decay_t<std::common_type_t<Args...>>;
272 auto mat = make_dense_object_from<Mat>(
static_cast<const Scalar
>(args)...);
286 #ifdef __cpp_concepts 289 (
sizeof...(Args) == static_cast<std::size_t>(
values::sqrt(
sizeof...(Args))) * static_cast<std::size_t>(
values::sqrt(
sizeof...(Args))))
291 template<
TriangleType triangle_type,
typename ... Args, std::enable_if_t<
292 (
sizeof...(Args) > 0) and (values::number<Args> and ...) and
294 (
sizeof...(Args) == static_cast<std::size_t>(
values::sqrt(
sizeof...(Args))) * static_cast<std::size_t>(
values::sqrt(
sizeof...(Args)))),
int> = 0>
298 constexpr
auto dim =
static_cast<std::size_t
>(
values::sqrt(
sizeof...(Args)));
299 using StaticDescriptor = OpenKalman::Dimensions<dim>;
300 return make_covariance<StaticDescriptor, triangle_type>(args...);
311 #ifdef __cpp_concepts 312 template<
values::number ... Args> requires (
sizeof...(Args) > 0) and
313 (
sizeof...(Args) == static_cast<std::size_t>(
values::sqrt(
sizeof...(Args))) * static_cast<std::size_t>(
values::sqrt(
sizeof...(Args))))
315 template<
typename ... Args, std::enable_if_t<(
sizeof...(Args) > 0) and (values::number<Args> and ...) and
316 (
sizeof...(Args) == static_cast<std::size_t>(
values::sqrt(
sizeof...(Args))) * static_cast<std::size_t>(
values::sqrt(
sizeof...(Args)))),
int> = 0>
320 constexpr
auto dim =
static_cast<std::size_t
>(
values::sqrt(
sizeof...(Args)));
321 using StaticDescriptor = OpenKalman::Dimensions<dim>;
322 return make_covariance<StaticDescriptor>(args...);
334 #ifdef __cpp_concepts 335 template<fixed_pattern StaticDescriptor, TriangleType triangle_type, values::number Scalar =
double>
338 template<
typename StaticDescriptor,
TriangleType triangle_type,
typename Scalar = double, std::enable_if_t<
339 fixed_pattern<StaticDescriptor> and
341 values::number<Scalar>,
int> = 0>
358 #ifdef __cpp_concepts 359 template<fixed_pattern StaticDescriptor, values::number Scalar =
double>
361 template<
typename StaticDescriptor,
typename Scalar = double, std::enable_if_t<
362 fixed_pattern<StaticDescriptor> and values::number<Scalar>,
int> = 0>
382 #ifdef __cpp_concepts 385 (
sizeof...(Args) > 0) and (
sizeof...(Args) == coordinates::dimension_of_v<StaticDescriptor> * coordinates::dimension_of_v<StaticDescriptor>)
388 std::enable_if_t<fixed_pattern<StaticDescriptor> and (values::number<Args> and ...) and
390 (
sizeof...(Args) > 0) and (
sizeof...(Args) == coordinates::dimension_of_v<StaticDescriptor> * coordinates::dimension_of_v<StaticDescriptor>),
int> = 0>
394 using Scalar = std::decay_t<std::common_type_t<Args...>>;
396 auto mat = make_dense_object_from<Mat>(
static_cast<const Scalar
>(args)...);
398 auto tri = Tri {mat};
411 #ifdef __cpp_concepts 414 (
sizeof...(Args) == static_cast<std::size_t>(
values::sqrt(
sizeof...(Args))) * static_cast<std::size_t>(
values::sqrt(
sizeof...(Args))))
417 (
sizeof...(Args) > 0) and (values::number<Args> and ...) and
419 (
sizeof...(Args) == static_cast<std::size_t>(
values::sqrt(
sizeof...(Args))) *
420 static_cast<std::size_t>(
values::sqrt(
sizeof...(Args)))),
int> = 0>
424 constexpr
auto dim =
static_cast<std::size_t
>(
values::sqrt(
sizeof...(Args)));
425 using StaticDescriptor = OpenKalman::Dimensions<dim>;
426 return make_square_root_covariance<StaticDescriptor, triangle_type>(args...);
438 #ifdef __cpp_concepts 439 template<fixed_pattern StaticDescriptor, TriangleType triangle_type = TriangleType::lower, values::number Scalar =
double>
443 std::enable_if_t<fixed_pattern<StaticDescriptor> and
458 #ifndef OPENKALMAN_FIRST_INTERFACE 465 #define OPENKALMAN_FIRST_INTERFACE 472 #ifdef __cpp_concepts 474 fixed_pattern RowCoefficients,
475 fixed_pattern ColumnCoefficients = RowCoefficients,
479 (coordinates::dimension_of_v<RowCoefficients> == index_dimension_of_v<NestedMatrix, 0>) and
480 (coordinates::dimension_of_v<ColumnCoefficients> == index_dimension_of_v<NestedMatrix, 1>) and
481 (not std::is_rvalue_reference_v<NestedMatrix>) and
482 (dynamic_pattern<RowCoefficients> == dynamic_dimension<NestedMatrix, 0>) and
483 (dynamic_pattern<ColumnCoefficients> == dynamic_dimension<NestedMatrix, 1>)
486 typename RowCoefficients,
487 typename ColumnCoefficients = RowCoefficients,
494 #ifdef __cpp_concepts 497 template<
typename ... Args, std::enable_if_t<(
sizeof...(Args) > 0) and (values::number<Args> and ...),
int> = 0>
499 Matrix(
const Args ...) ->
Matrix<Dimensions<
sizeof...(Args)>, Axis,
508 #ifdef __cpp_concepts 509 template<fixed_pattern RowCoefficients,
511 requires (coordinates::dimension_of_v<RowCoefficients> == index_dimension_of_v<NestedMatrix, 0>) and
512 (not std::is_rvalue_reference_v<NestedMatrix>)
514 template<
typename RowCoefficients,
521 #ifdef __cpp_concepts 524 template<
typename ... Args, std::enable_if_t<(
sizeof...(Args) > 0) and (values::number<Args> and ...),
int> = 0>
526 Mean(
const Args ...) ->
Mean<Dimensions<
sizeof...(Args)>,
534 #ifdef __cpp_concepts 536 fixed_pattern StaticDescriptor,
539 (coordinates::stat_dimension_of_v<StaticDescriptor> == index_dimension_of_v<NestedMatrix, 0>) and
540 (not std::is_rvalue_reference_v<NestedMatrix>)
542 template<
typename StaticDescriptor,
549 #ifdef __cpp_concepts 552 template<
typename ... Args, std::enable_if_t<(
sizeof...(Args) > 0) and (values::number<Args> and ...),
int> = 0>
562 #ifdef __cpp_concepts 565 requires (coordinates::dimension_of_v<StaticDescriptor> == index_dimension_of_v<NestedMatrix, 0>) and
566 (not std::is_rvalue_reference_v<NestedMatrix>) and values::number<scalar_type_of_t<NestedMatrix>>
568 template<
typename StaticDescriptor,
typename NestedMatrix =
575 #if defined(__cpp_concepts) && not defined(__clang__) // Because of compiler issue in at least clang version 10.0.0 576 template<
values::number ... Args> requires (
sizeof...(Args) > 0) and
577 (
sizeof...(Args) == static_cast<std::size_t>(
values::sqrt(
sizeof...(Args))) *
578 static_cast<std::size_t>(
values::sqrt(
sizeof...(Args))))
580 template<
typename ... Args, std::enable_if_t<(values::number<Args> and ...) and (
sizeof...(Args) > 0) and
581 (
sizeof...(Args) == static_cast<std::size_t>(
values::sqrt(
sizeof...(Args))) *
582 static_cast<std::size_t>(
values::sqrt(
sizeof...(Args)))),
int> = 0>
586 static_cast<std::size_t>(
values::sqrt(
sizeof...(Args))), static_cast<std::size_t>(
values::sqrt(
sizeof...(Args)))>>>;
593 #ifdef __cpp_concepts 596 requires (coordinates::dimension_of_v<StaticDescriptor> == index_dimension_of_v<NestedMatrix, 0>) and
597 (not std::is_rvalue_reference_v<NestedMatrix>) and values::number<scalar_type_of_t<NestedMatrix>>
599 template<
typename StaticDescriptor,
typename NestedMatrix =
606 #if defined(__cpp_concepts) && not defined(__clang__) // Because of compiler issue in at least clang version 10.0.0 607 template<
values::number ... Args> requires (
sizeof...(Args) > 0) and
608 (
sizeof...(Args) == static_cast<std::size_t>(
values::sqrt(
sizeof...(Args))) *
609 static_cast<std::size_t>(
values::sqrt(
sizeof...(Args))))
611 template<
typename ... Args, std::enable_if_t<(values::number<Args> and ...) and (
sizeof...(Args) > 0) and
612 (
sizeof...(Args) == static_cast<std::size_t>(
values::sqrt(
sizeof...(Args))) *
613 static_cast<std::size_t>(
values::sqrt(
sizeof...(Args)))),
int> = 0>
616 Dimensions<static_cast<std::size_t>(
values::sqrt(
sizeof...(Args)))>,
618 static_cast<std::size_t>(
values::sqrt(
sizeof...(Args))), static_cast<std::size_t>(
values::sqrt(
sizeof...(Args)))>>>;
623 #endif // OPENKALMAN_FIRST_INTERFACE 625 #endif //OPENKALMAN_DEFAULT_OVERLOADS_HPP A hermitian matrix wrapper.
Definition: HermitianAdapter.hpp:31
auto make_square_root_covariance(Arg &&arg)
Make a SquareRootCovariance from a covariance_nestable, specifying the coefficients.
Definition: SquareRootCovariance.hpp:673
TriangleType
The type of a triangular matrix.
Definition: global-definitions.hpp:60
A set of one or more column vectors, each representing a statistical mean.
Definition: forward-class-declarations.hpp:477
A triangular_adapter, where components above or below the diagonal (or both) are zero.
Definition: forward-class-declarations.hpp:257
auto make_mean(M &&m)
Make a Mean from a typed_matrix_nestable, specifying the row fixed_pattern.
Definition: Mean.hpp:420
constexpr bool number
T is a numerical type.
Definition: number.hpp:33
An upper-right triangular matrix.
std::conditional_t< sizeof...(dims)==1, Eigen::Matrix< Scalar, detail::eigen_index_convert< dims >..., detail::eigen_index_convert< 1 > >, Eigen::Matrix< Scalar, detail::eigen_index_convert< dims >... > > eigen_matrix_t
An alias for a self-contained, writable, native Eigen matrix.
Definition: eigen-forward-declarations.hpp:491
The upper or lower triangle Cholesky factor (square root) of a covariance matrix. ...
Definition: forward-class-declarations.hpp:559
Matrix(M &&) -> Matrix< Dimensions< index_dimension_of_v< M, 0 >>, Dimensions< index_dimension_of_v< M, 1 >>, passable_t< M >>
Deduce parameter types from a typed_matrix_nestable.
constexpr bool typed_matrix_nestable
Specifies a type that is nestable in a general typed matrix (e.g., matrix, mean, or euclidean_mean) ...
Definition: object-types.hpp:253
Similar to a Mean, but the coefficients are transformed into Euclidean space, based on their type...
Definition: EuclideanMean.hpp:29
The root namespace for OpenKalman.
Definition: basics.hpp:34
auto make_euclidean_mean(M &&arg)
Make a EuclideanMean from a typed_matrix_nestable, specifying the row coefficients.
Definition: EuclideanMean.hpp:320
EuclideanMean(V &&) -> EuclideanMean< vector_space_descriptor_of_t< V, 0 >, std::remove_reference_t< decltype(to_euclidean< vector_space_descriptor_of_t< V, 0 >>(nested_object(std::declval< V &&>())))>>
Deduce template parameters from a non-Euclidean-transformed typed matrix.
constexpr auto sqrt(const Arg &arg)
A constexpr alternative to std::sqrt.
Definition: sqrt.hpp:46
Covariance(M &&) -> Covariance< Dimensions< index_dimension_of_v< M, 0 >>, passable_t< M >>
Deduce Covariance type from a covariance_nestable.
A self-adjoint Covariance matrix.
Definition: Covariance.hpp:30
auto make_covariance(Arg &&arg)
Make a Covariance from a covariance_nestable, specifying the fixed_pattern.
Definition: Covariance.hpp:735
Mean(V &&) -> Mean< Dimensions< index_dimension_of_v< V, 0 >>, passable_t< V >>
Deduce template parameters from a typed_matrix_nestable, assuming untyped coordinates::pattern.
constexpr bool fixed_pattern
A coordinates::pattern for which the size is fixed at compile time.
Definition: fixed_pattern.hpp:47
constexpr bool covariance_nestable
T is an acceptable nested matrix for a covariance (including triangular_covariance).
Definition: object-types.hpp:237
SquareRootCovariance(M &&) -> SquareRootCovariance< Dimensions< index_dimension_of_v< M, 0 >>, passable_t< M >>
Deduce SquareRootCovariance type from a covariance_nestable.
A lower-left triangular matrix.
A matrix with typed rows and columns.
Definition: forward-class-declarations.hpp:448