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