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

Large Matrices Result in Integer Overflow #285

Closed
danielsclint opened this issue Dec 20, 2019 · 1 comment
Closed

Large Matrices Result in Integer Overflow #285

danielsclint opened this issue Dec 20, 2019 · 1 comment

Comments

@danielsclint
Copy link

I thought this problem was eradicated with PR #265. Unfortunately, with really large numbers, the issue still occurs.

omx_shape = skim_info['omx_shape']
skim_dtype = skim_info['dtype']
blocks = skim_info['blocks']
skim_data = []
for block_name, block_size in iteritems(blocks):
skims_shape = omx_shape + (block_size,)
block_buffer = skim_buffers[block_name]
assert len(block_buffer) == int(np.prod(skims_shape))

The issue is in the Numpy library np.prod() method. According to the documentation:

Arithmetic is modular when using integer types, and no error is raised on overflow.

>>> x = np.array([536870910, 536870910, 536870910, 536870910])
>>> np.prod(x)
16 # may vary
@danielsclint
Copy link
Author

Fixed with PR #286.

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