/*///////////////////////////////////////////////////////////////*/ KScalar stats_mean_fitness_outcross_progeny_n (KConfig_n KN) /* ** Compute mean fitness of outcross progeny */ { const char* thisfunction = "stats_mean_fitness_outcross_progeny_n"; KScalar wmean; IF_DEBUG(DEBUG_TRACE1) fprintf(stderr, "%s\n", thisfunction); if (KN->O == 0.0) { IF_DEBUG(DEBUG_TRACE1) fprintf(stderr, "%s: O==0.0, outcross wmean=0.0\n", thisfunction); wmean = 0.0; } else { //void* a = alloc_KArray_n(); //void* vm = alloc_KVector_n(); //void* vf = alloc_KVector_n(); KVector_n vm; KVector_n vf; apply_gametes_n(KN, vm, vf, KN->x1); { KArray_n a; apply_zygotes_n(KN, a, vm, vf); wmean = mean_fitness_n(KN, a); } //free_KVector_n(vf); //free_KVector_n(vm); //free_KArray_n(a); } return wmean; }
/*///////////////////////////////////////////////////////////////*/ void compute_gametes_n (KConfig_n KN) /* ** Compute genotype proportions for male and female gametes. */ { const char* thisfunction = "compute_gametes_n"; IF_DEBUG(DEBUG_TRACE1) fprintf(stderr, "%s\n", thisfunction); if (KN->current_x != KN_CURRENT_PROGENY_TO_X1 && KN->current_x != KN_CURRENT_X2) { char buf[200]; sprintf(buf, "%s: wrong current x array = %d", thisfunction, KN->current_x); fatal(buf); } if (KN->current_x == KN_CURRENT_X2) { /* we're the first reproduction function to get ** called, so we have to zero the destination array, ** which is KN->x1 */ fill_KArray_n(KN, KN->x1, 0.0); } apply_gametes_n(KN, KN->mgam, KN->fgam, KN->x2); KN->current_x = KN_CURRENT_GAMETES_X2_TO_X1; }