aligator  0.6.1
A primal-dual augmented Lagrangian-type solver for nonlinear trajectory optimization.
Loading...
Searching...
No Matches
expose-unary-functions.cpp
Go to the documentation of this file.
1
4
6
7namespace aligator {
8namespace python {
9using context::ConstMatrixRef;
10using context::ConstVectorRef;
14using internal::PyUnaryFunction;
15
18 using unary_eval_t = void (UnaryFunction::*)(const ConstVectorRef &,
19 StageFunctionData &) const;
20 using full_eval_t =
21 void (UnaryFunction::*)(const ConstVectorRef &, const ConstVectorRef &,
22 const ConstVectorRef &, StageFunctionData &)
23 const;
24 using unary_vhp_t =
25 void (UnaryFunction::*)(const ConstVectorRef &, const ConstVectorRef &,
26 StageFunctionData &) const;
27 using full_vhp_t = void (UnaryFunction::*)(
28 const ConstVectorRef &, const ConstVectorRef &, const ConstVectorRef &,
29 const ConstVectorRef &, StageFunctionData &) const;
30 bp::register_ptr_to_python<shared_ptr<UnaryFunction>>();
31 bp::class_<PyUnaryFunction<>, bp::bases<StageFunction>, boost::noncopyable>(
32 "UnaryFunction",
33 "Base class for unary functions of the form :math:`x \\mapsto f(x)`.",
34 bp::no_init)
35 .def(bp::init<const int, const int, const int, const int>(
36 ("self"_a, "ndx1", "nu", "ndx2", "nr")))
37 .def("evaluate", bp::pure_virtual<unary_eval_t>(&UnaryFunction::evaluate),
38 ("self"_a, "x", "data"))
39 .def<full_eval_t>("evaluate", &UnaryFunction::evaluate,
40 ("self"_a, "x", "u", "y", "data"))
41 .def("computeJacobians",
42 bp::pure_virtual<unary_eval_t>(&UnaryFunction::computeJacobians),
43 ("self"_a, "x", "data"))
44 .def<full_eval_t>("computeJacobians", &UnaryFunction::computeJacobians,
45 ("self"_a, "x", "u", "y", "data"))
46 .def<unary_vhp_t>(
47 "computeVectorHessianProducts",
48 &UnaryFunction::computeVectorHessianProducts,
49 &PyUnaryFunction<>::default_computeVectorHessianProducts,
50 ("self"_a, "x", "lbda", "data"))
51 .def<full_vhp_t>("computeVectorHessianProducts",
52 &UnaryFunction::computeVectorHessianProducts,
53 ("self"_a, "x", "u", "y", "lbda", "data"))
54 .def(SlicingVisitor<UnaryFunction>());
55}
56
57} // namespace python
58} // namespace aligator
StageFunctionTpl< Scalar > StageFunction
Definition context.hpp:17
UnaryFunctionTpl< Scalar > UnaryFunction
Definition context.hpp:18
StageFunctionDataTpl< Scalar > StageFunctionData
Definition context.hpp:19
void exposeUnaryFunctions()
Expose the UnaryFunction type and its member function overloads.
Main package namespace.