128 constexpr auto mul()
const {
129 if constexpr (Scalar <
T(0)) {
130 const auto alpha =
T(-1) * Scalar;
131 affine::AffineMap<LiftedVarMat<T>>
new_map(
alpha * lift_map.linear_part(),
132 lift_map.translation());
140 std::get<0>(this->children),
new_map);
143 std::get<0>(this->children),
new_map);
146 affine::AffineMap<LiftedVarMat<T>>
new_map(
147 Scalar * lift_map.linear_part(), lift_map.translation());
232 using Vec = linalg::Vector<T, N>;
234 std::get<0>(this->children)
239 static constexpr std::size_t Dom = linalg::mat_cols_v<AffineMatT>;
240 static constexpr std::size_t Codom = linalg::mat_rows_v<AffineMatT>;
241 static_assert(Codom == N,
242 "Input affine map from cone block has invalid dom which is a "
243 "mismatch between domain in the convex function");
244 static_assert(Dom == N,
245 "Expecting child affine map to have square linear part");
247 if constexpr (std::same_as<NormFunc, linalg::L2<Vec>>) {
248 linalg::Matrix<T, N + 1, Dom + 1>
F;
249 F = linalg::set_block<0, N, 0, Dom>(
F,
child_coord.linear_part());
251 linalg::Vector<T, N + 1>
g;
263 const auto cones = std::make_tuple(
soc);
268 }
else if constexpr (std::same_as<NormFunc, linalg::Linf<Vec>>) {
269 linalg::Matrix<T, 2 * N, Dom + 1>
F;
270 F = linalg::set_block<0, N, 0, N>(
F,
child_coord.linear_part());
271 F = linalg::set_block<N, 2 * N, 0, N>(
F,
274 linalg::Vector<T, 2 * N>
g;
276 for (std::size_t
i = 0;
i < N; ++
i)
280 for (std::size_t
i = 0;
i < 2 * N; ++
i)
F(
i, N) =
T(1);
282 for (std::size_t
i = 0;
i < 2 * N; ++
i)
F(
i, N) =
T(-1);
288 const auto cones = std::make_tuple(
rplus,
rplus);
294 linalg::Matrix<T, 3 * N + 1, 2 * Dom + 1>
F;
295 const auto I = linalg::make_identity<T, N>();
296 F = linalg::set_block<0, N, 0, N>(
F,
child_coord.linear_part());
297 F = linalg::set_block<N, 2 * N, 0, N>(
F,
299 F = linalg::set_block<0, N, N, 2 * N>(
F,
I);
300 F = linalg::set_block<N, 2 * N, N, 2 * N>(
F,
I);
301 for (std::size_t
i = 0;
i < N; ++
i)
F(2 * N, N +
i) =
T(-1);
302 F = linalg::set_block<2 * N + 1, 3 * N + 1, N, 2 * N>(
F,
I);
304 linalg::Vector<T, 3 * N + 1>
g;
306 for (std::size_t
i = 0;
i < N; ++
i)
310 F(2 * N, 2 * N) =
T(1);
312 F(2 * N, 2 * N) =
T(-1);