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