I have the following code:
NS = 23^3
TSA = Array(Dict, NS)
for from_i in 1:NS
TSA[from_i] = Dict()
for a in 1:6
TSA[from_i][a] = spzeros(Float32, 1, NS)
end
end
This gobbles up about 4G of memory. If instead, I use TSA[from_i][a] =
spzeros(Float32, NS, 1) it barely makes a dent in my memory usage.
FYI, I’m using dictionaries here because in my application a’s are actually
tuples of symbols, not integers, and it makes things easier.
The only reason I wrote it as a rowvector is because I need to dot it with
a non-sparse vector b, but unfortunately dot does not support
SparseMatrixCSC so I’m using a' * b instead. I can get away with using the
column vector for now by doing b' * a.
I was surprised at the difference in memory footprint, and I’m curious if
someone would care to explain why that is?
Thanks,
-z