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

#include <FunctionDirectProduct.hh>

+ Inheritance diagram for Genfun::FunctionDirectProduct:

Public Member Functions

 FunctionDirectProduct (const AbsFunction *arg1, const AbsFunction *arg2)
 
 FunctionDirectProduct (const FunctionDirectProduct &right)
 
virtual ~FunctionDirectProduct ()
 
virtual double operator() (double argument) const override
 
virtual double operator() (const Argument &argument) 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 23 of file FunctionDirectProduct.hh.

Constructor & Destructor Documentation

◆ FunctionDirectProduct() [1/2]

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

Definition at line 10 of file FunctionDirectProduct.cc.

10 :
11_arg1(arg1->clone()),
12_arg2(arg2->clone()),
13_m(arg1->dimensionality()),
14_n(arg2->dimensionality())
15{
16}

◆ FunctionDirectProduct() [2/2]

Genfun::FunctionDirectProduct::FunctionDirectProduct ( const FunctionDirectProduct right)

Definition at line 18 of file FunctionDirectProduct.cc.

18 :
19AbsFunction(right),
20_arg1(right._arg1->clone()),
21_arg2(right._arg2->clone()),
22_m(right._m),
23_n(right._n)
24{
25}

◆ ~FunctionDirectProduct()

Genfun::FunctionDirectProduct::~FunctionDirectProduct ( )
virtual

Definition at line 28 of file FunctionDirectProduct.cc.

29{
30 delete _arg1;
31 delete _arg2;
32}

Member Function Documentation

◆ dimensionality()

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

Reimplemented from Genfun::AbsFunction.

Definition at line 55 of file FunctionDirectProduct.cc.

55 {
56 return _m+_n;
57}

◆ hasAnalyticDerivative()

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

Reimplemented from Genfun::AbsFunction.

Definition at line 49 of file FunctionDirectProduct.hh.

49{return true;}

◆ operator()() [1/2]

double Genfun::FunctionDirectProduct::operator() ( const Argument argument) const
overridevirtual

Implements Genfun::AbsFunction.

Definition at line 35 of file FunctionDirectProduct.cc.

35 {
36 unsigned int P = a.dimension();
37 Argument x1(_m);
38 Argument x2(_n);
39 if (_m+_n != P) {
40 std::cerr
41 << "Warning: Direct product function/argument dimension mismatch"
42 << std::endl;
43 assert(0);
44 return 0;
45 }
46 for (unsigned int i = 0; i<_m;i++) {
47 x1[i]=a[i];
48 }
49 for (unsigned int j = 0;j<_n;j++) {
50 x2[j]=a[j+_m];
51 }
52 return (*_arg1)(x1) * (*_arg2)(x2);
53}

◆ operator()() [2/2]

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

Implements Genfun::AbsFunction.

Definition at line 59 of file FunctionDirectProduct.cc.

60{
61 std::cerr
62 << "Warning. direct product called with scalar argument"
63 << std::endl;
64 assert(0);
65 return 0;
66}

◆ partial()

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

Reimplemented from Genfun::AbsFunction.

Definition at line 70 of file FunctionDirectProduct.cc.

70 {
71 assert (index<(_m+_n));
72 if (index<_m) {
73 const AbsFunction & fPrime = (_arg1->partial(index))%(*_arg2);
74 return Derivative(&fPrime);
75 }
76 else {
77 const AbsFunction & fPrime = (*_arg1)%(_arg2->partial(index-_m));
78 return Derivative(&fPrime);
79 }
80}
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: