I = Int[]
J = Int[]
V = Float64[]

while have_more_entries_to_add()
     i, j, v = get_next_entry()
    push!(I, i); push!(J, j); push!(V, v)
end

arry = sparse(I, J, V)

--Tim

On Wednesday, November 25, 2015 08:05:12 AM Cedric St-Jean wrote:
> How do people usually do this? Assignment is slow
> 
> arr = spzeros(1000,1000)
> for ...
>    arr[i,j] = ...
> ...
> 
> and indeed, in scipy one would use a non-CSC format for construction, then
> convert it to CSC. I've seen some comments that one should just build the
> 
> SparseMatrixCSC object directly for performance. Is that still the usual
> advice?
> 
> Cédric

Reply via email to