21template <
typename _Scalar>
44 const ConstVectorRef &slope,
50 VectorXs::Zero(residual->
nr()), constant) {}
54 template <
typename Underlying,
typename... ResidualArgs>
56 const ConstVectorRef &slope,
const Scalar constant,
57 ResidualArgs &...args)
78#include "proxsuite-nlp/modelling/costs/quadratic-residual.hxx"
80#ifdef PROXSUITE_NLP_ENABLE_TEMPLATE_INSTANTIATION
81#include "proxsuite-nlp/modelling/costs/quadratic-residual.txx"
Base definitions for function classes.
#define PROXSUITE_NLP_DYNAMIC_TYPEDEFS(Scalar)
Twice-differentiable function, with method Jacobian and vector-hessian product evaluation.
Base class for differentiable cost functions.
virtual void computeHessian(const ConstVectorRef &x, MatrixRef out) const =0
virtual void computeGradient(const ConstVectorRef &x, VectorRef out) const =0
Quadratic function of a residual.
QuadraticResidualCostTpl(const ConstMatrixRef &weights, const ConstVectorRef &slope, const Scalar constant, ResidualArgs &...args)
Constructor using the template parameter as the underlying type of the residual.
void computeGradient(const ConstVectorRef &x, VectorRef out) const
Scalar constant_
Constant term .
Scalar call(const ConstVectorRef &x) const
Evaluate the cost function.
shared_ptr< FunctionType > FunctionPtr
QuadraticResidualCostTpl(FunctionPtr residual, const ConstMatrixRef &weights, const Scalar constant=Scalar(0.))
void computeHessian(const ConstVectorRef &x, MatrixRef out) const
QuadraticResidualCostTpl(FunctionPtr residual, const ConstMatrixRef &weights, const ConstVectorRef &slope, const Scalar constant=Scalar(0.))
FunctionPtr residual_
Residual function the composite cost is constructed over.
MatrixXs weights_
Weights .
Eigen::Matrix< Scalar, -1, -1, Eigen::RowMajor > RowMatrixXs