[R] 64 bit version for linux and build huge matrix

Nordlund, Dan (DSHS/RDA) NordlDJ at dshs.wa.gov
Thu Mar 15 21:43:06 CET 2012


> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of Rich Shepard
> Sent: Thursday, March 15, 2012 1:19 PM
> To: r-help
> Subject: Re: [R] 64 bit version for linux and build huge matrix
> 
> On Fri, 16 Mar 2012, Shengyun Peng wrote:
> 
> > I downloaded R from http://cran.cnr.berkeley.edu/, with the linux
> version.
> > But after compile, I don't know how to start 64 bit R, as there is
> only
> > one R executable under bin folder, not alike windows version which
> have
> > two executables.
> 
>    If your system has a 64-bit version of the distribution installed
> then
> that's how applications are built. You start it by typing 'R' (without
> the
> quotes) on the command line. Linux is not Microsoft.
> 
> > Other than that, I want to build a matrix 65536 rows by 65536
> columns, but
> > the system tells me: Error in matrix(0, 65536, 65536) : too many
> elements
> > specified. So, I want to know if there's anything I can do to achieve
> that
> > and that's one reason I need 64 bit R.
> 
>    How much memory do you have installed?
> 
> Rich
> 

The problem is not the amount of memory, it is the number of elements you are trying to put in the matrix (as the error message states).  A matrix is just a vector with a dimension attribute.  The maximum length of a vector or a list is 2^31-1.  You are trying to put twice that many elements in the matrix.  It is not going to happen regardless of the amount of memory available.  You will need to solve your problem in some other way.  If your matrix is sparse, you may be able to use techniques for manipulating sparse matrices.

Hope this is helpful,

Dan

Daniel J. Nordlund
Washington State Department of Social and Health Services
Planning, Performance, and Accountability
Research and Data Analysis Division
Olympia, WA 98504-5204



More information about the R-help mailing list