I have been trying to figure out when exactly is it clearly stupid not to define linearindexing(::Type{T}) = Base.LinearFast()
for some (1D) indexable type T? So could someone please explain when to use Base.LinearFast and why I get the following errors even though all of Array, String and Tuple are indexable?
julia> Base.linearindexing(Array)
Base.LinearFast()
julia> Base.linearindexing(String)
ERROR: MethodError: no method matching linearindexing(::Type{String})
Closest candidates are:
linearindexing(::Base.LinearFast, ::Base.LinearFast) at abstractarray.jl:239
linearindexing(::Base.SparseArrays.CHOLMOD.Dense{T<:Union{Complex{Float64},Flo
at64}}) at sparse\cholmod.jl:1124
linearindexing(::Base.SparseArrays.CHOLMOD.Sparse{Tv<:Union{Complex{Float64},F
loat64}}) at sparse\cholmod.jl:1145
...
julia> Base.linearindexing(Tuple)
ERROR: MethodError: no method matching linearindexing(::Type{Tuple})
Closest candidates are:
linearindexing(::Base.LinearFast, ::Base.LinearFast) at abstractarray.jl:239
linearindexing(::Base.SparseArrays.CHOLMOD.Dense{T<:Union{Complex{Float64},Flo
at64}}) at sparse\cholmod.jl:1124
linearindexing(::Base.SparseArrays.CHOLMOD.Sparse{Tv<:Union{Complex{Float64},F
loat64}}) at sparse\cholmod.jl:1145
...
Also, when should I use Base.LinearSlow and how is it different from LinearFast in terms of speed difference and functionality?
Thank you!