MCPcopy Create free account
hub / github.com/PatWie/CppNumericalSolvers / FunctionInterface

Class FunctionInterface

include/cppoptlib/function_base.h:52–65  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

50template <class TScalar, DifferentiabilityMode Mode,
51 int TDimension = Eigen::Dynamic>
52struct FunctionInterface {
53 static constexpr int Dimension = TDimension;
54 using ScalarType = TScalar;
55 using VectorType = Eigen::Matrix<TScalar, Dimension, 1>;
56 using MatrixType = Eigen::Matrix<TScalar, Dimension, Dimension>;
57 static constexpr DifferentiabilityMode Differentiability = Mode;
58
59 // Unified signature: even if some derivatives are not computed.
60 virtual ScalarType operator()(const VectorType& x, VectorType* grad = nullptr,
61 MatrixType* hess = nullptr) const = 0;
62 virtual std::unique_ptr<FunctionInterface<TScalar, Mode, Dimension>> clone()
63 const = 0;
64 virtual ~FunctionInterface() = default;
65};
66
67//-----------------------------------------------------------------
68// CRTP mixin that supplies the full interface from a simplified operator()().

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected