NEST  2.6.0,not_revisioned_source_dir@0
vose.h
Go to the documentation of this file.
1 /*
2  * vose.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 VOSE_H
24 #define VOSE_H
25 
26 #include <vector>
27 
28 #include "nest.h"
29 #include "randomgen.h"
30 
31 namespace nest
32 {
33 
41  class Vose {
46  struct BiasedCoin {
49  BiasedCoin() : heads(0), tails(0), probability(0) {};
51  };
52 
53  public:
58  Vose(std::vector<double_t> dist);
59 
64 
65  private:
66  std::vector<BiasedCoin> dist_;
67 
68  };
69 
70 
71 } // namespace nest
72 
73 #endif
size_t index
Unsigned long type for enumerations.
Definition: nest.h:109
double_t probability
Probability for heads.
Definition: vose.h:48
Vose(std::vector< double_t > dist)
Constructor taking a probability distribution.
Definition: vose.cpp:29
Vose's alias method for selecting a random number using a discrete probability distribution.
Definition: vose.h:41
BiasedCoin()
Definition: vose.h:49
const Name h("h")
Summed input to a neuron (Ginzburg neuron)
Definition: nest_names.h:158
index heads
Definition: vose.h:47
index tails
Definition: vose.h:47
index get_random_id(librandom::RngPtr rng) const
Definition: vose.cpp:81
BiasedCoin(index h, index t, double_t p)
Definition: vose.h:50
double double_t
Double precision floating point numbers.
Definition: nest.h:93
Default types used by the NEST kernel.
An object containing two possible outcomes and a probability to choose between the two...
Definition: vose.h:46
const Name p("p")
current release probability (Tsodyks2_connection)
Definition: nest_names.h:218
std::vector< BiasedCoin > dist_
Definition: vose.h:66