[SciPy-user] sparse matrix dtype

Stefan van der Walt stefan@sun.ac...
Tue Oct 9 14:41:18 CDT 2007


On Tue, Oct 09, 2007 at 03:03:20PM +0100, Robin wrote:
> 
> On 10/9/07, Robin <robince@gmail.com> wrote:
> 
>     I am trying to make a large sparse matrix - the values are all integers (in
>     fact all non-zeros will be 1) so it would save me a lot of memory if I
>     could use dtype=byte.
> 
> 
> I added 'b' to the string of allowed dtypes in  getdtype() on line  2791 of
> sparse.py.
> 
> It now seems to behave as I would expect (hope), but it can't be that simple
> can it?
> 
> Is it likely that doing this will break something else? Why are the dtypes
> restricted in the first place.

Like I mentioned before, this is on the TODO list:

http://projects.scipy.org/scipy/scipy/ticket/225

For most situations, changing the line you did should work.  I haven't
looked into what effect it will have on the routines implemented in
C++.

Stéfan


More information about the SciPy-user mailing list