Skip to content

Commit df460b5

Browse files
committed
helpers: fix naming and values
1 parent 4c0a27a commit df460b5

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

include/proxsuite/helpers/common.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,14 @@ struct infinite_bound
3535
/// @brief \brief Returns the part of the expression which is lower than value
3636
template<typename T, typename Scalar>
3737
auto
38-
lower_than(T const& expr, const Scalar value) PROXSUITE_DEDUCE_RET(
39-
(expr.array() < value).select(expr, T::Zero(expr.rows())));
38+
at_most(T const& expr, const Scalar value) PROXSUITE_DEDUCE_RET(
39+
(expr.array() < value).select(expr, T::Constant(expr.rows(), value)));
4040

4141
/// @brief \brief Returns the part of the expression which is greater than value
4242
template<typename T, typename Scalar>
4343
auto
44-
greater_than(T const& expr, const Scalar value) PROXSUITE_DEDUCE_RET(
45-
(expr.array() > value).select(expr, T::Zero(expr.rows())));
44+
at_least(T const& expr, const Scalar value) PROXSUITE_DEDUCE_RET(
45+
(expr.array() > value).select(expr, T::Constant(expr.rows(), value)));
4646

4747
/// @brief \brief Returns the positive part of an expression
4848
template<typename T>

include/proxsuite/proxqp/dense/utils.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -398,13 +398,13 @@ global_dual_residual(Results<T>& qpresults,
398398

399399
const T zu =
400400
helpers::positive_part(qpresults.z)
401-
.dot(helpers::lower_than(qpmodel.u, helpers::infinite_bound<T>::value()));
401+
.dot(helpers::at_most(qpmodel.u, helpers::infinite_bound<T>::value()));
402402
rhs_duality_gap = std::max(rhs_duality_gap, std::abs(zu));
403403
duality_gap += zu;
404404

405-
const T zl = helpers::negative_part(qpresults.z)
406-
.dot(helpers::greater_than(
407-
qpmodel.l, -helpers::infinite_bound<T>::value()));
405+
const T zl =
406+
helpers::negative_part(qpresults.z)
407+
.dot(helpers::at_least(qpmodel.l, -helpers::infinite_bound<T>::value()));
408408
rhs_duality_gap = std::max(rhs_duality_gap, std::abs(zl));
409409
duality_gap += zl;
410410

include/proxsuite/proxqp/sparse/utils.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -667,12 +667,12 @@ unscaled_primal_dual_residual(
667667
precond.unscale_dual_in_place_in({ proxsuite::proxqp::from_eigen, z_e });
668668

669669
const T zl = helpers::negative_part(z_e).dot(
670-
helpers::greater_than(data.l, -helpers::infinite_bound<T>::value()));
670+
helpers::at_least(data.l, -helpers::infinite_bound<T>::value()));
671671
results.info.duality_gap += zl;
672672
rhs_duality_gap = std::max(rhs_duality_gap, std::abs(zl));
673673

674674
const T zu = helpers::positive_part(z_e).dot(
675-
helpers::lower_than(data.u, helpers::infinite_bound<T>::value()));
675+
helpers::at_most(data.u, helpers::infinite_bound<T>::value()));
676676
results.info.duality_gap += zu;
677677
rhs_duality_gap = std::max(rhs_duality_gap, std::abs(zu));
678678

0 commit comments

Comments
 (0)