Example #1
0
/*///////////////////////////////////////////////////////////////*/
KScalar     stats_mean_fitness_apomixis_progeny_n (KConfig_n KN)
/*
** Compute mean fitness of apomixis progeny
*/
{
    const char* thisfunction = "stats_mean_fitness_apomixis_progeny_n";
    KScalar wmean;
    IF_DEBUG(DEBUG_TRACE1) fprintf(stderr, "%s\n", thisfunction);
    if (KN->A == 0.0) {
        IF_DEBUG(DEBUG_TRACE1) fprintf(stderr, "%s: A==0.0, apomict wmean=0.0\n", 
                                      thisfunction);
        wmean = 0.0;
    } else {
        //void* a = alloc_KArray_n();
        KArray_n a;
        apply_apomixis_progeny_n(KN, a, KN->x1);
        wmean = mean_fitness_n(KN, a);
        //free_KArray_n(a);
    }
    return wmean;
}
Example #2
0
/*///////////////////////////////////////////////////////////////*/
void        compute_apomixis_progeny_n  (KConfig_n KN)
/*
** Compute proportions of apomixis genotypes produced by population.
*/
{
    const char* thisfunction = "compute_apomixis_progeny_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_apomixis_progeny_n(KN, KN->x1, KN->x2);
    KN->current_x = KN_CURRENT_PROGENY_TO_X1;
}