NEURON
LogNorm.h
Go to the documentation of this file.
1
// This may look like C code, but it is really -*- C++ -*-
2
/*
3
Copyright (C) 1988 Free Software Foundation
4
written by Dirk Grunwald (grunwald@cs.uiuc.edu)
5
6
This file is part of the GNU C++ Library. This library is free
7
software; you can redistribute it and/or modify it under the terms of
8
the GNU Library General Public License as published by the Free
9
Software Foundation; either version 2 of the License, or (at your
10
option) any later version. This library is distributed in the hope
11
that it will be useful, but WITHOUT ANY WARRANTY; without even the
12
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
13
PURPOSE. See the GNU Library General Public License for more details.
14
You should have received a copy of the GNU Library General Public
15
License along with this library; if not, write to the Free Software
16
Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
17
*/
18
#pragma once
19
20
#include "
Normal.h
"
21
22
class
LogNormal
:
public
Normal
{
23
protected
:
24
double
logMean
;
25
double
logVariance
;
26
void
setState
();
27
public
:
28
LogNormal
(
double
mean
,
double
variance
,
RNG
*gen);
29
double
mean
();
30
double
mean
(
double
x);
31
double
variance
();
32
double
variance
(
double
x);
33
virtual
double
operator()
();
34
};
35
36
37
inline
void
LogNormal::setState
()
38
{
39
double
m2 =
logMean
*
logMean
;
40
pMean
=
log
(m2 /
sqrt
(
logVariance
+ m2) );
41
// from ch@heike.informatik.uni-dortmund.de:
42
// (was pVariance = log((sqrt(logVariance + m2)/m2 )); )
43
pStdDev
=
sqrt
(
log
((
logVariance
+ m2)/m2 ));
44
}
45
46
inline
LogNormal::LogNormal
(
double
mean,
double
variance,
RNG
*gen)
47
:
Normal
(mean, variance, gen)
48
{
49
logMean
=
mean
;
50
logVariance
=
variance
;
51
setState
();
52
}
53
54
inline
double
LogNormal::mean
() {
55
return
logMean
;
56
}
57
58
inline
double
LogNormal::mean
(
double
x)
59
{
60
double
t
=
logMean
;
logMean
= x;
setState
();
61
return
t
;
62
}
63
64
inline
double
LogNormal::variance
() {
65
return
logVariance
;
66
}
67
68
inline
double
LogNormal::variance
(
double
x)
69
{
70
double
t
=
logVariance
;
logVariance
= x;
setState
();
71
return
t
;
72
}
Normal.h
LogNormal
Definition:
LogNorm.h:22
LogNormal::operator()
virtual double operator()()
Definition:
LogNorm.cpp:34
LogNormal::logVariance
double logVariance
Definition:
LogNorm.h:25
LogNormal::LogNormal
LogNormal(double mean, double variance, RNG *gen)
Definition:
LogNorm.h:46
LogNormal::mean
double mean()
Definition:
LogNorm.h:54
LogNormal::logMean
double logMean
Definition:
LogNorm.h:24
LogNormal::setState
void setState()
Definition:
LogNorm.h:37
LogNormal::variance
double variance()
Definition:
LogNorm.h:64
Normal
Definition:
Normal.h:21
Normal::pMean
double pMean
Definition:
Normal.h:26
Normal::pStdDev
double pStdDev
Definition:
Normal.h:28
RNG
Definition:
RNG.h:5
sqrt
sqrt
Definition:
extdef.h:3
log
log
Definition:
extdef.h:4
coreneuron::t
double t
Definition:
register_mech.cpp:23
src
gnu
LogNorm.h