CLHEP 2.4.6.4
C++ Class Library for High Energy Physics
Loading...
Searching...
No Matches
FunctionQuotient.cc
Go to the documentation of this file.
1// -*- C++ -*-
2// $Id: FunctionQuotient.cc,v 1.3 2003/09/06 14:04:14 boudreau Exp $
3#include "CLHEP/GenericFunctions/FunctionQuotient.hh"
4#include <assert.h>
5#include <iostream>
6
7namespace Genfun {
8FUNCTION_OBJECT_IMP(FunctionQuotient)
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 quotient"
17 << std::endl;
18 assert(0);
19 }
20}
21
23AbsFunction(right),
24_arg1(right._arg1->clone()),
25_arg2(right._arg2->clone())
26{}
28{
29 delete _arg1;
30 delete _arg2;
31}
32
34 return _arg1->dimensionality();
35}
36
37
38double FunctionQuotient::operator ()(double x) const
39{
40 return (*_arg1)(x)/(*_arg2)(x);
41}
42
44{
45 return (*_arg1)(x)/(*_arg2)(x);
46}
47
48
49Derivative FunctionQuotient::partial(unsigned int index) const {
50 const AbsFunction & fPrime =
51 ((_arg1->partial(index))*(*_arg2)-(*_arg1)*(_arg2->partial(index))) /
52 (*_arg2)/ (*_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
FunctionQuotient(const AbsFunction *arg1, const AbsFunction *arg2)
Derivative partial(unsigned int) const override
virtual unsigned int dimensionality() const override
virtual double operator()(double argument) const override
Definition: Abs.hh:14
FunctionNoop Derivative
Definition: AbsFunction.hh:42