You are just missing a .
before the division (./
). It should be eco = getindex.(soln.u, 1)./Σ
to obtain elementwise division rather than matrix division.
See the simplified example below:
julia> u = [[1,2],[3,4],[5,6]]
3-element Vector{Vector{Int64}}:
[1, 2]
[3, 4]
[5, 6]
julia> ∑ = sum.(u)
3-element Vector{Int64}:
3
7
11
julia> percent = u./∑
3-element Vector{Vector{Float64}}:
[0.3333333333333333, 0.6666666666666666]
[0.42857142857142855, 0.5714285714285714]
[0.45454545454545453, 0.5454545454545454]
julia> eco = getindex.(percent, 1)
3-element Vector{Float64}:
0.3333333333333333
0.42857142857142855
0.45454545454545453