NEST  2.6.0,not_revisioned_source_dir@0
lognormal_randomdev.h
Go to the documentation of this file.
1 /*
2  * lognormal_randomdev.h
3  *
4  * This file is part of NEST.
5  *
6  * Copyright (C) 2004 The NEST Initiative
7  *
8  * NEST is free software: you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation, either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * NEST is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with NEST. If not, see <http://www.gnu.org/licenses/>.
20  *
21  */
22 
23 #ifndef LOGNORMAL_RANDOMDEV_H
24 #define LOGNORMAL_RANDOMDEV_H
25 
26 #include <cmath>
27 #include "randomgen.h"
28 #include "randomdev.h"
29 #include "lockptr.h"
30 
31 
32 namespace librandom {
33 
34 /*BeginDocumentation
35 Name: rdevdict::lognormal - lognormal random deviate generator
36 Description: Generates lognormally distributed random numbers.
37 
38  p(x) = 1 / (x * sigma * \sqrt{2 pi}) * exp (-(ln(x)-mu)^2 / 2 sigma^2)
39 
40 Parameters:
41  mu - mean of the underlying normal distribution (default: 0.0)
42  sigma - standard deviation of the underlying normal distribution (default: 1.0)
43 
44 Note:
45 Mean and variance of the lognormal numbers are given by
46 
47  E[X] = exp(mu + sigma^2/2)
48  Var[X] = (exp(sigma^2) - 1) * E[X]^2
49 
50 SeeAlso: CreateRDV, RandomArray, rdevdict
51 Author: Hans Ekkehard Plesser
52 */
53 
60  {
61 
62  public:
63 
64  // accept only lockPTRs for initialization,
65  // otherwise creation of a lock ptr would
66  // occur as side effect---might be unhealthy
68  LognormalRandomDev(); // threaded
69 
70  using RandomDev::operator();
71  double operator()(RngPtr) const; // threaded
72 
74  void set_status(const DictionaryDatum&);
75 
77  void get_status(DictionaryDatum&) const;
78 
79  private:
80  double mu_;
81  double sigma_;
82  };
83 
84 }
85 
86 # endif
87 
88 
89 
90 
91 
92 
93 
94 
95 
96 
97 
98 
99 
100 
101 
102 
103 
104 
LognormalRandomDev()
Definition: lognormal_randomdev.cpp:37
double sigma_
Definition: lognormal_randomdev.h:81
virtual double operator()(void)
Operator delivering doubles.
Definition: randomdev.h:199
double mu_
Definition: lognormal_randomdev.h:80
Create lognormal random numbers with uniform variance.
Definition: lognormal_randomdev.h:59
Abstract base class for access to non-uniform random deviate generators.
Definition: randomdev.h:131
void get_status(DictionaryDatum &) const
get distribution parameters from SLI dict
Definition: lognormal_randomdev.cpp:58
void set_status(const DictionaryDatum &)
set distribution parameters from SLI dict
Definition: lognormal_randomdev.cpp:43