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

#include <FunctionSum.hh>

+ Inheritance diagram for Genfun::FunctionSum:

Public Member Functions

 FunctionSum (const AbsFunction *arg1, const AbsFunction *arg2)
 
 FunctionSum (const FunctionSum &right)
 
virtual ~FunctionSum ()
 
virtual double operator() (double argument) const override
 
virtual double operator() (const Argument &a) const override
 
virtual unsigned int dimensionality () const override
 
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 20 of file FunctionSum.hh.

Constructor & Destructor Documentation

◆ FunctionSum() [1/2]

Genfun::FunctionSum::FunctionSum ( const AbsFunction arg1,
const AbsFunction arg2 
)

Definition at line 10 of file FunctionSum.cc.

10 :
11 _arg1(arg1->clone()),
12 _arg2(arg2->clone())
13{
14 if (arg1->dimensionality()!=arg2->dimensionality()) {
15 std::cout
16 << "Warning: dimension mismatch in function sum"
17 << std::endl;
18 assert(0);
19 }
20}

◆ FunctionSum() [2/2]

Genfun::FunctionSum::FunctionSum ( const FunctionSum right)

Definition at line 22 of file FunctionSum.cc.

22 :
23AbsFunction(right),
24_arg1(right._arg1->clone()),
25_arg2(right._arg2->clone())
26{}

◆ ~FunctionSum()

Genfun::FunctionSum::~FunctionSum ( )
virtual

Definition at line 32 of file FunctionSum.cc.

33{
34 delete _arg1;
35 delete _arg2;
36}

Member Function Documentation

◆ dimensionality()

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

Reimplemented from Genfun::AbsFunction.

Definition at line 28 of file FunctionSum.cc.

28 {
29 return _arg1->dimensionality();
30}
virtual unsigned int dimensionality() const
Definition: AbsFunction.cc:79

◆ hasAnalyticDerivative()

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

Reimplemented from Genfun::AbsFunction.

Definition at line 46 of file FunctionSum.hh.

46{return true;}

◆ operator()() [1/2]

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

Implements Genfun::AbsFunction.

Definition at line 46 of file FunctionSum.cc.

47{
48 return (*_arg1)(x)+(*_arg2)(x);
49}

◆ operator()() [2/2]

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

Implements Genfun::AbsFunction.

Definition at line 40 of file FunctionSum.cc.

41{
42 return (*_arg1)(x)+(*_arg2)(x);
43}

◆ partial()

Derivative Genfun::FunctionSum::partial ( unsigned int  index) const
overridevirtual

Reimplemented from Genfun::AbsFunction.

Definition at line 53 of file FunctionSum.cc.

53 {
54 const AbsFunction & fPrime = _arg1->partial(index) + _arg2->partial(index);
55 return Derivative(&fPrime);
56}
virtual Derivative partial(unsigned int) const
Definition: AbsFunction.cc:40
FunctionNoop Derivative
Definition: AbsFunction.hh:42

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