6#include <proxsuite-nlp/math.hpp>
8#define ALIGATOR_DYNAMIC_TYPEDEFS(Scalar) PROXSUITE_NLP_DYNAMIC_TYPEDEFS(Scalar)
10#define ALIGATOR_DYNAMIC_TYPEDEFS_WITH_ROW_TYPES(Scalar) \
11 ALIGATOR_DYNAMIC_TYPEDEFS(Scalar); \
12 using RowMatrixXs = typename Eigen::Transpose<MatrixXs>::PlainObject; \
13 using RowMatrixRef = Eigen::Ref<RowMatrixXs>; \
14 using ConstRowMatrixRef = Eigen::Ref<const RowMatrixXs>
19using proxsuite::nlp::math_types;
27 const std::string &text) {
28 Eigen::IOFormat ft = EIGEN_DEFAULT_IO_FORMAT;
31 int i = int(text.length()) - 1;
33 if (text[
size_t(i)] !=
'\n')
37 return mat.derived().format(ft);
44using proxsuite::nlp::math::check_scalar;
45using proxsuite::nlp::math::check_value;
46using proxsuite::nlp::math::infty_norm;
47using proxsuite::nlp::math::scalar_close;
51template <
typename T>
bool check_value(
const std::vector<T> &xs) {
52 const std::size_t n = xs.size();
53 for (std::size_t i = 0; i < n; i++) {
54 if (check_value<T>(xs[i]))
60template <
typename T>
void setZero(std::vector<T> &mats) {
61 for (std::size_t i = 0; i < mats.size(); i++) {
67template <
typename A,
typename B,
typename OutType,
typename Scalar>
69 std::vector<OutType> &c,
const Scalar alpha) {
70 assert(a.size() == b.size());
71 assert(a.size() == c.size());
72 const std::size_t N = a.size();
73 for (std::size_t i = 0; i < N; i++) {
74 c[i] = a[i] + alpha * b[i];
void setZero(std::vector< T > &mats)
void vectorMultiplyAdd(const std::vector< A > &a, const std::vector< B > &b, std::vector< OutType > &c, const Scalar alpha)
Compute zi = xi + alpha * yi for all i.
bool check_value(const std::vector< T > &xs)
Check if a std::vector of numerical objects has invalid values.
auto eigenPrintWithPreamble(const Eigen::EigenBase< D > &mat, const std::string &text)