5#include "proxsuite-nlp/modelling/residuals/state-residual.hpp"
6#include "proxsuite-nlp/third-party/polymorphic_cxx14.hpp"
14template <
typename _Scalar>
struct LinearFunctionTpl : C2FunctionTpl<_Scalar> {
15 using Scalar = _Scalar;
18 using Base = C2FunctionTpl<Scalar>;
24 LinearFunctionTpl(
const ConstMatrixRef &A,
const ConstVectorRef &b)
25 : Base((
int)A.cols(), (
int)A.cols(), (
int)A.rows()), mat(A), b(b) {}
27 LinearFunctionTpl(
const ConstMatrixRef &A)
28 : LinearFunctionTpl(A, VectorXs::Zero(A.rows())) {}
30 VectorXs
operator()(
const ConstVectorRef &x)
const {
return mat * x + b; }
40template <
typename _Scalar>
41struct LinearFunctionDifferenceToPoint : ComposeFunctionTpl<_Scalar> {
42 using Scalar = _Scalar;
43 using Base = ComposeFunctionTpl<Scalar>;
48 LinearFunctionDifferenceToPoint(
const polymorphic<Manifold> &space,
49 const ConstVectorRef &target,
50 const ConstMatrixRef &A,
51 const ConstVectorRef &b)
55 PROXSUITE_NLP_DIM_CHECK(target, space->nx());
Base definitions for function classes.
#define PROXSUITE_NLP_DYNAMIC_TYPEDEFS(Scalar)
virtual void computeJacobian(const ConstVectorRef &x, MatrixRef Jout) const=0
VectorXs operator()(const ConstVectorRef &x) const
Evaluate the residual at a given point x.
void computeJacobian(const ConstVectorRef &, MatrixRef Jout) const
Jacobian matrix of the constraint function.