ActivitySim / activitysim

An Open Platform for Activity-Based Travel Modeling
https://activitysim.github.io
BSD 3-Clause "New" or "Revised" License
194 stars 99 forks source link

Large Matrices Result in Integer Overflow #285

Closed danielsclint closed 4 years ago

danielsclint commented 4 years ago

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

https://github.com/ActivitySim/activitysim/blob/7b57c94e12d27a23f86c8988117e885ae754c44e/activitysim/abm/tables/skims.py#L186-L194

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 commented 4 years ago

Fixed with PR #286.