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

forward declaration - norm fn More...

#include <norm.hpp>

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

Public Types

using ConvexBase = Atom< Meta, Norm< Meta, Child, NormFunc >, Child >
 bring into scope the convex fn alias / helpers
 
- Public Types inherited from convex::Atom< Meta, Norm< Meta, Child, NormFunc >, Child >
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 Norm (const Child &child_in)
 CTOR.
 
constexpr Norm (const Child &child_in, const affine::AffineMap< LiftedVarMat< T > > &map_in)
 CTOR.
 
constexpr MonotonicityType monotonicity () const
 mono
 
constexpr T operator() (const PointT &x) const
 eval via operator overload
 
constexpr T eval (const PointT &x) const
 eval impl
 
template<T Scalar>
constexpr auto mul () const
 mul
 
constexpr auto add (T beta) const
 add
 
template<AtomType Type, conic::BuilderLike Builder>
constexpr auto canonicalize_impl (const Builder &builder) const
 canonicalize_impl
 
- Public Member Functions inherited from convex::Atom< Meta, Norm< Meta, Child, NormFunc >, Child >
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 Norm< Meta, Child, NormFunc > & self () const
 Return this object as the CRTP-derived atom type.
 

Public Attributes

affine::AffineMap< LiftedVarMat< T > > lift_map
 member vars
 
const int idx {-1}
 
- Public Attributes inherited from convex::Atom< Meta, Norm< Meta, Child, NormFunc >, Child >
ChildrenT children
 Tuple of normalized child atoms.
 

Static Public Attributes

static constexpr CurvatureType Tag = meta_curv_v<Meta>
 curvature tag
 
- Static Public Attributes inherited from convex::Atom< Meta, Norm< Meta, Child, NormFunc >, Child >
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, typename Child, linalg::NormFunction NormFunc>
requires (dom_size_v<meta_dom_t<Meta>> == linalg::norm_dim_v<NormFunc>)
struct convex::Norm< Meta, Child, NormFunc >

forward declaration - norm fn

norm convex function wrapper

Definition at line 42 of file norm.hpp.

Member Typedef Documentation

◆ ConvexBase

template<typename Meta , typename Child , linalg::NormFunction NormFunc>
using convex::Norm< Meta, Child, NormFunc >::ConvexBase = Atom<Meta, Norm<Meta, Child, NormFunc>, Child>

bring into scope the convex fn alias / helpers

Definition at line 44 of file norm.hpp.

Constructor & Destructor Documentation

◆ Norm() [1/2]

template<typename Meta , typename Child , linalg::NormFunction NormFunc>
constexpr convex::Norm< Meta, Child, NormFunc >::Norm ( const Child &  child_in)
inlineexplicitconstexpr

CTOR.

Parameters
child

Definition at line 57 of file norm.hpp.

◆ Norm() [2/2]

template<typename Meta , typename Child , linalg::NormFunction NormFunc>
constexpr convex::Norm< Meta, Child, NormFunc >::Norm ( const Child &  child_in,
const affine::AffineMap< LiftedVarMat< T > > &  map_in 
)
inlineexplicitconstexpr

CTOR.

Parameters
child
map

Definition at line 67 of file norm.hpp.

Member Function Documentation

◆ add()

template<typename Meta , typename Child , linalg::NormFunction NormFunc>
constexpr auto convex::Norm< Meta, Child, NormFunc >::add ( T  beta) const
inlineconstexpr

add

Parameters
scalar
Returns
abs fn (updated map)

Definition at line 159 of file norm.hpp.

References convex::dom_size_v.

◆ canonicalize_impl()

template<typename Meta , typename Child , linalg::NormFunction NormFunc>
template<AtomType Type, conic::BuilderLike Builder>
constexpr auto convex::Norm< Meta, Child, NormFunc >::canonicalize_impl ( const Builder &  builder) const
inlineconstexpr

canonicalize_impl

L2 Norm Function (1) f(x) = ||x||_2 K = { (x, t) | ||x||_2 <= t } K_soc = { (u, v) | ||u||_2 <= v, v >= 0 }

let u = x, v = t [ A 0 ] [ x; t ] + [ b; 0 ] -> (A x + b, t) [ 0 1 ]

(2) -f(x) = -||x||_2 K = { (x, t) | -||x||_2 >= t }... { (x, t) | ||x||_2 <= -t }

[ A 0 ] [ x; t ] + [ b; 0 ] -> (A x + b, -t) [ 0 -1 ]

Linf Norm Function (1) f(x) = ||x||_inf K = { (x, t) | ||x||_inf <= t }

-t <= x_i <= t... for all i 0 <= x_i + t... nonneg orthant cone(s) 0 <= t - x_i... nonneg orthant cone(s)

[ A 1 ] [ x; t ] + [ b; -b ] [ -A 1 ]

(2) -f(x) = -||x||_inf K = { (x, t) | -||x||_inf >= t }... { (x, t) | ||x||_inf <= -t }

[ A -1 ] [ x; t ] + [ b; -b ] [ -A -1 ]

L1 Norm Function (1) f(x) = ||x||_1 K = { (x, t) | ||x||_1 <= t }

let u_i >= |x_i|... convex constraint sum(u_i) <= t... convex constraint

-u_i <= y_i <= u_i 0 <= y_i + u_i... nonneg orthant cone 0 <= u_i - y_i... nonneg orthant cone 0 <= t - 1^T u... nonneg orthant cone

[ A I 0 ] [ x; u; t ] + [ b; -b; 0 ] [ -A I 0 ] [ 0 -1^T 1 ]

(2) -f(x) = -||x||_1 K = { (x, t) | -||x||_1 >= t }... { (x, t) | ||x||_1 <= -t }

[ A I 0 ] [ x; u; t ] + [ b; -b; 0 ] [ -A I 0 ] [ 0 -1^T -1 ] [ 0 I 0 ]

Parameters
conemap builder
coordmap
coneblock
Returns
cone block

Definition at line 231 of file norm.hpp.

References convex::CONCAVE, convex::CONVEX, and convex::dom_size_v.

◆ eval()

template<typename Meta , typename Child , linalg::NormFunction NormFunc>
constexpr T convex::Norm< Meta, Child, NormFunc >::eval ( const PointT &  x) const
inlineconstexpr

eval impl

Parameters
pointx in domain
Returns
y (scalar in R)

Definition at line 114 of file norm.hpp.

References convex::CONVEX, and convex::dom_size_v.

◆ monotonicity()

template<typename Meta , typename Child , linalg::NormFunction NormFunc>
constexpr MonotonicityType convex::Norm< Meta, Child, NormFunc >::monotonicity ( ) const
inlineconstexpr

mono

Returns
monotonicity

Definition at line 76 of file norm.hpp.

References convex::CONVEX, convex::dom_size_v, convex::NONDEC, convex::NONINC, convex::NONNEG, convex::NONPOS, and convex::UNKNOWN.

◆ mul()

template<typename Meta , typename Child , linalg::NormFunction NormFunc>
template<T Scalar>
constexpr auto convex::Norm< Meta, Child, NormFunc >::mul ( ) const
inlineconstexpr

mul

Returns
abs fn (updated map)

Definition at line 128 of file norm.hpp.

References convex::CONCAVE, and convex::dom_size_v.

◆ operator()()

template<typename Meta , typename Child , linalg::NormFunction NormFunc>
constexpr T convex::Norm< Meta, Child, NormFunc >::operator() ( const PointT &  x) const
inlineconstexpr

eval via operator overload

Parameters
pointx
Returns
result

Definition at line 105 of file norm.hpp.

Member Data Documentation

◆ idx

template<typename Meta , typename Child , linalg::NormFunction NormFunc>
const int convex::Norm< Meta, Child, NormFunc >::idx {-1}

Definition at line 329 of file norm.hpp.

◆ lift_map

template<typename Meta , typename Child , linalg::NormFunction NormFunc>
affine::AffineMap<LiftedVarMat<T> > convex::Norm< Meta, Child, NormFunc >::lift_map

member vars

Definition at line 328 of file norm.hpp.

◆ Tag

template<typename Meta , typename Child , linalg::NormFunction NormFunc>
constexpr CurvatureType convex::Norm< Meta, Child, NormFunc >::Tag = meta_curv_v<Meta>
staticconstexpr

curvature tag

Definition at line 50 of file norm.hpp.


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