[SciPy-dev] bug: indexing CSR matrix, 64bits

Robert Cimrman cimrman3 at ntc.zcu.cz
Mon May 12 05:11:45 EDT 2008


Hi Nathan,

Nathan Bell wrote:
> On Fri, May 9, 2008 at 4:46 AM, Robert Cimrman <cimrman3 at ntc.zcu.cz> wrote:
>> Hi,
>>
>> indexing by slices is broken on a 64 bit machine. On a 32 bit one, all
>> is ok. Is something missing in the INSTANTIATE_ALL macro in sparsetools.i?
>>
> 
> Robert, I can't reproduce your problem on my system (Ubuntu 8.04, Athlon 64):
> 
> $uname -a
> Linux droog 2.6.24-16-generic #1 SMP Thu Apr 10 12:47:45 UTC 2008
> x86_64 GNU/Linux

$ uname -a Linux uk709n03-kme 2.6.22-gentoo-r8 #1 SMP Fri Sep 7 09:38:53 
CEST 2007 x86_64 Intel(R) Xeon(R) CPU X5355 @ 2.66GHz GenuineIntel GNU/Linux

> Since your .indptr and .indices arrays are 32-bits, I doubt that the
> problem is with INSTANTIATE_ALL.  Currently sparsetools does not
> instantiate functions using 64-bit indices because it doubles the
> compilation time and it's not likely that anyone will have sparse
> matrices with dimensions >= 2**31 anytime soon.  OTOH I don't know
> what else it could be so please try the following:

Yep. I do not need 64 bit indices. I have also installed swig 1.3.34 to 
match your version.

However the problem persists and is really strange:

- I have created a small test script and it works

- in pdb, indexing with slices works too
(Pdb) mtx[slice(2290, 2845, None),slice(2290, 2845, None)]
<555x555 sparse matrix of type '<type 'numpy.float64'>'
         with 3313 stored elements in Compressed Sparse Row format>

- but not with the 'ir', 'ic'
(Pdb) ir
slice(2290, 2845, None)
(Pdb) mtx[ir,ic]
*** NotImplementedError: Wrong number of arguments for overloaded 
function 'get_csr_submatrix'.
   Possible C/C++ prototypes are: ...

So thanks for your suggestions, but I fear the bug might not be in 
scipy.sparse...

r.



More information about the SciPy-Dev mailing list