Actually, I believe it's 8 bytes for double precision.
-roger
Berton Gunter wrote:
David:
In general, this is not a good question to ask, as one needs to go into the bowels of R to find an answer.
But note that 8000 x 8000 x 4 bytes for double precision = 256 mb. Now look at the code of outer(). Two vectors of this size are created = 512mb. Then copies of these must be created to be passed into pmin, I believe, as R passes by value. That's 1gb.
My guess is that "+", as an internal function, avoids the final doubling.
Corrections/clarifications by knowledgeable R experts cheerfully welcomed. I'm on thin ice here.
-- Bert Gunter
Genentech Non-Clinical Statistics
South San Francisco, CA
"The business of the statistician is to catalyze the scientific learning
process." - George E. P. Box
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Brahm, David
Sent: Wednesday, December 22, 2004 12:11 PM
To: [EMAIL PROTECTED]
Subject: [R] outer(-x, x, pmin) cannot allocate
R> x <- 0. + 1:8000 R> y <- outer(-x, x, pmin) Error: cannot allocate vector of size 1000000 Kb
Why does R need to allocate a gigabyte to create an 8000 x 8000 matrix?
It doesn't have any trouble with outer(-x, x, "+"). Thanks.
-- David Brahm ([EMAIL PROTECTED])
Version:
platform = i686-pc-linux-gnu
arch = i686
os = linux-gnu
system = i686, linux-gnu
status = major = 2
minor = 0.1
year = 2004
month = 11
day = 15
language = R
______________________________________________
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
______________________________________________ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
-- Roger D. Peng http://www.biostat.jhsph.edu/~rpeng/
______________________________________________ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
