[R] sparse matrix
Prof Brian Ripley
ripley at stats.ox.ac.uk
Mon Jan 8 12:41:06 CET 2001
On Mon, 8 Jan 2001, Martin Gotz wrote:
> Hi R users,
> I have problem with very large matrix - sparse matrix. Is in R any
> possibility how effective use matrix with a lots of the same number (0 or
> some X)?
> I think every element of matrix in R now needs own memory space.
A matrix in R is a vector plus a dim atttribute. I presume you mean a
numeric matrix (there are other types). Then it needs a 8byte space per
There are other ways to handle matrices: look at package Matrix, for
One obvious representation is to store the non-zero elements and their
Just how large is this matrix, and does it have a pattern to its sparsity?
And what do you want to do with it? Doing things with sparse matrices has
a tendency to make them less sparse.
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272860 (secr)
Oxford OX1 3TG, UK Fax: +44 1865 272595
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
More information about the R-help