CLHEP 2.4.6.4
C++ Class Library for High Energy Physics
Loading...
Searching...
No Matches
FunctionProduct.cc
Go to the documentation of this file.
1// -*- C++ -*-
2// $Id: FunctionProduct.cc,v 1.3 2003/09/06 14:04:14 boudreau Exp $
3#include "CLHEP/GenericFunctions/FunctionProduct.hh"
4#include <assert.h>
5#include <iostream>
6
7namespace Genfun {
8FUNCTION_OBJECT_IMP(FunctionProduct)
9
11_arg1(arg1->clone()),
12_arg2(arg2->clone())
13{
14 if (arg1->dimensionality()!=arg2->dimensionality()) {
15 std::cout
16 << "Warning: dimension mismatch in function product"
17 << std::endl;
18 assert(0);
19 }
20}
21
23 AbsFunction(right),
24 _arg1(right._arg1->clone()),
25 _arg2(right._arg2->clone())
26{
27}
28
30{
31 delete _arg1;
32 delete _arg2;
33}
34
35
36unsigned int FunctionProduct::dimensionality() const {
37 return _arg1->dimensionality();
38}
39
40double FunctionProduct::operator ()(double x) const
41{
42 return (*_arg1)(x)*(*_arg2)(x);
43}
44
46{
47 return (*_arg1)(x)*(*_arg2)(x);
48}
49
50Derivative FunctionProduct::partial(unsigned int index) const {
51 const AbsFunction & fPrime =
52 (*_arg1)*(_arg2->partial(index)) + (_arg1->partial(index))*(*_arg2);
53 return Derivative(&fPrime);
54}
55
56} // namespace Genfun
#define FUNCTION_OBJECT_IMP(classname)
Definition: AbsFunction.hh:149
virtual Derivative partial(unsigned int) const
Definition: AbsFunction.cc:40
virtual unsigned int dimensionality() const
Definition: AbsFunction.cc:79
virtual double operator()(double argument) const override
FunctionProduct(const AbsFunction *arg1, const AbsFunction *arg2)
virtual unsigned int dimensionality() const override
Derivative partial(unsigned int) const override
Definition: Abs.hh:14
FunctionNoop Derivative
Definition: AbsFunction.hh:42