30 for (
unsigned int i = 0; i < par.
Vec().
size(); i++) {
34 v(i) = dd * grad[ext];
40 MnPrint print(
"AnalyticalGradientCalculator");
41 print.
Debug(
"User given gradient in Minuit2",
v);
49 if (!this->
G2(par, g2)) {
50 print.
Error(
"Error computing G2");
82 assert(hmat.
size() ==
n *(
n+1)/2);
85 if (extHessian.empty()) {
86 MnPrint print(
"AnalyticalGradientCalculator::Hessian");
87 print.
Info(
"FCN cannot compute Hessian matrix");
90 unsigned int next = sqrt(extHessian.size());
92 for (
unsigned int i = 0; i <
n; i++) {
98 for (
unsigned int j = i; j <
n; j++) {
104 hmat(i, j) = dxdi * extHessian[i*next+ j] * dxdj;
113 assert(g2.
size() ==
n );
116 MnPrint print(
"AnalyticalGradientCalculator::G2");
117 print.
Info(
"FCN cannot compute the 2nd derivatives vector (G2)");
122 for (
unsigned int i = 0; i <
n; i++) {
126 g2(i) = dxdi * dxdi * extG2[iext];
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
virtual bool CanComputeG2() const
bool G2(const MinimumParameters &, MnAlgebraicVector &) const override
compute second derivatives (diagonal of Hessian)
virtual bool CanComputeHessian() const
const MnUserTransformation & fTransformation
FunctionGradient operator()(const MinimumParameters &) const override
const FCNGradientBase & fGradFunc
virtual bool CheckGradient() const
bool Hessian(const MinimumParameters &, MnAlgebraicSymMatrix &) const override
compute Hessian matrix
virtual std::vector< double > G2(const std::vector< double > &) const
return second derivatives (diagonal of the Hessian matrix)
virtual std::vector< double > Gradient(const std::vector< double > &) const =0
virtual std::vector< double > Hessian(const std::vector< double > &) const
return Hessian
virtual bool HasHessian() const
virtual bool CheckGradient() const
virtual bool HasG2() const
Class describing a symmetric matrix of size n.
unsigned int size() const
unsigned int size() const
const MnAlgebraicVector & Vec() const
void Debug(const Ts &... args)
void Error(const Ts &... args)
void Info(const Ts &... args)
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...