CLHEP VERSION Reference Documentation
CLHEP Home Page
CLHEP Documentation
CLHEP Bug Reports
Main Page
Namespaces
Classes
Files
File List
File Members
GenericFunctions
src
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
6
namespace
Genfun {
7
FUNCTION_OBJECT_IMP
(FunctionQuotient)
8
9
FunctionQuotient
::
FunctionQuotient
(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 quotient"
16
<< std::endl;
17
assert(0);
18
}
19
}
20
21
FunctionQuotient::FunctionQuotient
(
const
FunctionQuotient
& right) :
22
_arg1(right._arg1->clone()),
23
_arg2(right._arg2->clone())
24
{}
25
FunctionQuotient::~FunctionQuotient
()
26
{
27
delete
_arg1;
28
delete
_arg2;
29
}
30
31
unsigned
int
FunctionQuotient::dimensionality
()
const
{
32
return
_arg1->
dimensionality
();
33
}
34
35
36
double
FunctionQuotient::operator ()
(
double
x)
const
37
{
38
return
(*_arg1)(x)/(*_arg2)(x);
39
}
40
41
double
FunctionQuotient::operator ()
(
const
Argument
& x)
const
42
{
43
return
(*_arg1)(x)/(*_arg2)(x);
44
}
45
46
47
Derivative
FunctionQuotient::partial
(
unsigned
int
index)
const
{
48
const
AbsFunction
& fPrime =
49
((_arg1->
partial
(index))*(*_arg2)-(*_arg1)*(_arg2->
partial
(index))) /
50
(*_arg2)/ (*_arg2);
51
return
Derivative
(&fPrime);
52
}
53
54
}
// namespace Genfun
Generated on Sun Jun 17 2012 08:08:26 for CLHEP by
1.8.1.1