Logo ROOT  
Reference Guide
AnalyticalGradientCalculator.cxx
Go to the documentation of this file.
1// @(#)root/minuit2:$Id$
2// Authors: M. Winkler, F. James, L. Moneta, A. Zsenei 2003-2005
3
4/**********************************************************************
5 * *
6 * Copyright (c) 2005 LCG ROOT Math team, CERN/PH-SFT *
7 * *
8 **********************************************************************/
9
15#include "Minuit2/MnMatrix.h"
16#include "Minuit2/MnPrint.h"
17
18namespace ROOT {
19namespace Minuit2 {
20
22{
23 // evaluate analytical gradient. take care of parameter transformations
24
25 std::vector<double> grad = fGradCalc.Gradient(fTransformation(par.Vec()));
26 assert(grad.size() == fTransformation.Parameters().size());
27
28 MnAlgebraicVector v(par.Vec().size());
29 for (unsigned int i = 0; i < par.Vec().size(); i++) {
30 unsigned int ext = fTransformation.ExtOfInt(i);
32 // double dd = (fTransformation.Parameter(ext).Upper() -
33 // fTransformation.Parameter(ext).Lower())*0.5*cos(par.Vec()(i));
34 // const ParameterTransformation * pt = fTransformation.transformation(ext);
35 // double dd = pt->dInt2ext(par.Vec()(i), fTransformation.Parameter(ext).Lower(),
36 // fTransformation.Parameter(ext).Upper() );
37 double dd = fTransformation.DInt2Ext(i, par.Vec()(i));
38 v(i) = dd * grad[ext];
39 } else {
40 v(i) = grad[ext];
41 }
42 }
43
44 MnPrint print("AnalyticalGradientCalculator");
45 print.Debug("User given gradient in Minuit2", v);
46
47 return FunctionGradient(v);
48}
49
51{
52 // needed from base class
53 return (*this)(par);
54}
55
57{
58 // check to be sure FCN implements analytical gradient
59 return fGradCalc.CheckGradient();
60}
61
62} // namespace Minuit2
63
64} // namespace ROOT
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
virtual FunctionGradient operator()(const MinimumParameters &) const
virtual std::vector< double > Gradient(const std::vector< double > &) const =0
virtual bool CheckGradient() const
unsigned int size() const
Definition: LAVector.h:227
const MnAlgebraicVector & Vec() const
void Debug(const Ts &... args)
Definition: MnPrint.h:138
unsigned int ExtOfInt(unsigned int internal) const
double DInt2Ext(unsigned int, double) const
const std::vector< MinuitParameter > & Parameters() const
const MinuitParameter & Parameter(unsigned int) const
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...