Parallel PopGen Package
template_inline_simulation_functors.cuh
1 /*
2  * template_simulation_functors.cuh
3  *
4  * Author: David Lawrie
5  * implementation of template and inline functions for GO Fish evolutionary models and sampling schemes
6  */
7 
8 #ifndef TEMPLATE_INLINE_SIMULATION_FUNCTORS_CUH_
9 #define TEMPLATE_INLINE_SIMULATION_FUNCTORS_CUH_
10 
15 namespace Sim_Model{
16 
45 /* ----- constant selection model ----- */
51 template <typename Functor_demography, typename Functor_inbreeding>
52 inline selection_constant::selection_constant(float gamma, Functor_demography demography, Functor_inbreeding F, int forward_generation_shift /*= 0*/){ s = gamma/(2*demography(0,forward_generation_shift)/(1+F(0,forward_generation_shift))); }
53 __device__ __forceinline__ float selection_constant::operator()(const int population, const int generation, const float freq) const{ return s; }
54 /* ----- end constant selection model ----- */
55 
56 /* ----- linear frequency dependent selection model ----- */
63 inline selection_linear_frequency_dependent::selection_linear_frequency_dependent(float slope, float intercept) : slope(slope), intercept(intercept) { }
68 template <typename Functor_demography, typename Functor_inbreeding>
69 inline selection_linear_frequency_dependent::selection_linear_frequency_dependent(float gamma_slope, float gamma_intercept, Functor_demography demography, Functor_inbreeding F, int forward_generation_shift /*= 0*/){
70  slope = gamma_slope/(2*demography(0,forward_generation_shift)/(1+F(0,forward_generation_shift)));
71  intercept = gamma_intercept/(2*demography(0,forward_generation_shift)/(1+F(0,forward_generation_shift)));
72 }
74 __device__ __forceinline__ float selection_linear_frequency_dependent::operator()(const int population, const int generation, const float freq) const{ return slope*freq+intercept; }
75 /* ----- end linear frequency dependent selection model ----- */
76 
77 /* ----- seasonal selection model ----- */
78 inline selection_sine_wave::selection_sine_wave() : A(0), pi(0), rho(0), D(0), generation_shift(0) {}
80 inline selection_sine_wave::selection_sine_wave(float A, float pi, float D, float rho /*= 0*/, int generation_shift /*= 0*/) : A(A), pi(pi), rho(rho), D(D), generation_shift(generation_shift) {}
86 template <typename Functor_demography, typename Functor_inbreeding>
87 inline selection_sine_wave::selection_sine_wave(float gamma_A, float pi, float gamma_D, Functor_demography demography, Functor_inbreeding F, float rho /*= 0*/, int generation_shift /*= 0*/, int forward_generation_shift /*= 0*/) : pi(pi), rho(rho), generation_shift(generation_shift) {
88  A = gamma_A/(2*demography(0,forward_generation_shift)/(1+F(0,forward_generation_shift)));
89  D = gamma_D/(2*demography(0,forward_generation_shift)/(1+F(0,forward_generation_shift)));
90 }
92 __device__ __forceinline__ float selection_sine_wave::operator()(const int population, const int generation, const float freq) const{ return A*sin(pi*(generation-generation_shift) + rho) + D;}
93 /* ----- end seasonal selection model ----- */
94 
95 /* ----- population specific selection model ----- */
114 template <typename Functor_sel, typename Functor_sel_pop>
117 template <typename Functor_sel, typename Functor_sel_pop>
118 inline selection_population_specific<Functor_sel,Functor_sel_pop>::selection_population_specific(Functor_sel s_in, Functor_sel_pop s_pop_in, int pop, int generation_shift /*= 0*/) : pop(pop), generation_shift(generation_shift){ s = s_in; s_pop = s_pop_in; }
121 template <typename Functor_sel, typename Functor_sel_pop>
122 __device__ __forceinline__ float selection_population_specific<Functor_sel,Functor_sel_pop>::operator()(const int population, const int generation, const float freq) const{
123  if(pop == population) return s_pop(population, generation-generation_shift, freq);
124  return s(population, generation-generation_shift, freq);
125 }
126 /* ----- end population specific selection model ----- */
127 
128 /* ----- piecewise selection model ----- */
147 template <typename Functor_sel1, typename Functor_sel2>
148 inline selection_piecewise<Functor_sel1, Functor_sel2>::selection_piecewise() : inflection_point(0), generation_shift(0) { s1 = Functor_sel1(); s2 = Functor_sel2(); }
150 template <typename Functor_sel1, typename Functor_sel2>
151 inline selection_piecewise<Functor_sel1, Functor_sel2>::selection_piecewise(Functor_sel1 s1_in, Functor_sel2 s2_in, int inflection_point, int generation_shift /* = 0*/) : inflection_point(inflection_point), generation_shift(generation_shift) { s1 = s1_in; s2 = s2_in; }
154 template <typename Functor_sel1, typename Functor_sel2>
155 __device__ __forceinline__ float selection_piecewise<Functor_sel1, Functor_sel2>::operator()(const int population, const int generation, const float freq) const{
156  if(generation >= inflection_point+generation_shift){ return s2(population, generation-generation_shift, freq) ; }
157  return s1(population, generation-generation_shift, freq);
158 };
159 /* ----- end piecewise selection model ----- */
160 /* ----- end selection models ----- */
161 
179 /* ----- inbreeding, mutation, & dominance models ----- */
180 /* ----- constant parameter model ----- */
182 inline F_mu_h_constant::F_mu_h_constant(float p) : p(p){ }
183 __host__ __forceinline__ float F_mu_h_constant::operator()(const int population, const int generation) const{ return p; }
184 /* ----- end constant parameter model ----- */
185 
186 /* ----- seasonal parameter model ----- */
187 inline F_mu_h_sine_wave::F_mu_h_sine_wave() : A(0), pi(0), rho(0), D(0), generation_shift(0) {}
188 inline F_mu_h_sine_wave::F_mu_h_sine_wave(float A, float pi, float D, float rho /*= 0*/, int generation_shift /*= 0*/) : A(A), pi(pi), rho(rho), D(D), generation_shift(generation_shift) {}
190 __host__ __forceinline__ float F_mu_h_sine_wave::operator()(const int population, const int generation) const{ return A*sin(pi*(generation-generation_shift) + rho) + D;}
191 /* ----- end seasonal parameter model ----- */
192 
193 /* ----- population specific parameter model ----- */
212 template <typename Functor_p, typename Functor_p_pop>
215 template <typename Functor_p, typename Functor_p_pop>
216 inline F_mu_h_population_specific<Functor_p,Functor_p_pop>::F_mu_h_population_specific(Functor_p p_in, Functor_p_pop p_pop_in, int pop, int generation_shift /*= 0*/) : pop(pop), generation_shift(generation_shift){ p = p_in; p_pop = p_pop_in; }
219 template <typename Functor_p, typename Functor_p_pop>
220 __host__ __forceinline__ float F_mu_h_population_specific<Functor_p,Functor_p_pop>::operator()(const int population, const int generation) const{
221  if(pop == population) return p_pop(population, generation-generation_shift);
222  return p(population, generation-generation_shift);
223 }
224 /* ----- end population specific parameter model ----- */
225 
226 /* ----- piecewise parameter model ----- */
245 template <typename Functor_p1, typename Functor_p2>
246 inline F_mu_h_piecewise<Functor_p1, Functor_p2>::F_mu_h_piecewise() : inflection_point(0), generation_shift(0) { p1 = Functor_p1(); p2 = Functor_p2(); }
248 template <typename Functor_p1, typename Functor_p2>
249 inline F_mu_h_piecewise<Functor_p1, Functor_p2>::F_mu_h_piecewise(Functor_p1 p1_in, Functor_p2 p2_in, int inflection_point, int generation_shift /* = 0*/) : inflection_point(inflection_point), generation_shift(generation_shift) { p1 = p1_in; p2 = p2_in; }
252 template <typename Functor_p1, typename Functor_p2>
253 __host__ __forceinline__ float F_mu_h_piecewise<Functor_p1, Functor_p2>::operator()(const int population, const int generation) const{
254  if(generation >= inflection_point+generation_shift){ return p2(population, generation-generation_shift) ; }
255  return p1(population, generation-generation_shift);
256 };
257 /* ----- end piecewise parameter model ----- */
258 /* ----- end of inbreeding, mutation, & dominance models models ----- */
259 
280 /* ----- demography models ----- */
281 /* ----- constant demography model ----- */
284 __host__ __device__ __forceinline__ int demography_constant::operator()(const int population, const int generation) const{ return N; }
285 /* ----- end constant demography model ----- */
286 
287 /* ----- seasonal demography model ----- */
288 inline demography_sine_wave::demography_sine_wave() : A(0), pi(0), rho(0), D(0), generation_shift(0) {}
289 inline demography_sine_wave::demography_sine_wave(float A, float pi, int D, float rho /*= 0*/, int generation_shift /*= 0*/) : A(A), pi(pi), rho(rho), D(D), generation_shift(generation_shift) {}
291 __host__ __device__ __forceinline__ int demography_sine_wave::operator()(const int population, const int generation) const{ return (int)A*sin(pi*(generation-generation_shift) + rho) + D;}
292 /* ----- end seasonal parameter model ----- */
293 
294 /* ----- exponential growth model ----- */
295 inline demography_exponential_growth::demography_exponential_growth() : rate(0), initial_population_size(0), generation_shift(0) {}
297 inline demography_exponential_growth::demography_exponential_growth(float rate, int initial_population_size, int generation_shift /*= 0*/) : rate(rate), initial_population_size(initial_population_size), generation_shift(generation_shift) {}
299 __host__ __device__ __forceinline__ int demography_exponential_growth::operator()(const int population, const int generation) const{ return (int)round(initial_population_size*exp(rate*(generation-generation_shift))); }
300 /* ----- end exponential growth model ----- */
301 
302 /* ----- logistic growth model ----- */
304 inline demography_logistic_growth::demography_logistic_growth(float rate, int initial_population_size, int carrying_capacity, int generation_shift /*= 0*/) : rate(rate), initial_population_size(initial_population_size), carrying_capacity(carrying_capacity), generation_shift(generation_shift) {}
307 __host__ __device__ __forceinline__ int demography_logistic_growth::operator()(const int population, const int generation) const{
308  float term = exp(rate*(generation-generation_shift));
310 }
311 /* ----- end logistic growth model ----- */
312 
313 /* ----- population specific demography model ----- */
344 template <typename Functor_d, typename Functor_d_pop>
347 template <typename Functor_d, typename Functor_d_pop>
348 inline demography_population_specific<Functor_d,Functor_d_pop>::demography_population_specific(Functor_d d_in, Functor_d_pop d_pop_in, int pop, int generation_shift /*= 0*/) : pop(pop), generation_shift(generation_shift){ d = d_in; d_pop = d_pop_in; }
351 template <typename Functor_d, typename Functor_d_pop>
352 __host__ __device__ __forceinline__ int demography_population_specific<Functor_d,Functor_d_pop>::operator()(const int population, const int generation) const{
353  if(pop == population) return d_pop(population, generation-generation_shift);
354  return d(population, generation-generation_shift);
355 }
356 /* ----- end population specific demography model ----- */
357 
358 /* ----- piecewise demography model ----- */
389 template <typename Functor_d1, typename Functor_d2>
390 inline demography_piecewise<Functor_d1, Functor_d2>::demography_piecewise() : inflection_point(0), generation_shift(0) { d1 = Functor_d1(); d2 = Functor_d2(); }
392 template <typename Functor_d1, typename Functor_d2>
393 inline demography_piecewise<Functor_d1, Functor_d2>::demography_piecewise(Functor_d1 d1_in, Functor_d2 d2_in, int inflection_point, int generation_shift /* = 0*/) : inflection_point(inflection_point), generation_shift(generation_shift) { d1 = d1_in; d2 = d2_in; }
396 template <typename Functor_d1, typename Functor_d2>
397 __host__ __device__ __forceinline__ int demography_piecewise<Functor_d1, Functor_d2>::operator()(const int population, const int generation) const{
398  if(generation >= inflection_point+generation_shift){ return d2(population, generation-generation_shift) ; }
399  return d1(population, generation-generation_shift);
400 };
401 /* ----- end piecewise demography model ----- */
402 /* ----- end of demography models ----- */
403 
425 /* ----- migration models ----- */
426 /* ----- constant equal migration model ----- */
428 inline migration_constant_equal::migration_constant_equal(float m, int num_pop) : m(m), num_pop(max(num_pop,1)){ }
432 __host__ __device__ __forceinline__ float migration_constant_equal::operator()(const int pop_FROM, const int pop_TO, const int generation) const{
433  if(pop_FROM == pop_TO){ return 1-(num_pop-1)*m; }
434  return (num_pop > 1) * m;
435 }
436 /* ----- end constant equal migration model ----- */
437 
438 /* ----- constant directional migration model ----- */
468 template <typename Functor_m1>
469 inline migration_constant_directional<Functor_m1>::migration_constant_directional() : m(0), pop1(0), pop2(0) { rest = Functor_m1(); }
470 template <typename Functor_m1>
471 inline migration_constant_directional<Functor_m1>::migration_constant_directional(float m, int pop1, int pop2, Functor_m1 rest_in) : m(m), pop1(pop1), pop2(pop2) { rest = rest_in; }
475 template <typename Functor_m1>
476 __host__ __device__ __forceinline__ float migration_constant_directional<Functor_m1>::operator()(const int pop_FROM, const int pop_TO, const int generation) const{
477  if(pop_FROM == pop1 && pop_TO == pop2) return m;
478  return rest(pop_FROM, pop_TO, generation);
479 }
480 /* ----- end constant directional migration model ----- */
481 
482 /* ----- piecewise migration model ----- */
513 template <typename Functor_m1, typename Functor_m2>
514 inline migration_piecewise<Functor_m1,Functor_m2>::migration_piecewise() : inflection_point(0), generation_shift(0) { m1 = Functor_m1(); m2 = Functor_m2(); }
516 template <typename Functor_m1, typename Functor_m2>
517 inline migration_piecewise<Functor_m1,Functor_m2>::migration_piecewise(Functor_m1 m1_in, Functor_m2 m2_in, int inflection_point, int generation_shift /*= 0*/) : inflection_point(inflection_point), generation_shift(generation_shift) { m1 = m1_in; m2 = m2_in; }
520 template <typename Functor_m1, typename Functor_m2>
521 __host__ __device__ __forceinline__ float migration_piecewise<Functor_m1,Functor_m2>::operator()(const int pop_FROM, const int pop_TO, const int generation) const{
522  if(generation >= inflection_point+generation_shift){ return m2(pop_FROM,pop_TO,generation-generation_shift); }
523  return m1(pop_FROM,pop_TO,generation-generation_shift);
524 }
525 /* ----- end piecewise migration model ----- */
526 /* ----- end of migration models ----- */
527 
549 /* ----- preserving & sampling functions ----- */
550 /* ----- bool off ----- */
551 __host__ __forceinline__ bool bool_off::operator()(const int generation) const{ return false; }
552 /* ----- end bool off ----- */
553 
554 /* ----- bool on ----- */
555 __host__ __forceinline__ bool bool_on::operator()(const int generation) const{ return true; }
556 /* ----- end bool on ----- */
557 
558 /* ----- bool pulse_array ----- */
559 /* will switch to variadic templates/initializer lists when switching to C++11
560 bool_pulse_array::bool_pulse_array(): num_generations(0), generation_start(0) { array = NULL; }
561 bool_pulse_array::bool_pulse_array(const bool default_return, const int generation_start, const int num_generations, int generation_pulse...): num_generations(num_generations), generation_start(generation_start) {
562  array = new bool[num_generations];
563  memset(&array, default_return, num_generations*sizeof(bool));
564  array[generation_pulse-generation_start] = !default_return;
565 }
566 __host__ __forceinline__ bool bool_pulse_array::operator()(const int generation) const {
567  int gen = generation - generation_start;
568  if((gen < 0) | (gen > num_generations)){ fprintf(stderr,"do_array functor generation error,\t generation %d\t shifted generation %d\t array length %d\n",generation,gen,num_generations); exit(1); }
569  return array[gen];
570 }
571 bool_pulse_array::~bool_pulse_array(){ delete [] array; array = NULL; }*/
572 /* ----- end on_off_array ----- */
573 
574 /* ----- bool pulse ----- */
596 template <typename Functor_default, typename Functor_action>
597 inline bool_pulse<Functor_default,Functor_action>::bool_pulse() : pulse(0), generation_shift(0) { f_default = Functor_default(); f_action = Functor_action(); }
601 template <typename Functor_default, typename Functor_action>
602 inline bool_pulse<Functor_default,Functor_action>::bool_pulse(int pulse, int generation_shift/*= 0*/) : pulse(pulse), generation_shift(generation_shift) { f_default = Functor_default(); f_action = Functor_action(); }
604 template <typename Functor_default, typename Functor_action>
605 inline bool_pulse<Functor_default,Functor_action>::bool_pulse(Functor_default f_default_in, Functor_action f_action_in, int pulse, int generation_shift/*= 0*/) : pulse(pulse), generation_shift(generation_shift) { f_default = f_default_in; f_action = f_action_in; }
609 template <typename Functor_default, typename Functor_action>
610 __host__ __forceinline__ bool bool_pulse<Functor_default,Functor_action>::operator()(const int generation) const{ if(generation == pulse + generation_shift){ return f_action(generation); } return f_default(generation); }
611 /* ----- end bool pulse ----- */
612 
613 /* ----- bool piecewise ----- */
635 template <typename Functor_first, typename Functor_second>
636 inline bool_piecewise<Functor_first,Functor_second>::bool_piecewise() : inflection_point(0), generation_shift(0) { f1 = Functor_first(); f2 = Functor_second(); }
640 template <typename Functor_first, typename Functor_second>
641 inline bool_piecewise<Functor_first,Functor_second>::bool_piecewise(int inflection_point, int generation_shift /*= 0*/) : inflection_point(inflection_point), generation_shift(generation_shift) { f1 = Functor_first(); f2 = Functor_second(); }
643 template <typename Functor_first, typename Functor_second>
644 inline bool_piecewise<Functor_first,Functor_second>::bool_piecewise(Functor_first f1_in, Functor_second f2_in, int inflection_point, int generation_shift /*= 0*/) : inflection_point(inflection_point), generation_shift(generation_shift) { f1 = f1_in; f2 = f2_in; }
648 template <typename Functor_first, typename Functor_second>
649 __host__ __forceinline__ bool bool_piecewise<Functor_first,Functor_second>::operator()(const int generation) const{ if(generation >= inflection_point+generation_shift){ return f2(generation); } return f1(generation); }
650 /* ----- end bool piecewise ----- */
651 /* ----- end of preserving & sampling functions ----- */
652 
653 }/* ----- end namespace Sim_Model ----- */
654 
655 #endif /* TEMPLATE_INLINE_SIMULATION_FUNCTORS_CUH_ */
int initial_population_size
initial population size
Definition: go_fish.cuh:180
int num_pop
number of population participating in equal migration
Definition: go_fish.cuh:235
int N
population size (individuals) constant
Definition: go_fish.cuh:156
Functor_m2 m2
second migration function
Definition: go_fish.cuh:261
__host__ __device__ __forceinline__ int operator()(const int population, const int generation) const
Demographic operator, returns population size (individuals), N, for a given population, generation
float D
Offset of sine wave.
Definition: go_fish.cuh:60
float rate
logistic growth rate
Definition: go_fish.cuh:191
float m
migration rate from pop i to pop j =/= i
Definition: go_fish.cuh:234
int inflection_point
generation in which the Demographic function switches from d1 to d2
Definition: go_fish.cuh:218
float pi
Frequency of sine wave.
Definition: go_fish.cuh:166
float A
Amplitude of sine wave.
Definition: go_fish.cuh:112
__host__ __device__ __forceinline__ int operator()(const int population, const int generation) const
Demographic operator, returns population size (individuals), N, for a given population, generation
__host__ __device__ __forceinline__ int operator()(const int population, const int generation) const
Demographic operator, returns population size (individuals), N, for a given population, generation
int generation_shift
number of generations to shift function backwards
Definition: go_fish.cuh:313
__host__ __device__ __forceinline__ float operator()(const int pop_FROM, const int pop_TO, const int generation) const
Migration operator, returns migration rate, mig_rate, which is the proportion of chromosomes in pop_T...
float A
Amplitude of sine wave.
Definition: go_fish.cuh:57
float rho
Phase of sine wave.
Definition: go_fish.cuh:59
__host__ __forceinline__ bool operator()(const int generation) const
Preserving and Sampling operator, returns boolean b to turn on/off preserving and sampling in generat...
Functor_sel_pop s_pop
population specific selection function for pop
Definition: go_fish.cuh:77
int generation_shift
number of generations to shift function backwards
Definition: go_fish.cuh:61
__host__ __device__ __forceinline__ int operator()(const int population, const int generation) const
Demographic operator, returns population size (individuals), N, for a given population, generation
float pi
Frequency of sine wave.
Definition: go_fish.cuh:113
int pop
population with specific demography function
Definition: go_fish.cuh:205
Namespace of functions for controlling GO_Fish simulations.
Definition: go_fish.cuh:26
__device__ __forceinline__ float operator()(const int population, const int generation, const float freq) const
selection operator, returns selection coefficient, s, for a given population, generation, freq
Functor_sel s
selection function applied to all other populations
Definition: go_fish.cuh:76
float p
parameter constant
Definition: go_fish.cuh:103
__device__ __forceinline__ float operator()(const int population, const int generation, const float freq) const
selection operator, returns selection coefficient, s, for a given population, generation, freq
int generation_shift
number of generations to shift function backwards
Definition: go_fish.cuh:300
__host__ __forceinline__ float operator()(const int population, const int generation) const
Inbreeding/Mutation/Dominance operator, returns parameter p for a given population, generation
float D
Offset of sine wave.
Definition: go_fish.cuh:115
Functor_d2 d2
second demographic function
Definition: go_fish.cuh:221
Functor_d1 d1
first demographic function
Definition: go_fish.cuh:220
float slope
slope of selection coefficient&#39;s linear dependence on frequency
Definition: go_fish.cuh:45
Functor_d d
demographic function applied to all other populations
Definition: go_fish.cuh:207
int generation_shift
number of generations to shift function backwards
Definition: go_fish.cuh:206
Functor_p1 p1
first parameter function
Definition: go_fish.cuh:142
int inflection_point
generation in which the migration function switches from m1 to m2
Definition: go_fish.cuh:258
int generation_shift
number of generations to shift function backwards
Definition: go_fish.cuh:259
__host__ __forceinline__ float operator()(const int population, const int generation) const
Inbreeding/Mutation/Dominance operator, returns parameter p for a given population, generation
int generation_shift
number of generations to shift function backwards
Definition: go_fish.cuh:116
__host__ __forceinline__ float operator()(const int population, const int generation) const
Inbreeding/Mutation/Dominance operator, returns parameter p for a given population, generation
int generation_shift
number of generations to shift function backwards
Definition: go_fish.cuh:194
int pulse
generation in which the boolean pulse f_action is emitted
Definition: go_fish.cuh:299
int inflection_point
generation in which the boolean function switches from f1 to f2
Definition: go_fish.cuh:312
float A
Amplitude of sine wave.
Definition: go_fish.cuh:165
Functor_m1 rest
migration function specifying migration in remaining migration directions
Definition: go_fish.cuh:248
__device__ __forceinline__ float operator()(const int population, const int generation, const float freq) const
selection operator, returns selection coefficient, s, for a given population, generation, freq
Functor_p p
parameter function applied to all other populations
Definition: go_fish.cuh:129
Functor_d_pop d_pop
population specific demographic function for pop
Definition: go_fish.cuh:208
__host__ __device__ __forceinline__ float operator()(const int pop_FROM, const int pop_TO, const int generation) const
Migration operator, returns migration rate, mig_rate, which is the proportion of chromosomes in pop_T...
int generation_shift
number of generations to shift function backwards
Definition: go_fish.cuh:88
int inflection_point
generation in which the selection function switches from s1 to s2
Definition: go_fish.cuh:87
Functor_m1 m1
first migration function
Definition: go_fish.cuh:260
Functor_sel1 s1
first selection function
Definition: go_fish.cuh:89
float m
migration rate from pop1 to pop2
Definition: go_fish.cuh:245
__host__ __forceinline__ bool operator()(const int generation) const
Preserving and Sampling operator, returns boolean b to turn on/off preserving and sampling in generat...
Functor_p2 p2
second parameter function
Definition: go_fish.cuh:143
float D
Offset of sine wave.
Definition: go_fish.cuh:168
int generation_shift
number of generations to shift function backwards
Definition: go_fish.cuh:181
int generation_shift
number of generations to shift function backwards
Definition: go_fish.cuh:128
Functor_second f2
second boolean function
Definition: go_fish.cuh:315
float rho
Phase of sine wave.
Definition: go_fish.cuh:114
int generation_shift
number of generations to shift function backwards
Definition: go_fish.cuh:169
float pi
Frequency of sine wave.
Definition: go_fish.cuh:58
float intercept
selection coefficient&#39;s intercept with frequency 0
Definition: go_fish.cuh:46
int generation_shift
number of generations to shift function backwards
Definition: go_fish.cuh:141
Functor_sel2 s2
second selection function
Definition: go_fish.cuh:90
__host__ __device__ __forceinline__ int operator()(const int population, const int generation) const
Functor_first f1
first boolean function
Definition: go_fish.cuh:314
Functor_p_pop p_pop
population specific parameter function for pop
Definition: go_fish.cuh:130
__host__ __device__ __forceinline__ float operator()(const int pop_FROM, const int pop_TO, const int generation) const
Migration operator, returns migration rate, mig_rate, which is the proportion of chromosomes in pop_T...
int inflection_point
generation in which the Inbreeding/Mutation/Dominance function switches from p1 to p2 ...
Definition: go_fish.cuh:140
float rate
exponential growth rate
Definition: go_fish.cuh:179
float rho
Phase of sine wave.
Definition: go_fish.cuh:167
__host__ __forceinline__ float operator()(const int population, const int generation) const
Inbreeding/Mutation/Dominance operator, returns parameter p for a given population, generation
int pop
population with specific selection function
Definition: go_fish.cuh:74
int carrying_capacity
carrying capacity
Definition: go_fish.cuh:193
Functor_default f_default
default boolean function
Definition: go_fish.cuh:301
int initial_population_size
initial population size
Definition: go_fish.cuh:192
__device__ __forceinline__ float operator()(const int population, const int generation, const float freq) const
selection operator, returns selection coefficient, s, for a given population, generation, freq
Functor_action f_action
boolean function emitted at generation pulse
Definition: go_fish.cuh:302
int generation_shift
number of generations to shift function backwards
Definition: go_fish.cuh:219
__host__ __forceinline__ bool operator()(const int generation) const
Preserving and Sampling operator, returns boolean b to turn on/off preserving and sampling in generat...
float s
selection coefficient
Definition: go_fish.cuh:34
__host__ __forceinline__ bool operator()(const int generation) const
Preserving and Sampling operator, returns boolean b to turn on/off preserving and sampling in generat...
int generation_shift
number of generations to shift function backwards
Definition: go_fish.cuh:75
int pop
population with specific parameter function
Definition: go_fish.cuh:127
__host__ __device__ __forceinline__ int operator()(const int population, const int generation) const
Demographic operator, returns population size (individuals), N, for a given population, generation
__device__ __forceinline__ float operator()(const int population, const int generation, const float freq) const
selection operator, returns selection coefficient, s, for a given population, generation, freq