Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
functions
LogNormal.cxx
Go to the documentation of this file.
1
12
#ifdef _MSC_VER
13
#include "msdevstudio/MSconfig.h"
14
#endif
15
16
#include "
LogNormal.h
"
17
18
#include "
FunctionHelper.h
"
19
20
#include <cmath>
21
#include <cassert>
22
23
using
std::distance;
24
25
using
std::exp;
26
using
std::vector;
27
28
using namespace
hippodraw;
29
30
LogNormal::LogNormal
( )
31
{
32
initialize
();
33
}
34
35
LogNormal::LogNormal
(
double
n,
double
m,
double
s )
36
{
37
initialize
();
38
39
m_parms
[
norm
] = n;
40
m_parms
[
mu
] = m;
41
m_parms
[
sigma
] = s;
42
}
43
44
void
LogNormal::initialize
()
45
{
46
m_name
=
"LogNormal"
;
47
48
m_parm_names
.push_back (
"Norm"
);
49
m_parm_names
.push_back (
"Mu"
);
50
m_parm_names
.push_back (
"Sigma"
);
51
52
resize
();
53
}
54
55
FunctionBase
*
LogNormal::clone
()
const
56
{
57
return
new
LogNormal
( *
this
);
58
}
59
60
double
LogNormal::operator ()
(
double
x )
const
61
{
62
double
t = ( log ( x ) -
m_parms
[
mu
] ) /
m_parms
[
sigma
];
63
double
result =
m_parms
[
norm
] * exp ( -0.5 * t*t );
64
65
return
result;
66
}
67
70
void
71
LogNormal::
72
initialParameters
(
const
FunctionHelper
* helper )
73
{
74
m_parms
[
norm
] = 1.0;
75
m_parms
[
mu
] = log ( helper->
meanCoord
() );
76
m_parms
[
sigma
] = 0.5;
77
}
78
79
double
80
LogNormal::
81
derivByParm
(
int
,
double
)
const
82
{
83
assert (
false
);
84
return
0.;
85
}
86
87
bool
88
LogNormal::
89
hasDerivatives
()
const
90
{
91
return
false
;
92
}
Generated for HippoDraw Class Library by