"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...

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - ([EMAIL PROTECTED])             FAX: (+45) 35327907

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