Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

minimum_error_simplification bug #5

Closed
lyudalev opened this issue Apr 28, 2022 · 1 comment
Closed

minimum_error_simplification bug #5

lyudalev opened this issue Apr 28, 2022 · 1 comment

Comments

@lyudalev
Copy link

predecessor = predecessors[predecessor][--ell];

The referenced line should be executed one time less. On the last iteration of the loop 'ell' becomes -1, which is a bug. As a workaround this line can be prefixed with something like 'if (i < l - 1)' or 'if (ell)' like below:

        curve_size_t ell = l;
        
        result.push_back(curve.back());
        curve_size_t predecessor = predecessors[curve.complexity() - 1][--ell];
        
        for (curve_size_t i = 0; i  < l; ++i) {
            result.push_back(curve[predecessor]);
            if (i < l - 1)  // or if (ell)
                predecessor = predecessors[predecessor][--ell];
        }
@derohde
Copy link
Owner

derohde commented Apr 29, 2022

Hi,

thanks for noticing! This is a really small bug, nevertheless I fixed it and issued a new version.

@derohde derohde closed this as completed Apr 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants