-
Notifications
You must be signed in to change notification settings - Fork 152
Closed
Description
julia> using StaticArrays
julia> import ArrayInterfaceCore
julia> a = @SMatrix ones(2, 2);
julia> setindex(a,0.0,1,1)
ERROR: MethodError: setindex(::SMatrix{2, 2, Float64, 4}, ::Float64, ::Int64, ::Int64) is ambiguous. Candidates:
setindex(a::StaticArray, x, inds...) in StaticArrays at /home/nathan/.julia/packages/StaticArrays/6D1fn/src/deque.jl:198
setindex(x::AbstractMatrix, v, i::Int64, j::Int64) in ArrayInterfaceCore at /home/nathan/.julia/packages/ArrayInterfaceCore/wwYvJ/src/ArrayInterfaceCore.jl:129
Possible fix, define
setindex(::StaticArray{S, T, 2} where {T, S<:Tuple}, ::Any, ::Int64, ::Int64)
Stacktrace:
[1] top-level scope
@ REPL[12]:1
Here are links to the code referenced in the error:
Line 198 in dcc7565
@propagate_inbounds setindex(a::StaticArray, x, inds...) = setindex(a, x, LinearIndices(a)[inds...]) |
Would adding the following code solve the issue?
@propagate_inbounds setindex(a::StaticMatrix, x, i::Int, j::Int) = setindex(a, x, LinearIndices(a)[i,j])
Metadata
Metadata
Assignees
Labels
No labels