-
-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sub
displays #undef when AbstractArray
subtype does not define getindex.
#166
Comments
sub
returns #undef when AbstractMatrix
subtype does not defined getindex.sub
returns #undef when AbstractMatrix
subtype does not define getindex.
sub
returns #undef when AbstractMatrix
subtype does not define getindex.sub
returns #undef when AbstractArray
subtype does not define getindex.
The julia> t = SymTridiagonal(rand(5),rand(4))
5x5 Base.LinAlg.SymTridiagonal{Float64}:
0.450664 0.594558 0.0 0.0 0.0
0.594558 0.863439 0.304512 0.0 0.0
0.0 0.304512 0.757572 0.520557 0.0
0.0 0.0 0.520557 0.0303424 0.155352
0.0 0.0 0.0 0.155352 0.4823
julia> t[3]
ERROR: indexing not defined for Base.LinAlg.SymTridiagonal{Float64}
in getindex at abstractarray.jl:434
julia> a = sub(t, 1:2)
2-element SubArray{Float64,1,Base.LinAlg.SymTridiagonal{Float64},(UnitRange{Int64},),0}:
#undef
#undef
julia> a[1]
ERROR: indexing not defined for Base.LinAlg.SymTridiagonal{Float64}
in anonymous at subarray2.jl:34 which is indeed the method error you were hoping for. IIRC there are some All of these work if you first define Base.getindex(A::SymTridiagonal, i::Real) = getindex(A, ind2sub(size(A), i)...) before performing the above steps. It also doesn't happen with But perhaps you're thinking that the display functionality needs to be changed? This isn't the first time this has proved confusing, see timholy/Grid.jl#48 and JuliaMath/Interpolations.jl#14. |
sub
returns #undef when AbstractArray
subtype does not define getindex.sub
displays #undef when AbstractArray
subtype does not define getindex.
Sorry, the wording wasn't correct. I think we should display something other than |
This works now with JuliaLang/julia#10525 since SymTridiagonal just got one-dimensional indexing for free. |
I love the cascade of closed issues from JuliaLang/julia#10525. |
For example:
Shouldn't this throw a method error instead?
The text was updated successfully, but these errors were encountered: