CLHEP VERSION Reference Documentation
CLHEP Home Page
CLHEP Documentation
CLHEP Bug Reports
GenericFunctions
src
LogisticFunction.cc
Go to the documentation of this file.
1
// -*- C++ -*-
2
// $Id:
3
#include "
CLHEP/GenericFunctions/LogisticFunction.hh
"
4
#include "
CLHEP/GenericFunctions/Variable.hh
"
5
#include <assert.h>
6
#define MAXRANGE 1000
7
8
namespace
Genfun
{
9
FUNCTION_OBJECT_IMP
(LogisticFunction)
10
11
LogisticFunction
::
LogisticFunction
():
12
_x0("X0", 0.0,0.0,1.0),
13
_a("A",2.0,1.0, 4.0)
14
{}
15
16
LogisticFunction::~LogisticFunction
() {
17
}
18
19
LogisticFunction::LogisticFunction
(
const
LogisticFunction
& right):
20
AbsFunction
(right),
21
_x0(right._x0),
22
_a(right._a)
23
{
24
}
25
26
double
LogisticFunction::operator()
(
double
x
)
const
{
27
int
i
= (int) (
x
+0.5), &back =
i
, end=back+1;
28
29
if
(i<0 || i>
MAXRANGE
) {
30
return
0;
31
}
32
else
{
33
// Is the vector of values stale?
34
if
(__a!=_a.
getValue
() || __x0!=_x0.
getValue
()) {
35
36
// Empty the vector
37
fx.erase(fx.begin(),fx.end());
38
39
// And update the cache.
40
__a = _a.
getValue
();
41
__x0 = _x0.
getValue
();
42
43
}
44
45
46
if
(fx.empty()) fx.push_back(__x0);
47
48
while
(fx.size()<size_t(end)) {
49
double
v
= fx.back();
50
fx.push_back(__a*
v
*(1.0-
v
));
51
}
52
53
return
fx[
i
];
54
}
55
56
57
}
58
59
Parameter
&
LogisticFunction::x0
() {
60
return
_x0;
61
}
62
63
Parameter
&
LogisticFunction::a
() {
64
return
_a;
65
}
66
67
const
Parameter
&
LogisticFunction::x0
()
const
{
68
return
_x0;
69
}
70
71
const
Parameter &
LogisticFunction::a
()
const
{
72
return
_a;
73
}
74
75
76
}
// namespace Genfun
Genfun::LogisticFunction::LogisticFunction
LogisticFunction()
Definition:
LogisticFunction.cc:11
Genfun::Parameter::getValue
virtual double getValue() const
Definition:
Parameter.cc:27
Genfun::AbsFunction
Definition:
CLHEP/GenericFunctions/AbsFunction.hh:48
Genfun::LogisticFunction::x0
Parameter & x0()
Definition:
LogisticFunction.cc:59
Genfun::LogisticFunction::a
Parameter & a()
Definition:
LogisticFunction.cc:63
LogisticFunction.hh
Variable.hh
MAXRANGE
#define MAXRANGE
Definition:
LogisticFunction.cc:6
v
they are gone ZOOM Features Discontinued The following features of the ZOOM package were felt to be extreme overkill These have been after checking that no existing user code was utilizing as in SpaceVector v
Definition:
keyMergeIssues.doc:324
i
long i
Definition:
JamesRandomSeeding.txt:27
Genfun::LogisticFunction
Definition:
CLHEP/GenericFunctions/LogisticFunction.hh:20
Genfun::Parameter
Definition:
CLHEP/GenericFunctions/Parameter.hh:35
x
any side effects of that construction would occur twice The semantics of throw x
Definition:
whyZMthrowRethrows.txt:37
FUNCTION_OBJECT_IMP
#define FUNCTION_OBJECT_IMP(classname)
Definition:
CLHEP/GenericFunctions/AbsFunction.hh:156
Genfun::LogisticFunction::operator()
virtual double operator()(double argument) const
Definition:
LogisticFunction.cc:26
Genfun
Definition:
CLHEP/GenericFunctions/Abs.hh:14
Genfun::LogisticFunction::~LogisticFunction
virtual ~LogisticFunction()
Definition:
LogisticFunction.cc:16
Generated by
1.8.17