Exemplo n.º 1
0
// term of non-HW HMatrix
inline double term_ij(
        double Bp,
        double Bq,
        const PMF<Allele> &p,
        const PMF<Allele> &q,
        const BackFreq &hback,
        Allele const &i,
        Allele const &j)
{
    // NB in this term (i, j) is ordered

    double ret    = p.val(i) * q.val(j);
    if (Bq>0)       ret += Bq * p.val(i) * hback(j, i);
    if (Bp>0)       ret += Bp * q.val(j) * hback(i, j);
    if (Bp*Bq>0)    ret += Bp * Bq * hback.pOrdered(make_pair(i,j));
    return ret;
}