I’m trying to set some values on slices of a DenseAxisArray and am getting an error when setting on a single dimensional DenseAxisArray.
The following code works exactly as expected:
using JuMP.Containers
D = DenseAxisArray(zeros((3,2)),[:a,:b,:c],[:d,:e])
E = DenseAxisArray(ones((3)),[:a,:b,:c])
I = [:a,:b]
D[I,:d] = E[I]
The D array is equal to 1 on the indices corresponding to I and :d. Notice D is two dimensional.
However, when D is a single dimension:
D = DenseAxisArray(zeros((3)),[:a,:b,:c])
E = DenseAxisArray(ones((3)),[:a,:b,:c])
I = [:a,:b]
D[I] = E[I]
I get the following error
MethodError: no method matching Int64(::Symbol)
Closest candidates are:
(::Type{T})(!Matched::AbstractChar) where T<:Union{Int32, Int64} at char.jl:51
(::Type{T})(!Matched::AbstractChar) where T<:Union{AbstractChar, Number} at char.jl:50
(::Type{T})(!Matched::BigInt) where T<:Union{Int128, Int16, Int32, Int64, Int8} at gmp.jl:359
Yes, I can use an explicit for loop to set the values, but I don’t want to. I’ll be doing this many times and a for loop is less clear with more clutter.
I don’t know if this is a bug in the implementation of DenseAxisArray or if I am doing something wrong.
Thanks,
Mitch