CLHEP 2.4.6.4
C++ Class Library for High Energy Physics
Loading...
Searching...
No Matches
Genfun::Variable Class Reference

#include <Variable.hh>

+ Inheritance diagram for Genfun::Variable:

Public Member Functions

 Variable (unsigned int selectionIndex=0, unsigned int dimensionality=1)
 
 Variable (const Variable &right)
 
virtual ~Variable ()
 
virtual double operator() (double argument) const override
 
virtual double operator() (const Argument &a) const override
 
virtual unsigned int dimensionality () const override
 
unsigned int index () const
 
Derivative partial (unsigned int) const override
 
virtual bool hasAnalyticDerivative () const override
 
- Public Member Functions inherited from Genfun::AbsFunction
 AbsFunction ()
 
 AbsFunction (const AbsFunction &right)
 
virtual ~AbsFunction ()
 
virtual unsigned int dimensionality () const
 
virtual double operator() (double argument) const =0
 
virtual double operator() (const Argument &argument) const =0
 
virtual AbsFunctionclone () const =0
 
virtual FunctionComposition operator() (const AbsFunction &f) const
 
virtual ParameterComposition operator() (const AbsParameter &p) const
 
Derivative derivative (const Variable &v) const
 
Derivative prime () const
 
virtual bool hasAnalyticDerivative () const
 
virtual Derivative partial (unsigned int) const
 

Detailed Description

Author

Definition at line 19 of file Variable.hh.

Constructor & Destructor Documentation

◆ Variable() [1/2]

Genfun::Variable::Variable ( unsigned int  selectionIndex = 0,
unsigned int  dimensionality = 1 
)

Definition at line 9 of file Variable.cc.

9 :
10 _selectionIndex(selectionIndex),
11 _dimensionality(dmsnlty)
12{}

◆ Variable() [2/2]

Genfun::Variable::Variable ( const Variable right)

Definition at line 14 of file Variable.cc.

14 :
15 AbsFunction(right),
16 _selectionIndex(right._selectionIndex),
17 _dimensionality(right._dimensionality)
18{
19}

◆ ~Variable()

Genfun::Variable::~Variable ( )
virtual

Definition at line 21 of file Variable.cc.

21 {
22}

Member Function Documentation

◆ dimensionality()

unsigned int Genfun::Variable::dimensionality ( ) const
overridevirtual

Reimplemented from Genfun::AbsFunction.

Definition at line 53 of file Variable.cc.

53 {
54 return _dimensionality;
55}

◆ hasAnalyticDerivative()

virtual bool Genfun::Variable::hasAnalyticDerivative ( ) const
inlineoverridevirtual

Reimplemented from Genfun::AbsFunction.

Definition at line 49 of file Variable.hh.

49{return true;}

◆ index()

unsigned int Genfun::Variable::index ( ) const

◆ operator()() [1/2]

double Genfun::Variable::operator() ( const Argument a) const
overridevirtual

Implements Genfun::AbsFunction.

Definition at line 29 of file Variable.cc.

29 {
30 if (!(_selectionIndex<a.dimension())) throw std::runtime_error("Genfun::Varaible selection index out of bounds");
31 return a[_selectionIndex];
32}

◆ operator()() [2/2]

double Genfun::Variable::operator() ( double  argument) const
overridevirtual

Implements Genfun::AbsFunction.

Definition at line 24 of file Variable.cc.

24 {
25 if (_selectionIndex!=0) throw std::runtime_error("Genfun::Variable: selection index !=0") ;
26 return x;
27}

◆ partial()

Derivative Genfun::Variable::partial ( unsigned int  mindex) const
overridevirtual

Reimplemented from Genfun::AbsFunction.

Definition at line 39 of file Variable.cc.

39 {
40 int kroneckerDelta = mindex==_selectionIndex ? 1 : 0;
41
42 const AbsFunction * f= new FixedConstant(kroneckerDelta);
43 for (unsigned int i=1;i<_dimensionality;i++) {
44 const AbsFunction & g = (*f)%FixedConstant(kroneckerDelta);
45 delete f;
46 f=g.clone();
47 }
48 Derivative retVal(f);
49 delete f;
50 return retVal;
51}
void f(void g())
Definition: excDblThrow.cc:38
FunctionNoop Derivative
Definition: AbsFunction.hh:42
int g(shared_ptr< X >)

The documentation for this class was generated from the following files: