proxsuite-nlp  0.11.0
A primal-dual augmented Lagrangian-type solver for nonlinear programming on manifolds.
 
Loading...
Searching...
No Matches
state-residual.hpp
1
5#pragma once
6
9#include "proxsuite-nlp/third-party/polymorphic_cxx14.hpp"
10
11namespace proxsuite {
12namespace nlp {
13
18template <typename _Scalar>
19struct ManifoldDifferenceToPoint : C2FunctionTpl<_Scalar> {
20public:
21 using Scalar = _Scalar;
23
24 using Base = C2FunctionTpl<Scalar>;
25 using Base::operator();
27 using Manifold = ManifoldAbstractTpl<Scalar>;
28
30 VectorXs target_;
31 polymorphic<Manifold> space_;
32
33 ManifoldDifferenceToPoint(const polymorphic<Manifold> &space,
34 const ConstVectorRef &target)
35 : Base(space->nx(), space->ndx(), space->ndx()), target_(target),
36 space_(space) {
37 if (!space->isNormalized(target_)) {
38 PROXSUITE_NLP_RUNTIME_ERROR(
39 "Target parameter is not a valid element of the manifold.");
40 }
41 }
42
43 VectorXs operator()(const ConstVectorRef &x) const {
44 return space_->difference(target_, x);
45 }
46
47 void computeJacobian(const ConstVectorRef &x, MatrixRef Jout) const {
48 space_->Jdifference(target_, x, Jout, 1);
49 }
50};
51
52} // namespace nlp
53} // 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
virtual void computeJacobian(const ConstVectorRef &x, MatrixRef Jout) const=0
void computeJacobian(const ConstVectorRef &x, MatrixRef Jout) const
Jacobian matrix of the constraint function.
VectorXs operator()(const ConstVectorRef &x) const
Evaluate the residual at a given point x.