예제 #1
0
/*///////////////////////////////////////////////////////////////*/
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;
}
예제 #2
0
/*///////////////////////////////////////////////////////////////*/
void        compute_zygotes_n   (KConfig_n KN)
/*
** Compute proportion of outcrossed zygotes produced by population.
*/
{
    const char* thisfunction = "compute_zygotes_n";
    /* Combines proportions of male and female gametes into
	** expected genotypic classes.  Note that all classes 
	** L(,j>0) = 0.
	*/
    IF_DEBUG(DEBUG_TRACE1) fprintf(stderr, "%s\n", thisfunction);
    if (KN->current_x != KN_CURRENT_GAMETES_X2_TO_X1) {
        char buf[200];
        sprintf(buf, "%s: wrong current x array = %d",
                thisfunction, KN->current_x);
        fatal(buf);
    }
    apply_zygotes_n(KN, KN->x1, KN->mgam, KN->fgam);
    KN->current_x = KN_CURRENT_PROGENY_TO_X1;
}