private void zeroSubtreeCoalCountsIntensities(PopsIONode node) { if (node.lft >= 0) { zeroSubtreeCoalCountsIntensities(pionodes[node.lft]); zeroSubtreeCoalCountsIntensities(pionodes[node.rgt]); } node.coalcount = 0; node.coalintensity = 0.0; }
private void accumSubtreeCoalCountsIntensities(PopsIONode node) { if (node.lft >= 0) { accumSubtreeCoalCountsIntensities(pionodes[node.lft]); accumSubtreeCoalCountsIntensities(pionodes[node.rgt]); } int k = node.coalheights.size(); node.coalcount += k; double[] t = new double[k + 2]; t[0] = node.height; for (int i = 0; i < k; i++) { t[i + 1] = node.coalheights.get(i); } t[k + 1] = (node.anc < 0) ? piosb.maxGeneTreeHeight() : pionodes[node.anc].height; int n = node.nlineages; for (int i = 0; i <= k; i++) { node.coalintensity += (t[i + 1] - t[i]) * 0.5 * (n - i) * (n - i - 1); } }