MathematicalSystems.jl icon indicating copy to clipboard operation
MathematicalSystems.jl copied to clipboard

getindex of range in IdentityMultiple

Open schillic opened this issue 5 years ago • 0 comments

The type of ind has to be restricted to Integer and another method for StepRange (or the supertype OrdinalRange or even that one's supertype AbstractRange) needs to be added.

https://github.com/JuliaReach/MathematicalSystems.jl/blob/a456045dacbfb7f2bd7e57a7a2746d06c538b8a9/src/identity.jl#L87-L98

julia> I = IdentityMultiple(1.0, 2)
IdentityMultiple{Float64} of value 1.0 and order 2

julia> Diagonal(I)
ERROR: MethodError: no method matching isless(::Int64, ::StepRange{Int64,Int64})
Closest candidates are:
  isless(::Missing, ::Any) at missing.jl:66
  isless(::Real, ::AbstractFloat) at operators.jl:157
  isless(::Real, ::Real) at operators.jl:346
  ...
Stacktrace:
 [1] <(::Int64, ::StepRange{Int64,Int64}) at ./operators.jl:268
 [2] <=(::Int64, ::StepRange{Int64,Int64}) at ./operators.jl:317
 [3] getindex(::IdentityMultiple{Float64}, ::StepRange{Int64,Int64}) at .julia/dev/MathematicalSystems/src/identity.jl:93

schillic avatar Feb 23 '20 11:02 schillic