NEST  2.6.0,not_revisioned_source_dir@0
normal_randomdev.h
Go to the documentation of this file.
1 /*
2  * normal_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 NORMAL_RANDOMDEV_H
24 #define NORMAL_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::normal - normal random deviate generator
36 Description: Generates normally distributed random numbers.
37 
38  p(x) = 1 / (sigma * \sqrt{2 pi}) * exp (-(x-mu)^2 / 2 sigma^2)
39 
40 Parameters:
41  mu - mean (default: 0.0)
42  sigma - standard deviation (default: 1.0)
43 
44 SeeAlso: CreateRDV, RandomArray, rdevdict
45 Author: Hans Ekkehard Plesser
46 */
47 
59  class NormalRandomDev : public RandomDev
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  NormalRandomDev(); // 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 
virtual double operator()(void)
Operator delivering doubles.
Definition: randomdev.h:199
Create normal (Gaussian) random numbers with uniform variance.
Definition: normal_randomdev.h:59
NormalRandomDev()
Definition: normal_randomdev.cpp:37
double mu_
Definition: normal_randomdev.h:80
Abstract base class for access to non-uniform random deviate generators.
Definition: randomdev.h:131
void set_status(const DictionaryDatum &)
set distribution parameters from SLI dict
Definition: normal_randomdev.cpp:43
double sigma_
Definition: normal_randomdev.h:81
void get_status(DictionaryDatum &) const
get distribution parameters from SLI dict
Definition: normal_randomdev.cpp:58