proxsuite-nlp  0.10.0
A primal-dual augmented Lagrangian-type solver for nonlinear programming on manifolds.
Loading...
Searching...
No Matches
tangent-bundle.hpp
Go to the documentation of this file.
1#pragma once
2
4
5namespace proxsuite {
6namespace nlp {
7
11template <class Base>
12struct TangentBundleTpl : public ManifoldAbstractTpl<typename Base::Scalar> {
13protected:
14 Base base_;
15
16public:
18 using Scalar = typename Base::Scalar;
19 static constexpr int Options = Base::Options;
21
23 TangentBundleTpl(Base base) : base_(base) {};
25 template <typename... BaseCtorArgs>
26 TangentBundleTpl(BaseCtorArgs... args) : base_(Base(args...)) {}
27
29
30 inline int nx() const { return base_.nx() + base_.ndx(); }
31 inline int ndx() const { return 2 * base_.ndx(); }
32
33 VectorXs neutral() const;
34 VectorXs rand() const;
35 bool isNormalized(const ConstVectorRef &x) const {
36 auto p = getBasePoint(x);
37 return base_.isNormalized(p);
38 }
39
40 const Base &getBaseSpace() const { return base_; }
41
43
44 void integrate_impl(const ConstVectorRef &x, const ConstVectorRef &dx,
45 VectorRef out) const;
46
47 void difference_impl(const ConstVectorRef &x0, const ConstVectorRef &x1,
48 VectorRef out) const;
49
50 void Jintegrate_impl(const ConstVectorRef &x, const ConstVectorRef &v,
51 MatrixRef Jout, int arg) const;
52
53 void JintegrateTransport(const ConstVectorRef &x, const ConstVectorRef &v,
54 MatrixRef Jout, int arg) const;
55
56 void Jdifference_impl(const ConstVectorRef &x0, const ConstVectorRef &x1,
57 MatrixRef Jout, int arg) const;
58
59 void interpolate_impl(const ConstVectorRef &x0, const ConstVectorRef &x1,
60 const Scalar &u, VectorRef out) const;
61
64 template <typename Point>
65 typename Point::ConstSegmentReturnType getBasePoint(const Point &x) const {
66 return x.head(base_.nx());
67 }
68
69 template <typename Point>
70 typename Point::SegmentReturnType getBasePointWrite(const Point &x) const {
71 return PROXSUITE_NLP_EIGEN_CONST_CAST(Point, x).head(base_.nx());
72 }
73
74 template <typename Tangent>
75 typename Tangent::ConstSegmentReturnType
76 getBaseTangent(const Tangent &v) const {
77 return v.head(base_.ndx());
78 }
79
80 template <typename Tangent>
81 typename Tangent::SegmentReturnType
82 getTangentHeadWrite(const Tangent &v) const {
83 return PROXSUITE_NLP_EIGEN_CONST_CAST(Tangent, v).head(base_.ndx());
84 }
85
86 template <typename Jac>
87 Eigen::Block<Jac, Eigen::Dynamic, Eigen::Dynamic>
88 getBaseJacobian(const Jac &J) const {
89 return PROXSUITE_NLP_EIGEN_CONST_CAST(Jac, J).topLeftCorner(base_.ndx(),
90 base_.ndx());
91 }
92};
93
94} // namespace nlp
95} // namespace proxsuite
96
97#include "proxsuite-nlp/modelling/spaces/tangent-bundle.hxx"
#define PROXSUITE_NLP_EIGEN_CONST_CAST(type, obj)
Definition macros.hpp:10
#define PROXSUITE_NLP_DYNAMIC_TYPEDEFS(Scalar)
Definition math.hpp:26
Main package namespace.
Definition bcl-params.hpp:5
Tangent bundle of a base manifold M.
TangentBundleTpl(Base base)
Constructor using base space instance.
Point::ConstSegmentReturnType getBasePoint(const Point &x) const
void Jdifference_impl(const ConstVectorRef &x0, const ConstVectorRef &x1, MatrixRef Jout, int arg) const
void difference_impl(const ConstVectorRef &x0, const ConstVectorRef &x1, VectorRef out) const
Implementation of the manifold retraction operation.
void interpolate_impl(const ConstVectorRef &x0, const ConstVectorRef &x1, const Scalar &u, VectorRef out) const
Interpolation operation.
VectorXs neutral() const
Get the neutral element from the manifold (if this makes sense).
bool isNormalized(const ConstVectorRef &x) const
Check if the input vector x is a viable element of the manifold.
void Jintegrate_impl(const ConstVectorRef &x, const ConstVectorRef &v, MatrixRef Jout, int arg) const
Tangent::ConstSegmentReturnType getBaseTangent(const Tangent &v) const
Eigen::Block< Jac, Eigen::Dynamic, Eigen::Dynamic > getBaseJacobian(const Jac &J) const
Tangent::SegmentReturnType getTangentHeadWrite(const Tangent &v) const
VectorXs rand() const
Sample a random point on the manifold.
TangentBundleTpl(BaseCtorArgs... args)
Constructor using base space constructor.
void integrate_impl(const ConstVectorRef &x, const ConstVectorRef &dx, VectorRef out) const
Perform the manifold integration operation.
void JintegrateTransport(const ConstVectorRef &x, const ConstVectorRef &v, MatrixRef Jout, int arg) const
Perform the parallel transport operation.
int ndx() const
Get manifold tangent space dimension.
int nx() const
Declare implementations.
Point::SegmentReturnType getBasePointWrite(const Point &x) const