/*///////////////////////////////////////////////////////////////*/ void apply_selection_n (KConfig_n KN, KArray_n& to, KArray_n& from) /* ** 'to' is correct upon exit. */ { const char* thisfunction = "apply_selection_n"; KInt i0, j0, i1, j1; KScalar recip_w_mean; IF_DEBUG(DEBUG_TRACE1) fprintf(stderr, "%s\n", thisfunction); recip_w_mean = 1.0 / mean_fitness_allprogeny_n(KN, from); for (i0=0; i0 <= KN->MI0; i0++) { for (j0=0; j0 <= KN->MJ0; j0++) { for (i1=0; i1 <= KN->MI1; i1++) { for (j1=0; j1 <= KN->MJ1; j1++) { IF_DEBUG(DEBUG_TRACE2) if (!(i0 % 10) && !(j0 % 10) && !(i1 % 10) && !(j1 % 10)) fprintf(stderr, "sel[%d,%d,%d,%d] ", i0, j0, i1, j1); to[i0][j0][i1][j1] = from[i0][j0][i1][j1] * fitness_n(KN,i0,j0,i1,j1) * recip_w_mean; } } } } IF_DEBUG(DEBUG_TRACE2) fprintf(stderr, "\n"); check_normalization_n(KN, to, thisfunction, "to"); }
/*///////////////////////////////////////////////////////////////*/ void apply_summed_progeny_n (KConfig_n KN, KArray_n& to, KArray_n& from) { const char* thisfunction = "apply_summed_progeny_n"; /* nothing to do, all this has been done already by each ** reproduction operation, which added new progeny ** proportions to KN->x1 */ check_normalization_n(KN, to, thisfunction, "to"); }
/*///////////////////////////////////////////////////////////////*/ void apply_adults_initial_n (KConfig_n KN, KArray_n& a) /* ** Initiate adult frequencies */ { const char* thisfunction = "apply_adults_initial_n"; IF_DEBUG(DEBUG_TRACE1) fprintf(stderr, "%s\n", thisfunction); fill_KArray_n(KN, a, 0.0); a[0][0][0][0] = 1.0; check_normalization_n(KN, a, thisfunction, "a"); }