CLHEP 2.4.6.4
C++ Class Library for High Energy Physics
Loading...
Searching...
No Matches
Erf.cc
Go to the documentation of this file.
1// -*- C++ -*-
2// $Id: Erf.cc,v 1.6 2010/06/16 18:22:01 garren Exp $
3
4#include <cmath>
5
6#include "CLHEP/GenericFunctions/Erf.hh"
7#include "CLHEP/GenericFunctions/Gaussian.hh"
8#include <assert.h>
9namespace Genfun {
11
13{
14 _incompleteGamma.a().setValue(0.5);
15}
16
17Erf::Erf(const Erf & right):
18 AbsFunction(right), _incompleteGamma(right._incompleteGamma)
19{
20}
21
23}
24
25double Erf::operator() (double x) const {
26 return x<0 ? -_incompleteGamma(x*x): _incompleteGamma(x*x);
27}
28
29// don't generate warnings about unused parameter inside assert
30#if defined __GNUC__
31 #if __GNUC__ > 3 && __GNUC_MINOR__ > 6
32 #pragma GCC diagnostic push
33 #pragma GCC diagnostic ignored "-Wunused-parameter"
34 #endif
35#endif
36#ifdef __clang__
37 #pragma clang diagnostic push
38 #pragma clang diagnostic ignored "-Wunused-parameter"
39#endif
40Derivative Erf::partial(unsigned int index) const {
41 assert(index==0);
42 Gaussian gauss = Gaussian();
43 gauss.sigma().setValue(sqrt(2.0));
44 const AbsFunction & fPrime = 2.0*gauss;
45 return Derivative(& fPrime);
46}
47#if defined __GNUC__
48 #if __GNUC__ > 3 && __GNUC_MINOR__ > 6
49 #pragma GCC diagnostic pop
50 #endif
51#endif
52#ifdef __clang__
53 #pragma clang diagnostic pop
54#endif
55
56} // namespace Genfun
#define FUNCTION_OBJECT_IMP(classname)
Definition: AbsFunction.hh:149
virtual ~Erf()
Definition: Erf.cc:22
Derivative partial(unsigned int) const override
Definition: Erf.cc:40
virtual double operator()(double argument) const override
Definition: Erf.cc:25
Erf()
Definition: Erf.cc:12
Parameter & sigma()
Definition: Gaussian.cc:45
void setValue(double value)
Definition: Parameter.cc:59
Definition: Abs.hh:14
FunctionNoop Derivative
Definition: AbsFunction.hh:42