markovmodel / PyEMMA

🚂 Python API for Emma's Markov Model Algorithms 🚂
http://pyemma.org
GNU Lesser General Public License v3.0
307 stars 118 forks source link

_bar_df wrong for loop boundary #1523

Open MaaikeG opened 2 years ago

MaaikeG commented 2 years ago

In PyEMMA/pyemma/thermo/extensions/bar/_bar.c

The second for loop should run from 0 to L2, not L1. Current implementation gives an access violation whenever L1 > L2



extern double _bar_df(double *db_IJ, int L1, double *db_JI, int L2, double *scratch)
{
    int i;
    double ln_avg1;
    double ln_avg2; 
    for (i=0; i<L1; i++)
    {
        scratch[i] = db_IJ[i]>0 ? 0 : db_IJ[i];
    }
    ln_avg1 = _logsumexp_sort_kahan_inplace(scratch, L1);
    for (i=0; i<L1; i++)
    {
        scratch[i] = db_JI[i]>0 ? 0 : db_JI[i];
    }
    ln_avg2 = _logsumexp_sort_kahan_inplace(scratch, L2);
    return ln_avg2 - ln_avg1;
}```
clonker commented 2 years ago

Ouch :) To be fair I think we should just wait until deeptime-ml/deeptime#168 is merged and then back-integrate here with the next deeptime release.

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.