From e6be06cd57ba8a8821c74f2c30e0f08937cb447c Mon Sep 17 00:00:00 2001 From: Matt Brown Date: Wed, 16 Nov 2022 13:08:56 +0000 Subject: [PATCH] Minimise p(I=2|z=0) term a little more Further factors n20 term which should be marginally faster. --- kin.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kin.cpp b/kin.cpp index 8de531a..5f65dda 100644 --- a/kin.cpp +++ b/kin.cpp @@ -112,7 +112,7 @@ void Kinship::addGenotypes(int *gt_arr, float p) _n11 += 2 * p * q; ///2ppq + 2qqp = 2pq(p+q) = 2pq == Hij _n10 += 4 * p * q * (p * p + q * q); ///4pppq + 4qqqp = 4pq(pp + qq) - _n20 += p * p * p * p + q * q * q * q + 4 * q * q * p * p; ///pppp + qqqq + 4ppqq + _n20 += p * p * p * p + q * q * q + 2 * p * q; /// p^4 + q^4 + 4p^2q^2 = p^4 + q^4 + 2pq^2 + 2qp^2 = p^4 + q^4 + 2pq(p+q) = p^4 + q^4 + 2pq _n21 += p * p + q * q; ///ppp + qqq + ppq + pqq = pp(p+q) + qq(q+p) = pp + qq _n22 += 1; _af.push_back(p);