You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While trying some sparse matrix operations stumbled upon
julia> y = spzeros(7,7)
7x7 sparse matrix with 0 Float64 entries:
julia> y[2,1] = y[2,3] = y[2,5] = 3
3
julia> z = spzeros(7,7)
7x7 sparse matrix with 0 Float64 entries:
julia> z = -y
7x7 sparse matrix with 3 Float64 entries:
[2, 1] = -3.0
[2, 3] = -3.0
[2, 5] = -3.0
Ok, so far, so good
julia>for i =1:7
z[i,i] =sum(y[i,:])
end
ERROR: no method convert(Type{Float64}, Array{Float64,1})
in setindex! at sparse/sparsematrix.jl:969in anonymous at no file:2
but these operations applied separately are good:
julia>for i =1:7
z[i,i] =7.0end
julia>for i =1:7
s =sum(y[i,:])
end
While trying some sparse matrix operations stumbled upon
Ok, so far, so good
but these operations applied separately are good:
Delving into it:
So why for sparse vector
sum
produced1-element Array
instead of a scalar value?Thanks!
The text was updated successfully, but these errors were encountered: