akreon-convex
Typed convex modeling, conic canonicalization, and primal-dual optimization in C++26.
Loading...
Searching...
No Matches
convex::Ellipsoid< Meta, Child > Struct Template Reference

forward declaration of ellipsoid set More...

#include <ellipsoid.hpp>

Inheritance diagram for convex::Ellipsoid< Meta, Child >:
[legend]

Public Types

using ConvexBase = ConvexSet< Meta, Ellipsoid< Meta, Child >, Child >
 bring into scope the type traits from the base class
 
using Mat = linalg::Matrix< T, N, N >
 common mat type for P
 
- Public Types inherited from convex::ConvexSet< Meta, Ellipsoid< Meta, Child >, Child >
using BaseT = Atom< Meta, ConvexSet< Meta, Ellipsoid< Meta, Child >, Child >, Child >
 alias to extract type traits from Domain convex set
 
- Public Types inherited from convex::Atom< Meta, Derived, Cs >
using Domain = meta_dom_t< Meta >
 Atom input domain.
 
using Codomain = meta_codom_t< Meta >
 Atom output codomain.
 
using ChildrenT = std::tuple< atom_decay_t< Cs >... >
 Tuple of decayed child atom types.
 
using T = dom_type_t< Domain >
 Scalar field for the atom domain.
 
using PointT = dom_point_t< Domain >
 Point type accepted by the atom domain.
 

Public Member Functions

constexpr Ellipsoid (const PointT &c_in, const Mat &P_in, const Child &child_in)
 CTOR for ellipsoidal set.
 
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_well_formed () const
 is_well_formed implementation checks to see if set is valid
 
template<linalg::SquareMatrix Mat>
requires (linalg::mat_cols_v<Mat> == N && std::same_as<T, linalg::matrix_scalar_t<Mat>>)
constexpr auto transform_impl (const affine::AffineMap< Mat > &map) const
 transform set from an affine map
 
template<typename Other >
constexpr bool is_equal_impl (const Other &other) const
 equality comparison
 
template<AtomType Type, conic::BuilderLike Builder>
constexpr auto canonicalize_set (const Builder &builder) const
 canonicalize impl
 
- Public Member Functions inherited from convex::ConvexSet< Meta, Ellipsoid< Meta, Child >, Child >
constexpr ConvexSet (const Child &child_in)
 CTOR.
 
constexpr void validate_domain_impl () const
 is_well_formed
 
constexpr bool contains (const PointT &x, T tol=1e-8) const
 contains to check if the point lies in the convex set
 
constexpr auto transform (const affine::AffineMap< Mat > &map) const
 transform convex set by affine map
 
constexpr bool operator== (const ConvexSet< Meta, OtherDerived, OtherChild > &other) const
 equality comparison overload
 
constexpr bool operator!= (const ConvexSet< Meta, OtherDerived, OtherChild > &other) const
 inequality comparison overload
 
constexpr auto canonicalize_impl (const Builder &builder) const
 canonicalize
 
constexpr auto self () const
 self function which returns a const ref to the derived object
 
- Public Member Functions inherited from convex::Atom< Meta, Derived, Cs >
constexpr Atom ()
 Construct a leaf atom with no children.
 
constexpr Atom (ChildrenT child_in)
 Construct an atom with normalized children.
 
constexpr void validate_fn_domain (const auto &child) const
 Validate DCP composition for a function child.
 
constexpr void validate_domain () const
 Validate child domains, signs, curvature, and composition rules.
 
template<AtomType Type, conic::BuilderLike Builder>
constexpr auto canonicalize (const Builder &builder) const
 Dispatch canonicalization to the derived atom.
 
constexpr const Derived & self () const
 Return this object as the CRTP-derived atom type.
 

Public Attributes

PointT c
 member variables in the ellipsoid
 
Mat P
 
- Public Attributes inherited from convex::Atom< Meta, Derived, Cs >
ChildrenT children
 Tuple of normalized child atoms.
 

Additional Inherited Members

- Static Public Attributes inherited from convex::Atom< Meta, Derived, Cs >
static constexpr std::size_t N = dom_size_v<Domain>
 Domain dimension.
 
static constexpr std::size_t M = dom_size_v<Codomain>
 Codomain dimension.
 
static constexpr CurvatureType Curvature = meta_curv_v<Meta>
 Curvature declared by atom metadata.
 
static constexpr VarType DomSign = dom_vartype_v<Domain>
 Domain sign declared by atom metadata.
 
static constexpr VarType CodomSign = dom_vartype_v<Codomain>
 Codomain sign declared by atom metadata.
 

Detailed Description

template<typename Meta, typename Child>
struct convex::Ellipsoid< Meta, Child >

forward declaration of ellipsoid set

Ellipsoid defined as the following.

E = { x | (x - c)^T P (x - c) <= 1 } s.t. P in S^n_+

Definition at line 32 of file ellipsoid.hpp.

Member Typedef Documentation

◆ ConvexBase

template<typename Meta , typename Child >
using convex::Ellipsoid< Meta, Child >::ConvexBase = ConvexSet<Meta, Ellipsoid<Meta, Child>, Child>

bring into scope the type traits from the base class

Definition at line 34 of file ellipsoid.hpp.

◆ Mat

template<typename Meta , typename Child >
using convex::Ellipsoid< Meta, Child >::Mat = linalg::Matrix<T, N, N>

common mat type for P

Definition at line 42 of file ellipsoid.hpp.

Constructor & Destructor Documentation

◆ Ellipsoid()

template<typename Meta , typename Child >
constexpr convex::Ellipsoid< Meta, Child >::Ellipsoid ( const PointT &  c_in,
const Mat &  P_in,
const Child &  child_in 
)
inlineexplicitconstexpr

CTOR for ellipsoidal set.

Parameters
centerpoint (i.e., n-dim vector of type T)
Pin S^n_+
child

Definition at line 51 of file ellipsoid.hpp.

Member Function Documentation

◆ canonicalize_set()

template<typename Meta , typename Child >
template<AtomType Type, conic::BuilderLike Builder>
constexpr auto convex::Ellipsoid< Meta, Child >::canonicalize_set ( const Builder &  builder) const
inlineconstexpr

canonicalize impl

E = { x | (x - c)^T P (x - c) <= 1, P in S^n_+ }

Eigen decomposition: P = V D V^T (x - c)^T V D V^T (x - c) <= 1 let u = V^T (x - c), u^T = (x-c)^T V

Let w = D^{1/2} V^T (x - c). Then (x - c)^T P (x - c) <= 1 <=> ||w||_2 <= 1.

Direct cone map: [ D^{1/2} V^T ] x + [ -D^{1/2} V^T c ] [ 0 ] [ 1 ] in K_soc

Returns
cone block

Definition at line 144 of file ellipsoid.hpp.

References convex::Ellipsoid< Meta, Child >::c, convex::Atom< Meta, Derived, Cs >::children, convex::dom_size_v, convex::Atom< Meta, Derived, Cs >::N, and convex::Ellipsoid< Meta, Child >::P.

◆ contains_impl()

template<typename Meta , typename Child >
constexpr bool convex::Ellipsoid< Meta, Child >::contains_impl ( const PointT &  x,
T   
) const
inlineconstexpr

contains function to see if x is in the ellipsoid (x - c)^T P^{-1} (x - c) <= 1

Parameters
pointx of type T with n elements
toleranceof tyep T (ignored)
Returns
T/F

Definition at line 64 of file ellipsoid.hpp.

References convex::Ellipsoid< Meta, Child >::c, convex::dom_size_v, and convex::Ellipsoid< Meta, Child >::P.

◆ is_equal_impl()

template<typename Meta , typename Child >
template<typename Other >
constexpr bool convex::Ellipsoid< Meta, Child >::is_equal_impl ( const Other &  other) const
inlineconstexpr

equality comparison

Parameters
convexset
Returns
T/F

Definition at line 120 of file ellipsoid.hpp.

References convex::Ellipsoid< Meta, Child >::c, convex::dom_size_v, and convex::Ellipsoid< Meta, Child >::P.

◆ is_well_formed()

template<typename Meta , typename Child >
constexpr bool convex::Ellipsoid< Meta, Child >::is_well_formed ( ) const
inlineconstexpr

is_well_formed implementation checks to see if set is valid

Returns
T/F

Definition at line 79 of file ellipsoid.hpp.

References convex::dom_size_v, and convex::Ellipsoid< Meta, Child >::P.

◆ transform_impl()

template<typename Meta , typename Child >
template<linalg::SquareMatrix Mat>
requires (linalg::mat_cols_v<Mat> == N && std::same_as<T, linalg::matrix_scalar_t<Mat>>)
constexpr auto convex::Ellipsoid< Meta, Child >::transform_impl ( const affine::AffineMap< Mat > &  map) const
inlineconstexpr

transform set from an affine map

E = {x | (x - c)^T P (x - c) <= 1} f(x) = U x + t -> { y = f(x) | x in E } x = U^{-1}(y - t), sub back in we get... E' = {y | (U^{-1}(y - t) - c)^T P (U^{-1}(y - t) - c) <= 1} ... U^{-1}(y - t) - c to U^{-1}(y - (U c + t) E' = { y | (y - (U c + t))^T U^{-T} P U^{-1} (y - (U c + t)) <= 1

c' = U c + t P' = U^{-T} P u

Parameters
Affinemap
Returns
transformed ellipsoid

Definition at line 104 of file ellipsoid.hpp.

References convex::Ellipsoid< Meta, Child >::c, convex::Atom< Meta, Derived, Cs >::children, convex::dom_size_v, and convex::Ellipsoid< Meta, Child >::P.

Member Data Documentation

◆ c

◆ P


The documentation for this struct was generated from the following files: