I have a large matrix bd
(25k by 25k) with numeric value, a sample of content which is here
> bd[1:5, 1:5]
[,1] [,2] [,3] [,4] [,5]
[1,] 1.8121698 0.0000000 0.000000 0.000000 0.0000000
[2,] 2.0770875 2.0159531 0.000000 0.000000 0.0000000
[3,] 0.3688963 1.6658982 2.299720 0.000000 0.0000000
[4,] 1.5845495 0.4880238 1.538353 1.536267 0.0000000
[5,] 1.1428052 0.7087784 1.656545 1.077034 0.4592339
The variable size is 4.7GB so I want to reduce this into a vector of just the lower triangle values to save space.
However when I do smallbd <- bd[lower.tri(bd, T)]
I get Error: cannot allocate vector of size 2.3 Gb
Any suggestions how else I can take the lower triangle within the memory constraint?