Hi everyone,
I wish to slice a SparseAxisArray Container in JuMP. The documentation says this should work:
julia> x = Containers.@container([i = 1:3, j = [:A, :B]; i > 1], (i, j))
JuMP.Containers.SparseAxisArray{Tuple{Int64, Symbol}, 2, Tuple{Int64, Symbol}} with 4 entries:
[2, A] = (2, :A)
[2, B] = (2, :B)
[3, A] = (3, :A)
[3, B] = (3, :B)
julia> y = x[:, :B]
JuMP.Containers.SparseAxisArray{Tuple{Int64, Symbol}, 1, Tuple{Int64}} with 2 entries:
[2] = (2, :B)
[3] = (3, :B)
If I try the same code in my command line I get this Error:
julia> x = Containers.@container([i = 1:3, j = [:A, :B]; i > 1], (i, j))
JuMP.Containers.SparseAxisArray{Tuple{Int64, Symbol}, 2, Tuple{Int64, Symbol}} with 4 entries:
[2, A] = (2, :A)
[2, B] = (2, :B)
[3, A] = (3, :A)
[3, B] = (3, :B)
julia> x[:,:B]
ERROR: ArgumentError: Indexing with `:` is not supported by Containers.SparseAxisArray
Stacktrace:
[1] _colon_error(#unused#::Colon, args::Symbol)
@ JuMP.Containers C:\Users\jaelsner\.julia\packages\JuMP\Y4piv\src\Containers\SparseAxisArray.jl:94
[2] getindex(::JuMP.Containers.SparseAxisArray{Tuple{Int64, Symbol}, 2, Tuple{Int64, Symbol}}, ::Function, ::Symbol)
@ JuMP.Containers C:\Users\jaelsner\.julia\packages\JuMP\Y4piv\src\Containers\SparseAxisArray.jl:129
[3] top-level scope
@ REPL[28]:1
Does anyone have an idea whatβs the problem here? Thanks!