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