CLHEP 2.4.6.4
C++ Class Library for High Energy Physics
Loading...
Searching...
No Matches
ConstTimesFunction.cc
Go to the documentation of this file.
1// -*- C++ -*-
2// $Id: ConstTimesFunction.cc,v 1.3 2003/09/06 14:04:14 boudreau Exp $
3#include "CLHEP/GenericFunctions/ConstTimesFunction.hh"
4
5namespace Genfun {
6FUNCTION_OBJECT_IMP(ConstTimesFunction)
7
8ConstTimesFunction::ConstTimesFunction(double constant, const AbsFunction *arg):
9 _constant(constant),
10 _arg(arg->clone())
11{
12}
13
15AbsFunction(right),
16_constant(right._constant),
17_arg(right._arg->clone())
18{}
19
21 return _arg->dimensionality();
22}
23
25{
26 delete _arg;
27}
28
29
30
31double ConstTimesFunction::operator ()(double x) const
32{
33 return _constant * (*_arg)(x);
34}
35
36
38{
39 return _constant * (*_arg)(x);
40}
41
42Derivative ConstTimesFunction::partial(unsigned int index) const {
43 // d/dx (k*f) = k*(df/dx)
44 const AbsFunction & fPrime = _constant*(_arg->partial(index));
45 return Derivative(& fPrime);
46}
47
48} // 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
Derivative partial(unsigned int) const override
virtual double operator()(double argument) const override
virtual unsigned int dimensionality() const override
ConstTimesFunction(double constant, const AbsFunction *arg)
Definition: Abs.hh:14
FunctionNoop Derivative
Definition: AbsFunction.hh:42