proxsuite-nlp  0.10.0
A primal-dual augmented Lagrangian-type solver for nonlinear programming on manifolds.
Loading...
Searching...
No Matches
linear.hpp
Go to the documentation of this file.
1#pragma once
2
7
8namespace proxsuite {
9namespace nlp {
10
14template <typename _Scalar> struct LinearFunctionTpl : C2FunctionTpl<_Scalar> {
15 using Scalar = _Scalar;
17
20
21 MatrixXs mat;
22 VectorXs b;
23
24 LinearFunctionTpl(const ConstMatrixRef &A, const ConstVectorRef &b)
25 : Base((int)A.cols(), (int)A.cols(), (int)A.rows()), mat(A), b(b) {}
26
27 LinearFunctionTpl(const ConstMatrixRef &A)
28 : LinearFunctionTpl(A, VectorXs::Zero(A.rows())) {}
29
30 VectorXs operator()(const ConstVectorRef &x) const { return mat * x + b; }
31
32 void computeJacobian(const ConstVectorRef &, MatrixRef Jout) const {
33 Jout = mat;
34 }
35};
36
40template <typename _Scalar>
42 using Scalar = _Scalar;
45
47
49 const ConstVectorRef &target,
50 const ConstMatrixRef &A,
51 const ConstVectorRef &b)
52 : Base(std::make_shared<LinearFunctionTpl<Scalar>>(A, b),
53 std::make_shared<ManifoldDifferenceToPoint<Scalar>>(space,
54 target)) {
55 PROXSUITE_NLP_DIM_CHECK(target, space->nx());
56 }
57};
58
59} // namespace nlp
60} // namespace proxsuite
#define PROXSUITE_NLP_DIM_CHECK(x, nx)
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
Twice-differentiable function, with method Jacobian and vector-hessian product evaluation.
Definition fwd.hpp:76
Composition of two functions .
Definition fwd.hpp:82
Linear function of difference vector on a manifold, of the form .
Definition linear.hpp:41
LinearFunctionDifferenceToPoint(const polymorphic< Manifold > &space, const ConstVectorRef &target, const ConstMatrixRef &A, const ConstVectorRef &b)
Definition linear.hpp:48
VectorXs operator()(const ConstVectorRef &x) const
Evaluate the residual at a given point x.
Definition linear.hpp:30
void computeJacobian(const ConstVectorRef &, MatrixRef Jout) const
Jacobian matrix of the constraint function.
Definition linear.hpp:32
LinearFunctionTpl(const ConstMatrixRef &A, const ConstVectorRef &b)
Definition linear.hpp:24
LinearFunctionTpl(const ConstMatrixRef &A)
Definition linear.hpp:27