CLHEP VERSION Reference Documentation
CLHEP Home Page
CLHEP Documentation
CLHEP Bug Reports
Main Page
Namespaces
Classes
Files
File List
File Members
GenericFunctions
src
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
6
namespace
Genfun {
7
FUNCTION_OBJECT_IMP
(FunctionProduct)
8
9
FunctionProduct
::
FunctionProduct
(const
AbsFunction
*arg1, const
AbsFunction
*arg2):
10
_arg1(arg1->clone()),
11
_arg2(arg2->clone())
12
{
13
if
(arg1->dimensionality()!=arg2->dimensionality()) {
14
std::cout
15
<<
"Warning: dimension mismatch in function product"
16
<< std::endl;
17
assert(0);
18
}
19
}
20
21
FunctionProduct::FunctionProduct
(
const
FunctionProduct
& right) :
22
AbsFunction
(right),
23
_arg1(right._arg1->clone()),
24
_arg2(right._arg2->clone())
25
{
26
}
27
28
FunctionProduct::~FunctionProduct
()
29
{
30
delete
_arg1;
31
delete
_arg2;
32
}
33
34
35
unsigned
int
FunctionProduct::dimensionality
()
const
{
36
return
_arg1->
dimensionality
();
37
}
38
39
double
FunctionProduct::operator ()
(
double
x)
const
40
{
41
return
(*_arg1)(x)*(*_arg2)(x);
42
}
43
44
double
FunctionProduct::operator ()
(
const
Argument
& x)
const
45
{
46
return
(*_arg1)(x)*(*_arg2)(x);
47
}
48
49
Derivative
FunctionProduct::partial
(
unsigned
int
index)
const
{
50
const
AbsFunction
& fPrime =
51
(*_arg1)*(_arg2->
partial
(index)) + (_arg1->
partial
(index))*(*_arg2);
52
return
Derivative
(&fPrime);
53
}
54
55
}
// namespace Genfun
Generated on Mon May 6 2013 04:04:10 for CLHEP by
1.8.1.2