proxsuite-nlp  0.10.0
A primal-dual augmented Lagrangian-type solver for nonlinear programming on manifolds.
Loading...
Searching...
No Matches
function.hpp
Go to the documentation of this file.
2
4
5namespace proxsuite {
6namespace nlp {
7namespace python {
8
9struct FunctionWrap : context::Function, bp::wrapper<context::Function> {
10public:
12
14
15 VectorXs operator()(const ConstVectorRef &x) const {
16 bp::override f = get_override("__call__");
17 return f(x);
18 }
19};
20
21struct C1FunctionWrap : context::C1Function, bp::wrapper<context::C1Function> {
23
25
26 VectorXs operator()(const ConstVectorRef &x) const {
27 bp::override f = get_override("__call__");
28 return f(x);
29 }
30
31 void computeJacobian(const ConstVectorRef &x, MatrixRef Jout) const {
32 Jout.resize(this->nr(), this->ndx());
33 get_override("computeJacobian")(x, Jout);
34 }
35};
36
37struct C2FunctionWrap : context::C2Function, bp::wrapper<context::C2Function> {
39
41
42 VectorXs operator()(const ConstVectorRef &x) const {
43 bp::override f = get_override("__call__");
44 return f(x);
45 }
46
47 void computeJacobian(const ConstVectorRef &x, MatrixRef Jout) const {
48 Jout.resize(this->nr(), this->ndx());
49 get_override("computeJacobian")(x, Jout);
50 }
51
52 void vectorHessianProduct(const ConstVectorRef &x, const ConstVectorRef &v,
53 MatrixRef Hout) const {
54 Hout.resize(this->ndx(), this->ndx());
55 if (bp::override f = this->get_override("vectorHessianProduct")) {
56 f(x, v, Hout);
57 } else {
59 }
60 }
61
62 MatrixXs getVHP(const ConstVectorRef &x, const ConstVectorRef &v) const {
63 using context::MatrixXs;
64 MatrixXs Hout(this->ndx_, this->ndx_);
65 this->vectorHessianProduct(x, v, Hout);
66 return Hout;
67 }
68
69 void default_vhp(const ConstVectorRef &x, const ConstVectorRef &v,
70 MatrixRef Hout) const {
72 }
73};
74
75} // namespace python
76} // namespace nlp
77} // namespace proxsuite
Base definitions for function classes.
#define PROXSUITE_NLP_DYNAMIC_TYPEDEFS(Scalar)
Definition math.hpp:26
Main package namespace.
Definition bcl-params.hpp:5
Base function type.
Definition fwd.hpp:70
BaseFunctionTpl(const int nx, const int ndx, const int nr)
Differentiable function, with method for the Jacobian.
Definition fwd.hpp:73
C1FunctionTpl(const int nx, const int ndx, const int nr)
Twice-differentiable function, with method Jacobian and vector-hessian product evaluation.
Definition fwd.hpp:76
C2FunctionTpl(const int nx, const int ndx, const int nr)
virtual void vectorHessianProduct(const ConstVectorRef &, const ConstVectorRef &, MatrixRef Hout) const
Vector-hessian product.
VectorXs operator()(const ConstVectorRef &x) const
Evaluate the residual at a given point x.
Definition function.hpp:26
void computeJacobian(const ConstVectorRef &x, MatrixRef Jout) const
Jacobian matrix of the constraint function.
Definition function.hpp:31
void default_vhp(const ConstVectorRef &x, const ConstVectorRef &v, MatrixRef Hout) const
Definition function.hpp:69
void computeJacobian(const ConstVectorRef &x, MatrixRef Jout) const
Jacobian matrix of the constraint function.
Definition function.hpp:47
void vectorHessianProduct(const ConstVectorRef &x, const ConstVectorRef &v, MatrixRef Hout) const
Vector-hessian product.
Definition function.hpp:52
VectorXs operator()(const ConstVectorRef &x) const
Evaluate the residual at a given point x.
Definition function.hpp:42
MatrixXs getVHP(const ConstVectorRef &x, const ConstVectorRef &v) const
Definition function.hpp:62
VectorXs operator()(const ConstVectorRef &x) const
Evaluate the residual at a given point x.
Definition function.hpp:15