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

Nathan Bell wnbell@gmail....
Fri May 9 12:17:34 CDT 2008


On Fri, May 9, 2008 at 4:46 AM, Robert Cimrman <cimrman3@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


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:

1) do a completely fresh install of numpy/scipy (rm -rf build and rm
-rf /site-packages/scipy )
See if the problem still exists.


2) instantiate additional "long long" versions of the sparsetools functions:

First check that you have a recent SWIG:
$ swig -version
SWIG Version 1.3.34


Add the following after line 145 of sparsetools.i
DECLARE_INDEX_TYPE( long long )

http://projects.scipy.org/scipy/scipy/browser/trunk/scipy/sparse/sparsetools/sparsetools.i#L145

Then, for each line that looks like:
174 	%template(f_name)   f_name<int,signed char>;
175 	%template(f_name)   f_name<int,unsigned char>;
176 	%template(f_name)   f_name<int,short>;
.....
187 	%template(f_name)   f_name<int,npy_clongdouble_wrapper>;

add a long long version also, e.g.
          %template(f_name)   f_name<long long,signed char>;

http://projects.scipy.org/scipy/scipy/browser/trunk/scipy/sparse/sparsetools/sparsetools.i#L188

Lastly, regenerate the SWIG wrappers as described here:
http://projects.scipy.org/scipy/scipy/browser/trunk/scipy/sparse/sparsetools/README.txt

This will rule out the possible backend problems.


Also, can you tell me what your C compiler thinks sizeof(int) is?


-- 
Nathan Bell wnbell@gmail.com
http://graphics.cs.uiuc.edu/~wnbell/


More information about the Scipy-dev mailing list