ROOT  6.06/09
Reference Guide
Quad4F.h
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 
11 
12 namespace ROOT {
13 
14  namespace Minuit2 {
15 
16 
17 class Quad4F : public FCNBase {
18 
19 public:
20 
21  Quad4F() {}
22 
23  ~Quad4F() {}
24 
25  double operator()(const std::vector<double>& par) const {
26 
27  double x = par[0];
28  double y = par[1];
29  double z = par[2];
30  double w = par[3];
31 
32  return ( (1./70.)*(21*x*x + 20*y*y + 19*z*z - 14*x*z - 20*y*z) + w*w );
33  }
34 
35  double Up() const {return 1.;}
36 
37 private:
38 
39 };
40 
41 // same function implementing the derivatives too
42 class Quad4FGrad : public FCNGradientBase {
43 
44 public:
45 
47 
49 
50  double operator()(const std::vector<double>& par) const {
51 
52  double x = par[0];
53  double y = par[1];
54  double z = par[2];
55  double w = par[3];
56 
57  return ( (1./70.)*(21*x*x + 20*y*y + 19*z*z - 14*x*z - 20*y*z) + w*w );
58  }
59 
60  std::vector<double> Gradient(const std::vector<double>& par) const {
61 
62  double x = par[0];
63  double y = par[1];
64  double z = par[2];
65  double w = par[3];
66 
67 
68  std::vector<double> g(4);
69  g[0] = (1./70.) * ( 42. * x - 14. * z );
70  g[1] = (1./70.) * ( 40. * y - 20. * z );
71  g[2] = (1./70.) * ( 38. * z - 14. * x - 20. * y );
72  g[3] = 2. * w;
73  return g;
74  }
75 
76  double Up() const {return 1.;}
77 
78 private:
79 
80 };
81 
82 
83  } // namespace Minuit2
84 
85 } // namespace ROOT
double par[1]
Definition: unuranDistr.cxx:38
std::vector< double > Gradient(const std::vector< double > &par) const
Definition: Quad4F.h:60
Namespace for new ROOT classes and functions.
Definition: ROOT.py:1
double operator()(const std::vector< double > &par) const
The meaning of the vector of parameters is of course defined by the user, who uses the values of thos...
Definition: Quad4F.h:25
Double_t x[n]
Definition: legend1.C:17
Extension of the FCNBase for providing the analytical Gradient of the function.
Interface (abstract class) defining the function to be minimized, which has to be implemented by the ...
Definition: FCNBase.h:47
double Up() const
Error definition of the function.
Definition: Quad4F.h:76
Double_t y[n]
Definition: legend1.C:17
double Up() const
Error definition of the function.
Definition: Quad4F.h:35
double operator()(const std::vector< double > &par) const
The meaning of the vector of parameters is of course defined by the user, who uses the values of thos...
Definition: Quad4F.h:50