You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
function Base.getindex(𝐼::IdentityMultiple{T}, ind) where {T}
if1≤ ind ≤ 𝐼.n^2
returnrem(ind-1, 𝐼.n+1) ==0? 𝐼.M.λ :zero(T)
else
throw(BoundsError(𝐼, ind))
end
end
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:66isless(::Real, ::AbstractFloat) at operators.jl:157isless(::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
The text was updated successfully, but these errors were encountered:
The type of
ind
has to be restricted toInteger
and another method forStepRange
(or the supertypeOrdinalRange
or even that one's supertypeAbstractRange
) needs to be added.MathematicalSystems.jl/src/identity.jl
Lines 87 to 98 in a456045
The text was updated successfully, but these errors were encountered: