Creating sparse arrays seems exceptionally slow.

I can set up the non-zero data of the array relatively quickly.  For 
example, the following code takes about 80 seconds on one machine.


vec_len = 700000


row_ind = Uint64[]
col_ind = Uint64[]
value = Float64[]


for j = 1:700000
   for k = 1:700
      ind = k*50
      push!(row_ind, ind)
      push!(col_ind, j)
      push!(value, 5.0)
   end
end


but then

a = sparse(row_ind, col_ind, value, 700000, 700000)


takes more than at least about 30 minutes.  (I never let it finish.)

It doesn't seem like the numbers I'm using should be that far off the 
scale.  Is there a more efficient way I should be doing what I'm doing?  Am 
I missing something and asking for something that really is impractical?

If not, I may be able to look into the sparse matrix code a little this 
weekend.


The never-finishing result is the same if I try

sprand(700000, 700000, .001)

or if I try to set 700000*700 values in a sparse matrix of zeros directly. 
 Thanks.


Reply via email to