CLHEP VERSION Reference Documentation
CLHEP Home Page
CLHEP Documentation
CLHEP Bug Reports
Main Page
Namespaces
Classes
Files
File List
File Members
GenericFunctions
src
FunctionDifference.cc
Go to the documentation of this file.
1
// -*- C++ -*-
2
// $Id: FunctionDifference.cc,v 1.3 2003/09/06 14:04:14 boudreau Exp $
3
#include "
CLHEP/GenericFunctions/FunctionDifference.hh
"
4
#include <assert.h>
5
6
namespace
Genfun {
7
FUNCTION_OBJECT_IMP
(FunctionDifference)
8
9
FunctionDifference
::
FunctionDifference
(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 difference"
16
<< std::endl;
17
assert(0);
18
}
19
}
20
21
22
FunctionDifference::FunctionDifference
(
const
FunctionDifference
& right):
23
AbsFunction
(right),
24
_arg1(right._arg1->clone()),
25
_arg2(right._arg2->clone())
26
{
27
}
28
29
30
unsigned
int
FunctionDifference::dimensionality
()
const
{
31
return
_arg1->
dimensionality
();
32
}
33
34
FunctionDifference::~FunctionDifference
()
35
{
36
delete
_arg1;
37
delete
_arg2;
38
}
39
40
41
42
double
FunctionDifference::operator ()
(
double
x)
const
43
{
44
return
(*_arg1)(x)-(*_arg2)(x);
45
}
46
47
double
FunctionDifference::operator ()
(
const
Argument
& x)
const
48
{
49
return
(*_arg1)(x)-(*_arg2)(x);
50
}
51
52
53
Derivative
FunctionDifference::partial
(
unsigned
int
index)
const
{
54
const
AbsFunction
& fPrime = _arg1->
partial
(index) - _arg2->
partial
(index);
55
return
Derivative
(&fPrime);
56
}
57
58
59
60
}
// namespace Genfun
Generated on Mon May 6 2013 04:04:10 for CLHEP by
1.8.1.2