CompEvol / beast2

Bayesian Evolutionary Analysis by Sampling Trees
www.beast2.org
GNU Lesser General Public License v2.1
240 stars 84 forks source link

Indexing error thrown when running beagle on a substitution model with complex eigenvalues #1168

Closed jordandouglas closed 1 month ago

jordandouglas commented 1 month ago

The loop in this class currently says:

if (substitutionModel.canReturnComplexDiagonalization()) {
    for (int i = 0; i < m_siteModel.getCategoryCount(); i++) {
          ...

but it should say

if (substitutionModel.canReturnComplexDiagonalization()) {
    for (int i = 0; i < this.categoryCount; i++) {
       ...

because the invariant category counts as a category according to the site model, which will cause an indexing error on this class.

https://github.com/CompEvol/beast2/blob/master/src/beast/base/evolution/likelihood/BeagleTreeLikelihood.java

jordandouglas commented 1 month ago

After further testing, I realise that the invariant category index should be skipped, not the last category