On Wed, 22 Dec 2004, Peter Dalgaard wrote:

"Brahm, David" <[EMAIL PROTECTED]> writes:

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.

Hmm, it does run the process size to over 5GB on systems that do not crash. An 8000x8000 matrix of doubles takes about 0.5 GB, and the way outer() works, it expands both arguments to vectors of the same length as the result.

So needing a GB is not too surprising, but something does seem to be a
bit memory hungry. Looking inside pmin, it is pretty clear that it
wasn't built for memory efficiency...


It's not just needing a Gb that was surprising, but needing a single object of size 1Gb. However, that is because pmin() cbind()s its arguments together, giving a 8000x8000x2 array: 8000x8000x2x8=1Gb.


        -thomas

______________________________________________
[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

Reply via email to