CLHEP
2.4.7.1
C++ Class Library for High Energy Physics
CLHEP
GenericFunctions
Power.hh
Go to the documentation of this file.
1
// -*- C++ -*-
2
// $Id: Power.hh,v 1.2 2003/09/06 14:04:13 boudreau Exp $
3
//----------------------Power-----------------------------------------------//
4
// //
5
// Class Power //
6
// Joe Boudreau, Petar Maksimovic, Nov. 1999 //
7
// //
8
// Power(x) returns x^n //
9
//--------------------------------------------------------------------------//
10
#ifndef Power_h
11
#define Power_h 1
12
#include "
CLHEP/GenericFunctions/AbsFunction.hh
"
13
namespace
Genfun
{
14
19
class
Power
:
public
AbsFunction
{
20
21
FUNCTION_OBJECT_DEF
(
Power
)
22
23
public
:
24
25
// Constructor
26
Power
(
double
n);
27
Power
(
int
n);
28
Power
(
unsigned
int
n);
29
30
// Copy constructor
31
Power
(
const
Power
&right);
32
33
// Destructor
34
virtual
~Power
();
35
36
// Retrieve function value
37
38
virtual
double
operator ()
(
double
argument)
const override
;
39
virtual
double
operator ()
(
const
Argument
& a)
const override
{
return
operator()
(a[0]);}
40
41
// Derivative.
42
Derivative
partial
(
unsigned
int
)
const override
;
43
44
// Does this function have an analytic derivative?
45
virtual
bool
hasAnalyticDerivative
()
const override
{
return
true
;}
46
47
private
:
48
49
// It is illegal to assign a fixed constant
50
const
Power
& operator=(
const
Power
&right);
51
52
double
_doublePower;
// power (as a double)
53
int
_intPower;
// power (as an integer)
54
bool
_asInteger;
// flag: object constructed with integer argument
55
56
};
57
}
// namespace Genfun
58
#endif
AbsFunction.hh
FUNCTION_OBJECT_DEF
#define FUNCTION_OBJECT_DEF(classname)
Definition
AbsFunction.hh:143
Genfun::AbsFunction::AbsFunction
AbsFunction()
Genfun::Argument
Definition
Argument.hh:17
Genfun::Power
Definition
Power.hh:19
Genfun::Power::Power
Power(double n)
Genfun::Power::~Power
virtual ~Power()
Genfun::Power::hasAnalyticDerivative
virtual bool hasAnalyticDerivative() const override
Definition
Power.hh:45
Genfun::Power::Power
Power(const Power &right)
Genfun::Power::partial
Derivative partial(unsigned int) const override
Genfun::Power::operator()
virtual double operator()(double argument) const override
Genfun::Power::Power
Power(unsigned int n)
Genfun::Power::Power
Power(int n)
Genfun
Definition
Abs.hh:14
Genfun::Derivative
FunctionNoop Derivative
Definition
AbsFunction.hh:42
Generated by
1.13.2