8#ifndef PROXSUITE_HELPERS_COMMON_HPP
9#define PROXSUITE_HELPERS_COMMON_HPP
11#include "proxsuite/config.hpp"
17template<
typename Scalar>
23 return sqrt(std::numeric_limits<Scalar>::max());
27#define PROXSUITE_DEDUCE_RET(...) \
28 noexcept(noexcept(__VA_ARGS__)) \
29 ->typename std::remove_const<decltype(__VA_ARGS__)>::type \
33 static_assert(true, ".")
36template<
typename T,
typename Scalar>
39 (expr.array() < value).select(expr, T::Constant(expr.rows(), value)));
42template<
typename T,
typename Scalar>
45 (expr.array() > value).select(expr, T::Constant(expr.rows(), value)));
61template<
typename Condition,
typename T,
typename Scalar>
63select(Condition
const& condition, T
const& expr,
const Scalar value)
65 T::Constant(expr.rows(), value)));
#define PROXSUITE_DEDUCE_RET(...)
auto select(Condition const &condition, T const &expr, const Scalar value) PROXSUITE_DEDUCE_RET((condition).select(expr
Select the components of the expression if the condition is fullfiled. Otherwise, set the component t...
auto positive_part(T const &expr) PROXSUITE_DEDUCE_RET((expr.array() > 0).select(expr
Returns the positive part of an expression.
auto at_least(T const &expr, const Scalar value) PROXSUITE_DEDUCE_RET((expr.array() > value).select(expr
Returns the part of the expression which is greater than value.
auto at_most(T const &expr, const Scalar value) PROXSUITE_DEDUCE_RET((expr.array()< value).select(expr
Returns the part of the expression which is lower than value.
auto negative_part(T const &expr) PROXSUITE_DEDUCE_RET((expr.array()< 0).select(expr
Returns the negative part of an expression.