9#include "akreon/linalg/operator/symmetric_matrix.hpp"
14template <linalg::RnSpace Space>
18template <linalg::RnSpace Space>
22template <linalg::RnSpace Space>
31template <
typename Meta,
typename Child>
42 using Mat = linalg::Matrix<T, N, N>;
65 const auto delta = x -
c;
67 const auto [
P_inv, event] = linalg::MatrixInverse<decltype(P)>()(
P);
68 static_cast<void>(event);
70 static_assert(linalg::vector_dim_v<
decltype(res)> == 1);
71 return res(0) <=
T(1);
80 linalg::SymmetricMatrix
S(
P);
81 return S.type == linalg::SymmetricOperatorType::PD;
101 template <linalg::SquareMatrix Mat>
102 requires(linalg::mat_cols_v<Mat> ==
N &&
103 std::same_as<T, linalg::matrix_scalar_t<Mat>>)
105 const auto [
U_inv, event] = linalg::MatrixInverse<Mat>()(map.linear_part());
106 static_cast<void>(event);
119 template <
typename Other>
121 return other.self().c ==
c &&
other.self().P ==
P;
143 template <AtomType Type, conic::BuilderLike Builder>
151 linalg::mat_cols_v<
decltype(
child_coord.linear_part())>;
153 "Convex set domain does not equal the child coordinate "
154 "linear map's codomain in size");
156 linalg::Matrix<T, N + 1, N>
F;
157 linalg::Vector<T, N + 1>
g;
158 const auto eig_decomp = linalg::EigenDecomposition(
P);
160 linalg::Matrix<T, N, N>
D_sqrt;
161 for (std::size_t
i = 0;
i <
N; ++
i)
164 linalg::Matrix<T, N, N>
VT;
166 for (std::size_t
i = 0;
i <
N; ++
i)
167 for (std::size_t
j = 0;
j <
N; ++
j)
VT(
j,
i) =
V(
i,
j).real();
170 F = linalg::set_block<0, N, 0, N>(
F, w);
171 const auto wc =
T(-1) * w *
c;
172 for (std::size_t
i = 0;
i <
N; ++
i)
g(
i) =
wc(
i);
174 const auto map = affine::AffineMap<decltype(F)>(
F,
g);
176 const auto cones = std::make_tuple(
soc);
189template <
typename Po
int,
typename Mat,
typename Child>
constexpr std::size_t dom_size_v
linalg::remove_cvref_t< T > atom_decay_t
normalize atom-facing types to a stable internal form.
Atom-local canonical emission bundle.
ChildrenT children
Tuple of normalized child atoms.
dom_point_t< Domain > PointT
Point type accepted by the atom domain.
dom_type_t< Domain > T
Scalar field for the atom domain.
static constexpr std::size_t N
Domain dimension.
Domain wrapper with a static sign label.
forward declaration of convex set
forward declaration of ellipsoid set
linalg::Matrix< T, N, N > Mat
common mat type for P
PointT c
member variables in the ellipsoid
constexpr bool is_well_formed() const
is_well_formed implementation checks to see if set is valid
constexpr auto canonicalize_set(const Builder &builder) const
canonicalize impl
constexpr Ellipsoid(const PointT &c_in, const Mat &P_in, const Child &child_in)
CTOR for ellipsoidal set.
constexpr auto transform_impl(const affine::AffineMap< Mat > &map) const
transform set from an affine map
constexpr bool contains_impl(const PointT &x, T) const
contains function to see if x is in the ellipsoid (x - c)^T P^{-1} (x - c) <= 1
constexpr bool is_equal_impl(const Other &other) const
equality comparison