XiaoGongWei / MG_APP

MG-APP (https://link.springer.com/article/10.1007/s10291-020-00976-1);
https://xiaogongwei10.blog.csdn.net/
95 stars 52 forks source link

assert out of range #8

Open LucaFibbi opened 4 years ago

LucaFibbi commented 4 years ago

The program is exit with an assert error. The code throw the assert to the line 549 of the file QPPPBackSmooth.cpp

    for(int i = forWard_epoch_len - 1; i >=0; i++)
    {
        last_fillter_X = last_allSolverX.at(i); // <------ the assert is throw here
        if(last_fillter_X[0] != 0)
        {
            last_fillter_X = last_allSolverX.at(i);
            last_fillter_Q = last_allSolverQ.at(i);
            break;
        }
    }

The i variable in for cycle is increased for error. The possible correct code is:

    for(int i = forWard_epoch_len - 1; i >=0; i--)
    {
        if(last_allSolverX.at(i)[0] != 0)
        {
            last_fillter_X = last_allSolverX.at(i);
            last_fillter_Q = last_allSolverQ.at(i);
            break;
        }
    }
XiaoGongWei commented 4 years ago

Thank you for submitting the bug. I have changed the code as shown below:
for(int i = forWard_epoch_len - 1; i >=0; i--) { last_fillter_X = last_allSolverX.at(i); if(last_fillter_X[0] != 0) { last_fillter_X = last_allSolverX.at(i); last_fillter_Q = last_allSolverQ.at(i); break; } }
If you would like to join this repository, please contact us me.