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

SimpleMPS algorithm breaks due to integer overflow of cell coordinates #2

Open
drlight-code opened this issue Oct 30, 2024 · 2 comments

Comments

@drlight-code
Copy link

drlight-code commented Oct 30, 2024

The current SimpleMPS code creates points that lie out of the expected bounding box, i.e. outside the grid coordinates. Particularly if I check all generated points for x > 0 the assertion fails, but only very randomly. I didn't debug further, but if I switch to the commented code with pool updates as defined here https://github.com/sandialabs/DeterministicMPS/blob/main/source/SimpleMPS.cpp#L124-L143 the problem vanishes.

@drlight-code drlight-code changed the title Version without pool updates generates erronous points Algorithm generates points outside of domain Nov 1, 2024
@drlight-code
Copy link
Author

The problem also crops up when using the version with pool updates, so it seems not directly related after all.

@drlight-code drlight-code changed the title Algorithm generates points outside of domain Algorithm generates points outside of domain due to integer overflow Nov 4, 2024
@drlight-code drlight-code changed the title Algorithm generates points outside of domain due to integer overflow SimpleMPS algorithm generates points outside of domain due to integer overflow Nov 4, 2024
@drlight-code
Copy link
Author

drlight-code commented Nov 4, 2024

I did the debugging, the problem occurs due to an integer overflow of the cell coordinates. It happens only very rarely for certain choices of random seeds, where a high number of refinements is necessary. When the error occurs here, I'm at refinement level 19. The problem appears in the refine method step when the cell coordinates are doubled https://github.com/sandialabs/DeterministicMPS/blob/main/source/SimpleMPS.cpp#L353-L354

Defining the cell coordinates as size_t instead of int fixes the issue for me https://github.com/sandialabs/DeterministicMPS/blob/main/source/SimpleMPS.hpp#L28

@drlight-code drlight-code changed the title SimpleMPS algorithm generates points outside of domain due to integer overflow SimpleMPS algorithm breaks due to integer overflow of cell coordinates Nov 4, 2024
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

1 participant