[R] Memory Efficiency of Symmetric Matrix
Nathan S. Watson-Haigh
nathan.watson-haigh at csiro.au
Wed Jan 7 03:45:50 CET 2009
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
andrew wrote:
> the SparseM package might be what you are looking for
>
> http://www.econ.uiuc.edu/~roger/research/sparse/SparseM.pdf
>
> On Jan 7, 11:36 am, Søren Højsgaard <Soren.Hojsga... at agrsci.dk> wrote:
>> You can do
>> mat[lower.tri(mat, diag=F)]
>> Søren
>>
Thanks, although my matrices are dense and not sparse. I have however, found the Matrix package:
http://cran.r-project.org/web/packages/Matrix/index.html
The dspMatrix class, seems like what I might want:
dspMatrix - Symmetric real matrices in packed storage (one triangle only)
I'm just trying to test it out with my usual 24k x 24k size matrices.
>> ________________________________
>>
>> Fra: r-help-boun... at r-project.org på vegne af Nathan S. Watson-Haigh
>> Sendt: on 07-01-2009 01:28
>> Til: r-h... at r-project.org
>> Emne: [R] Memory Efficiency of Symmetric Matrix
>>
> I'm generating a symmetric correlation matrix using a data matrix as input:
> mat <- cor(data.mat)
>
> My question is:
> Is there a more memory efficient way to store this data? For instance, since:
> all(mat == t(mat))
> every value is duplicated, and I should be able to almost half the memory usage for large matrices.
>
> Any thoughts/comments?
>
> Cheers,
> Nathan
>
>>
______________________________________________
R-h... at r-project.org mailing listhttps://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guidehttp://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
>>
______________________________________________
R-h... at r-project.org mailing listhttps://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guidehttp://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
- --
- --------------------------------------------------------
Dr. Nathan S. Watson-Haigh
OCE Post Doctoral Fellow
CSIRO Livestock Industries
Queensland Bioscience Precinct
St Lucia, QLD 4067
Australia
Tel: +61 (0)7 3214 2922
Fax: +61 (0)7 3214 2900
Web: http://www.csiro.au/people/Nathan.Watson-Haigh.html
- --------------------------------------------------------
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iEYEARECAAYFAklkF14ACgkQ9gTv6QYzVL7ppACbB7se5hh/q34nGz2k/IFj0Y8c
2F4AoMnv+BTGT333lpMFl56pZyczMCyf
=PMQ5
-----END PGP SIGNATURE-----
More information about the R-help
mailing list