Logo ROOT   6.18/05
Reference Guide
VavilovAccurateQuantile.cxx
Go to the documentation of this file.
1// @(#)root/mathmore:$Id$
2// Authors: B. List 29.4.2010
3
4
5 /**********************************************************************
6 * *
7 * Copyright (c) 2004 ROOT Foundation, CERN/PH-SFT *
8 * *
9 * This library is free software; you can redistribute it and/or *
10 * modify it under the terms of the GNU General Public License *
11 * as published by the Free Software Foundation; either version 2 *
12 * of the License, or (at your option) any later version. *
13 * *
14 * This library is distributed in the hope that it will be useful, *
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
17 * General Public License for more details. *
18 * *
19 * You should have received a copy of the GNU General Public License *
20 * along with this library (see file COPYING); if not, write *
21 * to the Free Software Foundation, Inc., 59 Temple Place, Suite *
22 * 330, Boston, MA 02111-1307 USA, or contact the author. *
23 * *
24 **********************************************************************/
25
26// Implementation file for class VavilovAccurateQuantile
27//
28// Created by: blist at Thu Apr 29 11:19:00 2010
29//
30// Last update: Thu Apr 29 11:19:00 2010
31//
32
35
36namespace ROOT {
37namespace Math {
38
39
41 fP[0] = 1;
42 fP[1] = 0;
43 fP[2] = 1;
44 fP[3] = 1;
45 fP[4] = 1;
46}
47
49 if (p)
50 for (int i = 0; i < 5; ++i)
51 fP[i] = p[i];
52 else {
53 fP[0] = 1;
54 fP[1] = 0;
55 fP[2] = 1;
56 fP[3] = 1;
57 fP[4] = 1;
58 }
59}
60
62{}
63
65 return fP;
66}
67
69 if (p)
70 for (int i = 0; i < 5; ++i)
71 fP[i] = p[i];
72}
73
74unsigned int VavilovAccurateQuantile::NPar() const {
75 return 5;
76}
77
78std::string VavilovAccurateQuantile::ParameterName(unsigned int i) const {
79 switch (i) {
80 case 0: return "Norm"; break;
81 case 1: return "x0"; break;
82 case 2: return "xi"; break;
83 case 3: return "kappa"; break;
84 case 4: return "beta2"; break;
85 }
86 return "???";
87}
88
89double VavilovAccurateQuantile::DoEval(double x) const {
90 VavilovAccurate v(fP[3], fP[4]);
91 return fP[1] + fP[2]*v.Quantile (x/fP[0]);
92}
93
94double VavilovAccurateQuantile::DoEvalPar(double x, const double * p) const {
95 if (!p) return 0;
96 // p[0]: norm, p[1]: x0, p[2]: width, p[3]: kappa, p[4]: beta2
97 VavilovAccurate v(p[3], p[4]);
98 return p[1]+p[2]*v.Quantile (x/p[0]);
99}
100
102 return new VavilovAccurateQuantile (*this);
103}
104
105
106} // namespace Math
107} // namespace ROOT
SVector< double, 2 > v
Definition: Dict.h:5
Interface (abstract class) for generic functions objects of one-dimension Provides a method to evalua...
Definition: IFunction.h:135
virtual unsigned int NPar() const
Return the number of Parameters.
virtual void SetParameters(const double *p)
Set the parameter values.
virtual const double * Parameters() const
Access the parameter values.
virtual double DoEval(double x) const
Evaluate the function.
virtual IBaseFunctionOneDim * Clone() const
Return a clone of the object.
virtual double DoEvalPar(double x, const double *p) const
Evaluate the function, using parameters p.
virtual std::string ParameterName(unsigned int i) const
Return the name of the i-th parameter (starting from zero)
Class describing a Vavilov distribution.
Double_t x[n]
Definition: legend1.C:17
Namespace for new Math classes and functions.
Namespace for new ROOT classes and functions.
Definition: StringConv.hxx:21