[SciPy-user] [Sparse matrix library] csr_matrix and datatypes

Dinesh B Vadhia dineshbvadhia@hotmail....
Tue Apr 29 09:16:10 CDT 2008


For reference, the column index for each non-zero is a 4 byte integer.  A int8 is an additional 1 byte (ie. total 4+1=5 bytes), an int16 is 2 bytes (4+2=6 bytes).  And, how much is an int32 - another 2 bytes?



--------------------------------------------------------------------------------
Date: Mon, 28 Apr 2008 11:30:42 -0500
From: "Nathan Bell" <wnbell@gmail.com>
Subject: Re: [SciPy-user] [Sparse matrix library] csr_matrix and
To: "SciPy Users List" <scipy-user@scipy.org>
Message-ID:
<d05265cb0804280930g64ade00cmf190ee60bf0ed447@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

On Mon, Apr 28, 2008 at 10:57 AM, Dinesh B Vadhia
<dineshbvadhia@hotmail.com> wrote:
>
>
> Okay, I see what is going on.  Uhmmm!  If I replace int8 with int16 or int32
> then this will increase the size of A in memory which will defeat the
> purpose of the original exercise to minimize the size of A (as they are very
> large).  Unless there is a way to coerce the calculation A.sum(0) into a
> int16 then looks like I'll have to evaluate A.sum(0) in brute force fashion
> at the time of A's creation, save it and read it into the program at
> execution.

It's the difference between roughly 5 bytes per nonzero and 6 bytes
per nonzero.  The column index for each nonzero is a 4 byte integer,
so there's little difference in the total memory cost (4+1 vs. 4+2).

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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/scipy-user/attachments/20080429/a724911e/attachment.html 


More information about the SciPy-user mailing list