How to change numpy intc value from 32 to 64 bit

I ran into a problem with numpy intc datatype. I am running a 64-bit version of Linux on my machine. I need to create an instance of scipy.sparse.csr_matrix with indexes exceeding the 32 bit limit. For instance:

I created an instance of the csr matrix as follows:

matrix=csr_matrix((2, 4132009369),dtype=int8)

This is not a problem. Then, somewhere in the code, I will say:

matrix[0, 2401803431]=1

And I got it ValueError: column index values must be >= 0. I am debugging the code, and I found that somewhere in the csr_matrix scipy implementation, the column value is being converted to the numpy intc data type. To make sure this is a problem with intc, I checked with the following code:

>>> import numpy as np
>>> info=np.iinfo(np.intc)
>>> info.max
2147483647

2 ^ 31-1. , - , 32- intc 64- intc? http://docs.scipy.org/doc/numpy/user/basics.types.html ,

intc    Identical to C int (normally int32 or int64)

!

+4
1

, scipy ( 1.3, 1.4)

+1

Source: https://habr.com/ru/post/1570287/


All Articles