17 #ifndef OPENKALMAN_COVARIANCEBASE1_HPP 18 #define OPENKALMAN_COVARIANCEBASE1_HPP 30 template<
typename Derived,
typename NestedMatrix>
32 template<
typename Derived,
typename NestedMatrix,
typename =
void>
41 template<
typename Cov,
typename Nested = nested_
object_of_t<Cov>>
43 concept case1or2 = (self_adjoint_covariance<Cov> and hermitian_matrix<Nested>) or
44 (triangular_covariance<Cov> and triangular_matrix<Nested>);
46 static constexpr
bool case1or2 = (self_adjoint_covariance<Cov> and hermitian_matrix<Nested>) or
47 (triangular_covariance<Cov> and triangular_matrix<Nested>);
62 template<
typename Derived,
typename NestedMatrix> requires
63 case1or2<Derived, NestedMatrix> and self_contained<NestedMatrix>
66 template<typename Derived, typename NestedMatrix>
68 case1or2<Derived, NestedMatrix> and self_contained<NestedMatrix>>>
80 template<
typename,
typename>
82 template<
typename,
typename,
typename>
88 using CholeskyNestedMatrix = std::conditional_t<diagonal_matrix<NestedMatrix>,
89 typename MatrixTraits<std::decay_t<NestedMatrix>>::template DiagonalMatrixFrom<>,
90 std::conditional_t<triangular_matrix<NestedMatrix>,
91 typename MatrixTraits<std::decay_t<NestedMatrix>>::template SelfAdjointMatrixFrom<>,
92 typename MatrixTraits<std::decay_t<NestedMatrix>>::template TriangularAdapterFrom<>>>;
100 decltype(
auto) cholesky_nested_matrix() &
108 decltype(
auto) cholesky_nested_matrix()
const &
116 decltype(
auto) cholesky_nested_matrix() &&
118 if constexpr (triangular_covariance<Derived>)
return cholesky_square(std::move(*this).nested_object());
124 decltype(
auto) cholesky_nested_matrix()
const &&
126 if constexpr (triangular_covariance<Derived>)
return cholesky_square(std::move(*this).nested_object());
135 constexpr
static int synchronization_direction() {
return 0; }
143 constexpr
static void synchronize_forward() {};
151 constexpr
static void synchronize_reverse() {};
159 constexpr
static void mark_nested_matrix_changed() {};
167 constexpr
static void mark_cholesky_nested_matrix_changed() {};
175 constexpr
static void mark_synchronized() {};
180 #ifdef __cpp_concepts 181 CovarianceBase() requires std::default_initializable<NestedMatrix>
183 template<
typename T = NestedMatrix, std::enable_if_t<std::is_default_constructible_v<T>,
int> = 0>
192 #ifdef __cpp_concepts 193 template<covariance Arg> requires (not std::derived_from<std::decay_t<Arg>,
CovarianceBase>)
195 template<
typename Arg, std::enable_if_t<covariance<Arg> and
196 (not std::is_base_of_v<CovarianceBase, std::decay_t<Arg>>),
int> = 0>
204 #ifdef __cpp_concepts 205 template<covariance_nestable Arg>
207 template<
typename Arg, std::enable_if_t<covariance_nestable<Arg>,
int> = 0>
209 explicit CovarianceBase(Arg&& arg) :
Base {to_covariance_nestable<NestedMatrix>(std::forward<Arg>(arg))} {}
216 #ifdef __cpp_concepts 217 template<
typename Arg> requires (covariance<Arg> or covariance_nestable<Arg>) and
220 template<
typename Arg, std::enable_if_t<(covariance<Arg> or covariance_nestable<Arg>) and
221 (not std::is_base_of_v<CovarianceBase, std::decay_t<Arg>>),
int> = 0>
223 auto& operator=(Arg&& arg)
225 Base::operator=(to_covariance_nestable<NestedMatrix>(std::forward<Arg>(arg)));
236 auto operator() (std::size_t i, std::size_t j)
243 auto operator() (std::size_t i, std::size_t j)
const 254 auto operator[] (std::size_t i)
261 auto operator[] (std::size_t i)
const 270 void set_component(
const Scalar s,
const std::size_t i,
const std::size_t j)
289 #endif //OPENKALMAN_COVARIANCEBASE1_HPP Definition: ElementAccessor.hpp:34
Arg && set_component(Arg &&arg, const scalar_type_of_t< Arg > &s, const Indices &indices)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: set_component.hpp:51
typename scalar_type_of< T >::type scalar_type_of_t
helper template for scalar_type_of.
Definition: scalar_type_of.hpp:54
CovarianceBase()
Default constructor.
Definition: CovarianceBase1.hpp:184
Definition: tuple_reverse.hpp:103
Definition: AdapterBase.hpp:36
decltype(auto) constexpr cholesky_square(A &&a)
Take the Cholesky square of a triangular_matrix.
Definition: cholesky_square.hpp:33
Definition: CovarianceBase1.hpp:34
CovarianceBase(Arg &&arg)
Construct from a covariance_nestable.
Definition: CovarianceBase1.hpp:209
void set_component(const Scalar s, const std::size_t i)
Set an element of the cholesky nested matrix.
Definition: CovarianceBase1.hpp:279
CovarianceBase(Arg &&arg)
Construct from another covariance.
Definition: CovarianceBase1.hpp:198
decltype(auto) constexpr nested_object(Arg &&arg)
Retrieve a nested object of Arg, if it exists.
Definition: nested_object.hpp:34
void set_component(const Scalar s, const std::size_t i, const std::size_t j)
Set an element of the cholesky nested matrix.
Definition: CovarianceBase1.hpp:270
Definition: basics.hpp:48
decltype(auto) constexpr cholesky_factor(A &&a)
Take the Cholesky factor of a matrix.
Definition: cholesky_factor.hpp:38