Reputation: 149
I'm facing a problem with numpy's intc datatype. I'm running a Linux 64 bit on my machine. I need to instantiate a scipy.sparse.csr_matrix with indexes beyond the 32 bit limit. For instance:
I have instantiated a csr matrix like that:
matrix=csr_matrix((2, 4132009369),dtype=int8)
This gaves me no problem. Then, somewhere in the code I do, let's say:
matrix[0, 2401803431]=1
And I got ValueError: column index values must be >= 0
. I debug the code and I discovered that somewhere in the scipy's implementation of csr_matrix the column value is converted to a numpy's intc datatype.
To ensure it is an intc problem I checked with the following code:
>>> import numpy as np
>>> info=np.iinfo(np.intc)
>>> info.max
2147483647
that value is 2^31-1. So, do you have any suggestion if there's a way to go from 32 bit intc to a 64 bit intc? In this page http://docs.scipy.org/doc/numpy/user/basics.types.html it says that
intc Identical to C int (normally int32 or int64)
Thank you very much for your time!
Upvotes: 4
Views: 873
Reputation: 149
I solved by upgrading scipy library to the latest version (previously I had 1.3, now 1.4)
Upvotes: 2