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

variable atom More...

#include <variable.hpp>

Inheritance diagram for convex::Variable< Meta >:
[legend]

Public Types

using BaseT = Atom< Meta, Variable< Meta > >
 extract aliases from types above useful for this class
 
using LinearMatT = linalg::Matrix< T, N, N >
 
using TransT = linalg::Vector< T, N >
 
using ScalarDom = ConvexDomain< linalg::RowVector< T, 1 >, DomSign >
 
using ScalarMeta = ConvexAtomMeta< ScalarDom, ScalarDom, CurvatureType::AFFINE >
 
using ScalarViewT = ScalarView< ScalarMeta, Variable< Meta > >
 
- Public Types inherited from convex::Atom< Meta, Variable< Meta > >
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 Variable ()
 CTOR (default)
 
constexpr Variable (const affine::AffineMap< LinearMatT > &map_in)
 CTOR.
 
constexpr ScalarViewT operator() (std::size_t idx) const
 operator overload for index
 
constexpr auto mul (T alpha) const
 mul (scalar)
 
constexpr auto mul (const LinearMatT &alpha) const
 mul (scalar)
 
constexpr auto add (const TransT &beta) const
 add (scalar)
 
template<AtomType Type, conic::BuilderLike Builder>
constexpr auto canonicalize_impl (const Builder &builder) const
 canonicalize
 
constexpr auto split () const
 split
 
template<AtomType Type, conic::BuilderLike Builder>
constexpr auto add_var_block (const Builder &builder) const
 add_var_block
 
- Public Member Functions inherited from convex::Atom< Meta, Variable< Meta > >
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.
 
constexpr auto canonicalize (const Builder &builder) const
 Dispatch canonicalization to the derived atom.
 
constexpr const Variable< Meta > & self () const
 Return this object as the CRTP-derived atom type.
 

Public Attributes

affine::AffineMap< LinearMatT > map
 member vars
 
- Public Attributes inherited from convex::Atom< Meta, Variable< Meta > >
ChildrenT children
 Tuple of normalized child atoms.
 

Additional Inherited Members

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

Detailed Description

template<typename Meta>
struct convex::Variable< Meta >

variable atom

Holds the decision var in R^n

Definition at line 163 of file variable.hpp.

Member Typedef Documentation

◆ BaseT

template<typename Meta >
using convex::Variable< Meta >::BaseT = Atom<Meta, Variable<Meta> >

extract aliases from types above useful for this class

Definition at line 165 of file variable.hpp.

◆ LinearMatT

template<typename Meta >
using convex::Variable< Meta >::LinearMatT = linalg::Matrix<T, N, N>

Definition at line 171 of file variable.hpp.

◆ ScalarDom

template<typename Meta >
using convex::Variable< Meta >::ScalarDom = ConvexDomain<linalg::RowVector<T, 1>, DomSign>

Definition at line 174 of file variable.hpp.

◆ ScalarMeta

Definition at line 175 of file variable.hpp.

◆ ScalarViewT

template<typename Meta >
using convex::Variable< Meta >::ScalarViewT = ScalarView<ScalarMeta, Variable<Meta> >

Definition at line 177 of file variable.hpp.

◆ TransT

template<typename Meta >
using convex::Variable< Meta >::TransT = linalg::Vector<T, N>

Definition at line 172 of file variable.hpp.

Constructor & Destructor Documentation

◆ Variable() [1/2]

template<typename Meta >
constexpr convex::Variable< Meta >::Variable ( )
inlineexplicitconstexpr

◆ Variable() [2/2]

template<typename Meta >
constexpr convex::Variable< Meta >::Variable ( const affine::AffineMap< LinearMatT > &  map_in)
inlineexplicitconstexpr

CTOR.

Parameters
linearmap in

Definition at line 190 of file variable.hpp.

Member Function Documentation

◆ add()

template<typename Meta >
constexpr auto convex::Variable< Meta >::add ( const TransT &  beta) const
inlineconstexpr

add (scalar)

Parameters
beta(scalar)
Returns
new var (updated map)

Definition at line 241 of file variable.hpp.

References convex::dom_size_v, convex::Variable< Meta >::map, and convex::Variable< Meta >::Variable().

◆ add_var_block()

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

add_var_block

Instead of canonicalization adding the variable to the block it is treated specially by this function to manually add it to F

Parameters
builder(CanonicalFormBuilder)
Returns
new cone block builder

Definition at line 288 of file variable.hpp.

References convex::dom_size_v.

◆ canonicalize_impl()

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

canonicalize

Almost treated as a no-op as var will always be leaf node but need to pass its map and cone block

Parameters
builder(CanonicalFormBuilder)
Returns
cone block builder (new)

Definition at line 258 of file variable.hpp.

References convex::Variable< Meta >::map.

◆ mul() [1/2]

template<typename Meta >
constexpr auto convex::Variable< Meta >::mul ( const LinearMatT &  alpha) const
inlineconstexpr

mul (scalar)

Parameters
alpha(linear mat)
Returns
new var (updated map)

Definition at line 228 of file variable.hpp.

References convex::dom_size_v, convex::Variable< Meta >::map, and convex::Variable< Meta >::Variable().

◆ mul() [2/2]

template<typename Meta >
constexpr auto convex::Variable< Meta >::mul ( T  alpha) const
inlineconstexpr

mul (scalar)

Parameters
alpha(scalar that scales var)
Returns
new var (updated map)

Definition at line 215 of file variable.hpp.

References convex::dom_size_v, convex::Variable< Meta >::map, and convex::Variable< Meta >::Variable().

◆ operator()()

template<typename Meta >
constexpr ScalarViewT convex::Variable< Meta >::operator() ( std::size_t  idx) const
inlineconstexpr

operator overload for index

Parameters
index
Returns
ScalarView of var at index

Definition at line 200 of file variable.hpp.

References convex::dom_size_v, convex::Variable< Meta >::map, and convex::Atom< Meta, Variable< Meta > >::N.

◆ split()

template<typename Meta >
constexpr auto convex::Variable< Meta >::split ( ) const
inlineconstexpr

split

x -> (x(0), x(1), ...) tuple

Returns
tuple(ScalarViews...)

Definition at line 270 of file variable.hpp.

References convex::dom_size_v.

Member Data Documentation

◆ map


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