GeoModel - GeoModelCore
Power.h
1 //==========================================================================//
2 // Imported from the QAT library (qat.pitt.edu) by the copyright holder //
3 // Joe Boudreau. Software licensed under the terms and conditions of the //
4 // GNU Lesser Public License v3. //
5 //==========================================================================//
6 //----------------------Power-----------------------------------------------//
7 // //
8 // Class Power //
9 // //
10 // Power(x) returns x^n //
11 // //
12 //--------------------------------------------------------------------------//
13 #ifndef Power_h
14 #define Power_h 1
15 #include "GeoGenericFunctions/AbsFunction.h"
16 namespace GeoGenfun {
17 
18  class Power : public AbsFunction {
19 
20  FUNCTION_OBJECT_DEF(Power)
21 
22  public:
23 
24  // Constructor
25  Power(double n);
26  Power(int n);
27  Power(unsigned int n);
28 
29  // Copy constructor
30  Power(const Power &right);
31 
32  // Destructor
33  virtual ~Power();
34 
35  // Retrieve function value
36 
37  virtual double operator ()(double argument) const override;
38  virtual double operator ()(const Argument & a) const override {return operator() (a[0]);}
39 
40  // Derivative.
41  virtual Derivative partial (unsigned int) const override;
42 
43  // Does this function have an analytic derivative?
44  virtual bool hasAnalyticDerivative() const override {return true;}
45 
46  private:
47 
48  // It is illegal to assign a fixed constant
49  const Power & operator=(const Power &right);
50 
51  double _doublePower; // power (as a double)
52  int _intPower; // power (as an integer)
53  bool _asInteger; // flag: object constructed with integer argument
54 
55  };
56 } // namespace GeoGenfun
57 #endif
Definition: Abs.h:15