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

forward declaration of norm ball set More...

#include <norm_ball.hpp>

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

Public Types

using ConvexBase = ConvexSet< Meta, NormBall< Meta, Child, Type >, Child >
 bring into scope the type traits from the base class
 
- Public Types inherited from convex::ConvexSet< Meta, NormBall< Meta, Child, Type >, Child >
using BaseT = Atom< Meta, ConvexSet< Meta, NormBall< Meta, Child, Type >, 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 NormBall (const PointT &c_in, T r_in, const Child &child_in)
 CTOR for NormBall set.
 
constexpr bool contains_impl (const PointT &x, T) const
 contains function to see if x is in the norm ball (norm(x - c) <= r)
 
constexpr bool is_well_formed () const
 is_well_formed checks to see if underlying set is a valid convex set
 
template<typename Other >
constexpr bool is_equal_impl (const Other &other) const
 equality comparison
 
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 norm ball by affine map
 
template<AtomType AType, conic::BuilderLike Builder>
constexpr auto canonicalize_set (const Builder &builder) const
 canonicalize impl
 
- Public Member Functions inherited from convex::ConvexSet< Meta, NormBall< Meta, Child, Type >, 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 norm ball
 
T r
 
- 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, NormBallType Type>
struct convex::NormBall< Meta, Child, Type >

forward declaration of norm ball set

Norm ball defined on valid vector space and one of the following type traits.

{ x | norm(x - c) <= r }... closed norm (L2, L1, Linf) ball that lies within radius { x | norm(x - c) < r}... open "" ball that ""

Definition at line 35 of file norm_ball.hpp.

Member Typedef Documentation

◆ ConvexBase

template<typename Meta , typename Child , NormBallType Type>
using convex::NormBall< Meta, Child, Type >::ConvexBase = ConvexSet<Meta, NormBall<Meta, Child, Type>, Child>

bring into scope the type traits from the base class

Definition at line 37 of file norm_ball.hpp.

Constructor & Destructor Documentation

◆ NormBall()

template<typename Meta , typename Child , NormBallType Type>
constexpr convex::NormBall< Meta, Child, Type >::NormBall ( const PointT &  c_in,
T  r_in,
const Child &  child_in 
)
inlineexplicitconstexpr

CTOR for NormBall set.

Parameters
Point(i.e., n-dim vector of type T)

Definition at line 47 of file norm_ball.hpp.

Member Function Documentation

◆ canonicalize_set()

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

canonicalize impl

C = { x | ||x - c|| <= r }

let y = x - c

L2 Direct SOC map: [ I ] x + [ -c ] [ 0 ] [ r ] so that (y, r) in K_soc.

Linf Direct nonnegative-cone map: [ I ] x + [ -c + r 1 ] [ -I ] [ c + r 1 ]

L1 Introduce u >= |y| with 1^T u <= r. The direct nonnegative-cone map is built over (x, u) without any homogeneous lift.

Definition at line 264 of file norm_ball.hpp.

References convex::NormBall< Meta, Child, Type >::c, convex::Atom< Meta, Derived, Cs >::children, convex::dom_size_v, convex::L2, convex::Linf, convex::Atom< Meta, Derived, Cs >::N, and convex::NormBall< Meta, Child, Type >::r.

◆ contains_impl()

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

contains function to see if x is in the norm ball (norm(x - c) <= r)

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

Definition at line 58 of file norm_ball.hpp.

References convex::NormBall< Meta, Child, Type >::c, convex::L1, convex::L2, convex::Linf, and convex::NormBall< Meta, Child, Type >::r.

◆ is_equal_impl()

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

equality comparison

Parameters
convexset
Returns
T/F

Definition at line 85 of file norm_ball.hpp.

References convex::NormBall< Meta, Child, Type >::c, convex::dom_size_v, and convex::NormBall< Meta, Child, Type >::r.

◆ is_well_formed()

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

is_well_formed checks to see if underlying set is a valid convex set

Returns
T/F

Definition at line 75 of file norm_ball.hpp.

References convex::NormBall< Meta, Child, Type >::r.

◆ transform_impl()

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

transform norm ball by affine map

Br(c) = ||x - c|| < r or B = {x | ||x - c|| < r} f(B) = {y = f(x) | x in B}... y = Ux + t -> U^{-1}(y - t) = x Br'(c) = ||U^{-1}(y - t) - c|| < r -> U^{-1}(y - (U c + t))

Above is a polyhedron represented in Ax <= b and Cx = d by projecting onto y-coordinates

Parameters
affinemap
Returns
transformed ball (ellipse for L2, polyhedron for L1/Linf)

Definition at line 106 of file norm_ball.hpp.

References convex::NormBall< Meta, Child, Type >::c, convex::Atom< Meta, Derived, Cs >::children, convex::dom_size_v, convex::L1, convex::L2, convex::Atom< Meta, Derived, Cs >::N, and convex::NormBall< Meta, Child, Type >::r.

Member Data Documentation

◆ c

◆ r


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