proxsuite-nlp  0.10.0
A primal-dual augmented Lagrangian-type solver for nonlinear programming on manifolds.
Loading...
Searching...
No Matches
exceptions.hpp
Go to the documentation of this file.
1
3#pragma once
4
5#include <stdexcept>
6#include <fmt/format.h>
7
8#define PROXSUITE_NLP_RUNTIME_ERROR(msg) \
9 throw ::proxsuite::nlp::RuntimeError( \
10 fmt::format("{}({}): {}", __FILE__, __LINE__, msg))
11
12#define PROXSUITE_NLP_DIM_CHECK(x, nx) \
13 if (x.size() != nx) \
14 PROXSUITE_NLP_RUNTIME_ERROR(fmt::format( \
15 "Input size invalid (expected {:d}, got {:d})", nx, x.size()))
16
17#define PROXSUITE_NLP_RAISE_IF_NAN(value) \
18 if (::proxsuite::nlp::math::check_value(value)) \
19 PROXSUITE_NLP_RUNTIME_ERROR("Encountered NaN.\n")
20
21#define PROXSUITE_NLP_RAISE_IF_NAN_NAME(value, name) \
22 if (::proxsuite::nlp::math::check_value(value)) \
23 PROXSUITE_NLP_RUNTIME_ERROR( \
24 fmt::format("Encountered NaN for value {:s}.\n", name))
25
26namespace proxsuite {
27namespace nlp {
28
29class RuntimeError : public std::runtime_error {
30public:
31 explicit RuntimeError(const std::string &what = "")
32 : std::runtime_error(what) {}
33};
34
35} // namespace nlp
36} // namespace proxsuite
RuntimeError(const std::string &what="")
Main package namespace.
Definition bcl-params.hpp:5