[R] allocMatrix limits

Martin Maechler maechler at stat.math.ethz.ch
Fri Aug 1 15:38:56 CEST 2008

>>>>> "VK" == Vadim Kutsyy <vadim at kutsyy.com>
>>>>>     on Thu, 31 Jul 2008 15:43:56 -0700 writes:

    >>> I am getting an error "allocMatrix: too many elements
    >>> specified" when I am trying to create large matrix or
    >>> vector (about 1 billion elements).
    >>> How can I find out limits on allocMatrix? Can I increase
    >>> them?
    >> ?"Memory-limits", and you cannot increase them unless you
    >> have a system which has larger signed integers.
    VK> Thank you for pointing out this.

    VK> The problem is in array.c, where allocMatrix check for
    VK> "if ((double)nrow * (double)ncol > INT_MAX)".  But why
    VK> itn is used and not long int for indexing? (max int is
    VK> 2147483647, max long int is 9223372036854775807)

Well, Brian gave you all info:
Did you really carefully read  ?Memory-limits  

BTW: The package 'Matrix' has many facilities to work with
sparse matrices; and these facilities are used in "lme4" and
more than a dozen other CRAN packages to work with sparse
matrices in the order of 10^5 x 10^5, sometimes even
10^6 x 10^6,  *but*  with sparse content.

Martin Maechler, ETH Zurich

More information about the R-help mailing list