Unable to initialize big matrices in Julia

Viewed 41

I am trying to initialize a two-dimensional array and then filling it up gradually. However whenever I try to initialize it, it gives Out of Memory error.

D = zeros(1000000, 1000000);

Is there any way to resolve the error and get a workaround for this ?

1 Answers

The problem is that an array of this size would take almost 8TB of ram. If you want an array this big where almost all of the elements are 0, you can use spzeros(1000000, 1000000) (defined in SparseArrays).

Related