aligator
0.12.0
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
3
#include "
aligator/python/functions.hpp
"
4
5
#include "
aligator/modelling/function-xpr-slice.hpp
"
6
7
namespace
aligator
{
8
namespace
python
{
9
using
context::ConstMatrixRef;
10
using
context::ConstVectorRef;
11
using
context::StageFunction
;
12
using
context::StageFunctionData
;
13
using
context::UnaryFunction
;
14
using
PolyUnaryFunction
= xyz::polymorphic<UnaryFunction>;
15
17
void
exposeUnaryFunctions
() {
18
PolymorphicMultiBaseVisitor<UnaryFunction, StageFunction>
unary_visitor
;
19
proxsuite::nlp::python::register_polymorphic_to_python<PolyUnaryFunction>();
20
using
unary_eval_t = void (
UnaryFunction
::*)(
const
ConstVectorRef &,
21
StageFunctionData
&)
const
;
22
using
full_eval_t =
23
void (
UnaryFunction
::*)(
const
ConstVectorRef &,
const
ConstVectorRef &,
24
StageFunctionData
&)
const
;
25
using
unary_vhp_t =
26
void (
UnaryFunction
::*)(
const
ConstVectorRef &,
const
ConstVectorRef &,
27
StageFunctionData
&)
const
;
28
using
full_vhp_t =
29
void (
UnaryFunction
::*)(
const
ConstVectorRef &,
const
ConstVectorRef &,
30
const
ConstVectorRef &,
StageFunctionData
&)
31
const
;
32
bp::class_<PyUnaryFunction<>, bp::bases<StageFunction>, boost::noncopyable>(
33
"UnaryFunction"
,
34
"Base class for unary functions of the form :math:`x \\mapsto f(x)`."
,
35
bp::no_init)
36
.def(bp::init<const int, const int, const int>(
37
(
"self"
_a,
"ndx1"
,
"nu"
,
"nr"
)))
38
.def(
"evaluate"
, bp::pure_virtual<unary_eval_t>(&
UnaryFunction::evaluate
),
39
(
"self"
_a,
"x"
,
"data"
))
40
.def<full_eval_t>(
"evaluate"
, &
UnaryFunction::evaluate
,
41
(
"self"
_a,
"x"
,
"u"
,
"data"
))
42
.def(
"computeJacobians"
,
43
bp::pure_virtual<unary_eval_t>(&
UnaryFunction::computeJacobians
),
44
(
"self"
_a,
"x"
,
"data"
))
45
.def<full_eval_t>(
"computeJacobians"
, &
UnaryFunction::computeJacobians
,
46
(
"self"
_a,
"x"
,
"u"
,
"data"
))
47
.def<unary_vhp_t>(
48
"computeVectorHessianProducts"
,
49
&
UnaryFunction::computeVectorHessianProducts
,
50
&
PyUnaryFunction<>::default_computeVectorHessianProducts
,
51
(
"self"
_a,
"x"
,
"lbda"
,
"data"
))
52
.def<full_vhp_t>(
"computeVectorHessianProducts"
,
53
&
UnaryFunction::computeVectorHessianProducts
,
54
(
"self"
_a,
"x"
,
"u"
,
"lbda"
,
"data"
))
55
.def(
unary_visitor
)
56
.def(
SlicingVisitor<UnaryFunction>
())
57
.def(
CreateDataPolymorphicPythonVisitor
<
UnaryFunction
,
58
PyUnaryFunction<>
>());
59
}
60
61
}
// namespace python
62
}
// namespace aligator
function-xpr-slice.hpp
functions.hpp
aligator::context::StageFunction
StageFunctionTpl< Scalar > StageFunction
Definition
context.hpp:16
aligator::context::UnaryFunction
UnaryFunctionTpl< Scalar > UnaryFunction
Definition
context.hpp:17
aligator::context::StageFunctionData
StageFunctionDataTpl< Scalar > StageFunctionData
Definition
context.hpp:18
aligator::python
The Python bindings.
Definition
blk-matrix.hpp:5
aligator::python::PolyUnaryFunction
xyz::polymorphic< UnaryFunction > PolyUnaryFunction
Definition
expose-unary-functions.cpp:14
aligator::python::unary_visitor
const PolymorphicMultiBaseVisitor< UnaryFunction, StageFunction > unary_visitor
Definition
expose-function-ops.cpp:20
aligator::python::exposeUnaryFunctions
void exposeUnaryFunctions()
Expose the UnaryFunction type and its member function overloads.
Definition
expose-unary-functions.cpp:17
aligator
Main package namespace.
Definition
action-model-wrap.hpp:14
aligator::UnaryFunctionTpl< Scalar >::evaluate
virtual void evaluate(const ConstVectorRef &x, Data &data) const=0
aligator::UnaryFunctionTpl< Scalar >::computeJacobians
virtual void computeJacobians(const ConstVectorRef &x, Data &data) const=0
aligator::UnaryFunctionTpl< Scalar >::computeVectorHessianProducts
virtual void computeVectorHessianProducts(const ConstVectorRef &, const ConstVectorRef &, Data &) const
Definition
unary-function.hpp:22
aligator::python::CreateDataPolymorphicPythonVisitor
Definition
visitors.hpp:38
aligator::python::PolymorphicMultiBaseVisitor
Definition
polymorphic-convertible.hpp:17
aligator::python::PyUnaryFunction
Definition
functions.hpp:68
aligator::python::PyUnaryFunction::default_computeVectorHessianProducts
void default_computeVectorHessianProducts(const ConstVectorRef &x, const ConstVectorRef &lbda, Data &data) const
Definition
functions.hpp:95
aligator::python::SlicingVisitor
Definition
functions.hpp:111
bindings
python
src
expose-unary-functions.cpp
Generated by
1.13.2