s-news
[Top] [All Lists]

Re: Creating a very large zero matrix without crashing the

To: "'Steve Su'" <s.su@qut.edu.au>
Subject: Re: Creating a very large zero matrix without crashing the
From: "Liaw, Andy" <andy_liaw@merck.com>
Date: Sun, 26 Jan 2003 16:03:02 -0500
Cc: s-news@lists.biostat.wustl.edu
How about some arithmetic?  A 10 million by 50 matrix has 500 million
elements.  To store such a matrix in double precision would be 8 bytes per
element, or 4 billion bytes (nearly 4GB).  Even storing in 4-byte integers
would take nearly 2Gb.

If the matrix is very sparse (i.e., very few non-zero elements), you can
store it in a sparse format; e.g., storing the locations (row & column) and
values of the non-zero elements.  That, of course, would require special
software for manipulation/computations.

I'm not aware of such special functions/modules for Splus, but Prof. Koenker
has created one for R, which can be found on CRAN.

HTH,
Andy

> -----Original Message-----
> From: Steve Su [mailto:s.su@qut.edu.au]
> Sent: Sunday, January 26, 2003 3:25 AM
> To: s-news@lists.biostat.wustl.edu
> Subject: [S] Creating a very large zero matrix without crashing the
> computer.
> 
> 
> Dear All,
> 
> The subject is probably self explanatory. I want to create at least 1
> million by 50 matrix, and then replace the zeros with 1's using some
> index before doing some adding and multiplying calculations. 
> 
> Is it possible to create such a matrix in Splus using a standard PC or
> UNIX? Are there any ways I can make the creation of this matrix very
> efficient and use very little memory?
> 
> Thanks in advance.
> 
> Steve. 
> 
> 
> 
> --------------------------------------------------------------------
> This message was distributed by s-news@lists.biostat.wustl.edu.  To
> unsubscribe send e-mail to s-news-request@lists.biostat.wustl.edu with
> the BODY of the message:  unsubscribe s-news
> 


------------------------------------------------------------------------------
Notice:  This e-mail message, together with any attachments, contains 
information of Merck & Co., Inc. (Whitehouse Station, New Jersey, USA) that may 
be confidential, proprietary copyrighted and/or legally privileged, and is 
intended solely for the use of the individual or entity named in this message.  
If you are not the intended recipient, and have received this message in error, 
please immediately return this by e-mail and then delete it.

==============================================================================


<Prev in Thread] Current Thread [Next in Thread>
  • Re: Creating a very large zero matrix without crashing the, Liaw, Andy <=