[SciPy-User] strange error when creating csr_matrix

Pauli Virtanen pav at iki.fi
Tue Mar 31 12:35:31 EDT 2015


31.03.2015, 10:34, Rok Roskar kirjoitti:
> Hi Pauli, thanks for the idea. I think the arrays are int64 by default, so
> this doesn't seem make a difference:
> 
> In [23]: csr_matrix((vals.astype(np.int64), (np.zeros(10,dtype=np.int64),
> inds.astype(np.int64))), shape = (1, max_index+1))
> ---------------------------------------------------------------------------
> ValueError                                Traceback (most recent call last)
> 
> <snip>
> 
> ValueError: could not convert integer scalar
> 
> Does it work on your machine?

Turns out this is actually a bug:
https://github.com/scipy/scipy/pull/4678

csr_matrix constructor thinks 32-bit integers are enough, but this is
not the case.




More information about the SciPy-User mailing list