16template <linalg::RnSpace Space>
20template <linalg::RnSpace Space>
21 requires(linalg::space_dim_v<Space> == 1)
25template <linalg::RnSpace Space>
26 requires(linalg::space_dim_v<Space> == 1)
30template <linalg::RnSpace Dom, linalg::RnSpace Codom>
35template <linalg::RnSpace Dom, linalg::RnSpace Codom>
44template <
typename Meta,
typename Child>
45struct Max :
Atom<Meta, Max<Meta, Child>, Child> {
105 std::for_each(x.begin(), x.end(), [&
mx](
const auto&
pt) {
106 if (mx < pt) mx = pt;
110 const auto beta =
lift_map.translation()(0);
112 else return T(-1) *
alpha *
mx + beta;
121 constexpr auto mul()
const {
122 if constexpr (Scalar <
T(0)) {
123 const auto alpha =
T(-1) * Scalar;
136 affine::AffineMap<LiftedVarMat<T>>
new_map(
149 constexpr auto add(
T beta)
const {
175 template <AtomType Type, conic::BuilderLike Builder>
183 static constexpr std::size_t Dom = linalg::mat_cols_v<AffineMatT>;
184 static constexpr std::size_t Codom = linalg::mat_rows_v<AffineMatT>;
185 static_assert(Codom ==
N,
186 "Input affine map from cone block has invalid dom which is a "
187 "mismatch between domain in the convex function");
188 static_assert(Dom ==
N,
189 "Expecting child affine map to have square linear part");
190 linalg::Matrix<T, N, Dom + 1>
F;
191 F = linalg::set_block<0, N, 0, Dom>(
F,
T(-1) *
child_coord.linear_part());
193 linalg::Vector<T, N>
g;
194 for (std::size_t
i = 0;
i <
N; ++
i)
198 for (std::size_t
i = 0;
i <
N; ++
i)
F(
i,
N) =
T(1);
200 for (std::size_t
i = 0;
i <
N; ++
i)
F(
i,
N) =
T(-1);
205 const auto cones = std::make_tuple(
rplus);
217template <
typename Child>
220 linalg::Matrix<dom_type_t<meta_codom_t<atom_meta_t<Child>>>, 1, 1>>,
typename dom_traits< linalg::remove_cvref_t< Dom > >::Space dom_space_t
constexpr std::size_t dom_size_v
CurvatureType
Curvature annotation for atom codomain.
linalg::remove_cvref_t< T > atom_decay_t
normalize atom-facing types to a stable internal form.
MonotonicityType
Monotonicity annotation for function atoms.
linalg::Vector< T, 1 > LiftedVarBias
alias for lifted var map
linalg::RowVector< T, 1 > LiftedVarMat
alias for lifted var map
Atom-local canonical emission bundle.
forward decl for nonneg orthant cone
CRTP base for convex atoms.
ChildrenT children
Tuple of normalized child atoms.
dom_point_t< Domain > PointT
Point type accepted by the atom domain.
dom_type_t< Domain > T
Scalar field for the atom domain.
static constexpr std::size_t N
Domain dimension.
Domain wrapper with a static sign label.
forward declaration - max fn
dom_space_t< meta_dom_t< Meta > > Space
alias to extract space type
constexpr Max(const Child &child_in, const affine::AffineMap< LiftedVarMat< T > > &map_in)
CTOR.
constexpr T eval(const PointT &x) const
eval impl
constexpr auto mul() const
mul
static constexpr CurvatureType Tag
curvature tag
constexpr auto canonicalize_impl(const Builder &builder) const
canonicalize_impl
constexpr Max(const Child &child_in)
CTOR.
constexpr auto add(T beta) const
add
constexpr T operator()(const PointT &x) const
eval via operator overload
affine::AffineMap< LiftedVarMat< T > > lift_map
member vars
constexpr MonotonicityType monotonicity() const
mono