From edc84fecbcd549c3ad2d78e32c916333915b9074 Mon Sep 17 00:00:00 2001 From: jordandouglas Date: Wed, 25 Sep 2024 11:44:28 +1200 Subject: [PATCH] correction to #1168 --- .../base/evolution/likelihood/BeagleTreeLikelihood.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/beast/base/evolution/likelihood/BeagleTreeLikelihood.java b/src/beast/base/evolution/likelihood/BeagleTreeLikelihood.java index 679f94d2..476ac696 100644 --- a/src/beast/base/evolution/likelihood/BeagleTreeLikelihood.java +++ b/src/beast/base/evolution/likelihood/BeagleTreeLikelihood.java @@ -959,11 +959,15 @@ private int traverse(Node node, int[] operatorNumber, boolean flip) { matrixUpdateIndices[eigenIndex][updateCount] = matrixBufferHelper.getOffsetIndex(nodeNum); if (substitutionModel.canReturnComplexDiagonalization()) { - for (int i = 0; i < this.categoryCount; i++) { + + int k = 0; + for (int i = 0; i < m_siteModel.getCategoryCount(); i++) { + if (i == invariantCategory) continue; final double jointBranchRate = m_siteModel.getRateForCategory(i, node) * branchRate; substitutionModel.getTransitionProbabilities(node, node.getParent().getHeight(), node.getHeight(), jointBranchRate, probabilities); //System.out.println(node.getNr() + " " + Arrays.toString(m_fProbabilities)); - System.arraycopy(probabilities, 0, matrices, m_nStateCount * m_nStateCount * i, m_nStateCount * m_nStateCount); + System.arraycopy(probabilities, 0, matrices, m_nStateCount * m_nStateCount * k, m_nStateCount * m_nStateCount); + k++; } int matrixIndex = matrixBufferHelper.getOffsetIndex(nodeNum); beagle.setTransitionMatrix(matrixIndex, matrices, 1);