Skip to content

Commit b2697bd

Browse files
committed
Fixed minor casting bug in random stream and renamed them to camel case
1 parent 314de67 commit b2697bd

File tree

5 files changed

+13
-14
lines changed

5 files changed

+13
-14
lines changed

Cortex_mex.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
#include <iterator>
3838
#include <vector>
3939

40+
#include "Cortical_Column.h"
4041
#include "Data_Storage.h"
4142
#include "Stimulation.h"
4243
mxArray* SetMexArray(int N, int M);

Cortical_Column.cpp

+2-4
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@ void Cortical_Column::set_RNG(void) {
4242
Rand_vars.reserve(2*numRandomVariables);
4343
for (unsigned i=0; i < numRandomVariables; ++i){
4444
/* Add the RNG for I_{l}*/
45-
MTRands.push_back(random_stream_normal(0.0, dphi*dt));
45+
MTRands.push_back(randomStreamNormal(0.0, dphi*dt));
4646

4747
/* Add the RNG for I_{l,0} */
48-
MTRands.push_back(random_stream_normal(0.0, dt));
48+
MTRands.push_back(randomStreamNormal(0.0, dt));
4949

5050
/* Get the random number for the first iteration */
5151
Rand_vars.push_back(MTRands[2*i]());
@@ -67,12 +67,10 @@ double Cortical_Column::noise_aRK(int M) const{
6767
/******************************************************************************/
6868
/* Firing Rate functions */
6969
/******************************************************************************/
70-
/* Pyramidal firing rate */
7170
double Cortical_Column::get_Qp (int N) const{
7271
return Qp_max / (1 + exp(-C1 * (Vp[N] - theta_p) / sigma_p));
7372
}
7473

75-
/* Inhibitory firing rate */
7674
double Cortical_Column::get_Qi (int N) const{
7775
return Qi_max / (1 + exp(-C1 * (Vi[N] - theta_i) / sigma_i));
7876
}

Cortical_Column.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ class Cortical_Column {
8080
{var[0] = (-3*var[0] + 2*var[1] + 4*var[2] + 2*var[3] + var[4])/6 + noise_aRK(noise);}
8181

8282
/* Random number generators */
83-
std::vector<random_stream_normal> MTRands;
83+
std::vector<randomStreamNormal> MTRands;
8484

8585
/* Container for noise */
8686
std::vector<double> Rand_vars;

Random_Stream.h

+7-7
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@
2929
#pragma once
3030
#include <random>
3131

32-
class random_stream_normal {
32+
class randomStreamNormal {
3333
public:
34-
explicit random_stream_normal(double mean, double stddev)
34+
explicit randomStreamNormal(double mean, double stddev)
3535
: mt(rand()), norm_dist(mean, stddev) {}
36-
explicit random_stream_normal(double mean, double stddev, double seed)
36+
explicit randomStreamNormal(double mean, double stddev, double seed)
3737
: mt(seed), norm_dist(mean, stddev) {}
3838

3939
double operator ()(void) { return norm_dist(mt); }
@@ -42,14 +42,14 @@ class random_stream_normal {
4242
std::normal_distribution<double> norm_dist;
4343
};
4444

45-
class random_stream_uniform_int {
45+
class randomStreamUniformInt {
4646
public:
47-
explicit random_stream_uniform_int(int lower_bound, int upper_bound)
47+
explicit randomStreamUniformInt(int lower_bound, int upper_bound)
4848
: mt(rand()), uniform_dist(lower_bound, upper_bound) {}
49-
explicit random_stream_uniform_int(int lower_bound, int upper_bound, double seed)
49+
explicit randomStreamUniformInt(int lower_bound, int upper_bound, double seed)
5050
: mt(seed), uniform_dist(lower_bound, upper_bound) {}
5151

52-
double operator ()(void) { return uniform_dist(mt); }
52+
int operator ()(void) { return uniform_dist(mt); }
5353
private:
5454
std::mt19937_64 mt;
5555
std::uniform_int_distribution<> uniform_dist;

Stimulation.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ class Stim {
122122
std::vector<int> marker_stimulation;
123123

124124
/* Random number generator in case of semi-periodic stimulation */
125-
random_stream_uniform_int Uniform_Distribution = random_stream_uniform_int(0, 0);
125+
randomStreamUniformInt Uniform_Distribution = randomStreamUniformInt(0, 0);
126126

127127
/* Create MATLAB container for marker storage */
128128
friend mxArray* get_marker(Stim &stim);
@@ -167,7 +167,7 @@ void Stim::setup (double* var_stim) {
167167
/* If ISI is random create RNG */
168168
if (ISI_range != 0){
169169
/* Generate uniform distribution */
170-
Uniform_Distribution = random_stream_uniform_int(ISI-ISI_range, ISI+ISI_range);
170+
Uniform_Distribution = randomStreamUniformInt(ISI-ISI_range, ISI+ISI_range);
171171
}
172172
} else {
173173
/* In case of phase dependent stimulation, time_to_stim is the time from

0 commit comments

Comments
 (0)