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

CRTP base for convex atoms. More...

#include <atom.hpp>

Inheritance diagram for convex::Atom< Meta, Derived, Cs >:
[legend]

Public Types

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 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

ChildrenT children
 Tuple of normalized child atoms.
 

Static Public Attributes

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 Derived, typename... Cs>
struct convex::Atom< Meta, Derived, Cs >

CRTP base for convex atoms.

The base stores normalized child atoms and enforces domain, codomain, curvature, and DCP composition rules shared by functions, sets, intersections, and sums.

Definition at line 22 of file atom.hpp.

Member Typedef Documentation

◆ ChildrenT

template<typename Meta , typename Derived , typename... Cs>
using convex::Atom< Meta, Derived, Cs >::ChildrenT = std::tuple<atom_decay_t<Cs>...>

Tuple of decayed child atom types.

Definition at line 28 of file atom.hpp.

◆ Codomain

template<typename Meta , typename Derived , typename... Cs>
using convex::Atom< Meta, Derived, Cs >::Codomain = meta_codom_t<Meta>

Atom output codomain.

Definition at line 26 of file atom.hpp.

◆ Domain

template<typename Meta , typename Derived , typename... Cs>
using convex::Atom< Meta, Derived, Cs >::Domain = meta_dom_t<Meta>

Atom input domain.

Definition at line 24 of file atom.hpp.

◆ PointT

template<typename Meta , typename Derived , typename... Cs>
using convex::Atom< Meta, Derived, Cs >::PointT = dom_point_t<Domain>

Point type accepted by the atom domain.

Definition at line 32 of file atom.hpp.

◆ T

template<typename Meta , typename Derived , typename... Cs>
using convex::Atom< Meta, Derived, Cs >::T = dom_type_t<Domain>

Scalar field for the atom domain.

Definition at line 30 of file atom.hpp.

Constructor & Destructor Documentation

◆ Atom() [1/2]

template<typename Meta , typename Derived , typename... Cs>
constexpr convex::Atom< Meta, Derived, Cs >::Atom ( )
inlineexplicitconstexpr

Construct a leaf atom with no children.

Definition at line 48 of file atom.hpp.

References convex::Atom< Meta, Derived, Cs >::validate_domain().

◆ Atom() [2/2]

template<typename Meta , typename Derived , typename... Cs>
constexpr convex::Atom< Meta, Derived, Cs >::Atom ( ChildrenT  child_in)
inlineexplicitconstexpr

Construct an atom with normalized children.

Parameters
child_intuple of child atoms

Definition at line 55 of file atom.hpp.

References convex::Atom< Meta, Derived, Cs >::validate_domain().

Member Function Documentation

◆ canonicalize()

template<typename Meta , typename Derived , typename... Cs>
template<AtomType Type, conic::BuilderLike Builder>
constexpr auto convex::Atom< Meta, Derived, Cs >::canonicalize ( const Builder &  builder) const
inlineconstexpr

Dispatch canonicalization to the derived atom.

Template Parameters
Typerequested atom canonicalization target
Buildercanonical-form builder type
Parameters
buildercurrent canonical-form builder
Returns
derived atom canonicalization result

Definition at line 227 of file atom.hpp.

References convex::dom_size_v, and convex::Atom< Meta, Derived, Cs >::self().

◆ self()

template<typename Meta , typename Derived , typename... Cs>
constexpr const Derived & convex::Atom< Meta, Derived, Cs >::self ( ) const
inlineconstexpr

Return this object as the CRTP-derived atom type.

Returns
derived object

Definition at line 236 of file atom.hpp.

References convex::dom_size_v.

Referenced by convex::Atom< Meta, Derived, Cs >::canonicalize(), convex::Atom< Meta, Derived, Cs >::validate_domain(), and convex::Atom< Meta, Derived, Cs >::validate_fn_domain().

◆ validate_domain()

◆ validate_fn_domain()

template<typename Meta , typename Derived , typename... Cs>
constexpr void convex::Atom< Meta, Derived, Cs >::validate_fn_domain ( const auto &  child) const
inlineconstexpr

Validate DCP composition for a function child.

Parameters
childchild atom whose codomain feeds this function's domain
Returns
void

Definition at line 66 of file atom.hpp.

References convex::AFFINE, convex::CONCAVE, convex::CONVEX, convex::dom_size_v, convex::meta_curv_v, convex::NONDEC, convex::NONINC, convex::Atom< Meta, Derived, Cs >::self(), and convex::UNKNOWN.

Referenced by convex::Atom< Meta, Derived, Cs >::validate_domain().

Member Data Documentation

◆ children

◆ CodomSign

template<typename Meta , typename Derived , typename... Cs>
constexpr VarType convex::Atom< Meta, Derived, Cs >::CodomSign = dom_vartype_v<Codomain>
staticconstexpr

Codomain sign declared by atom metadata.

Definition at line 43 of file atom.hpp.

◆ Curvature

template<typename Meta , typename Derived , typename... Cs>
constexpr CurvatureType convex::Atom< Meta, Derived, Cs >::Curvature = meta_curv_v<Meta>
staticconstexpr

Curvature declared by atom metadata.

Definition at line 39 of file atom.hpp.

◆ DomSign

template<typename Meta , typename Derived , typename... Cs>
constexpr VarType convex::Atom< Meta, Derived, Cs >::DomSign = dom_vartype_v<Domain>
staticconstexpr

Domain sign declared by atom metadata.

Definition at line 41 of file atom.hpp.

◆ M

template<typename Meta , typename Derived , typename... Cs>
constexpr std::size_t convex::Atom< Meta, Derived, Cs >::M = dom_size_v<Codomain>
staticconstexpr

◆ N


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