JuliaApproximation / QuasiArrays.jl

A package for representing quasi-arrays
MIT License
12 stars 2 forks source link

Wrong `axes` when sequentially restricting quasiarray #71

Open jagot opened 3 years ago

jagot commented 3 years ago

If I create a basis and then restrict it "in steps", with an intermediate quasiarray, depending on the order I do this in, I get different axes:

julia> R = StaggeredFiniteDifferences(100, 0.1)
Staggered finite differences basis {Float64} on 0.0..10.049999999999999 with 100 points spaced by ρ = 0.1

julia> A = R[:,1:20]
Staggered finite differences basis {Float64} on 0.0..10.049999999999999 with 100 points spaced by ρ = 0.1, restricted to basis functions 1..20 ⊂ 1..100

julia> axes(A)
(Inclusion(0.0..10.049999999999999), Base.OneTo(20))

julia> axes(A[Inclusion(1..4),:])
(Inclusion(0.0..10.049999999999999), Base.OneTo(20))

I think this is wrong, if I do it in the other order, or directly restrict both dimensions, it behaves as I think it should:

julia> axes(R[Inclusion(1..4),:])
(Inclusion(1..4), Base.OneTo(100))

julia> axes(R[Inclusion(1..4),1:20])
(Inclusion(1..4), Base.OneTo(20))

julia> B = R[Inclusion(1..4),:]
Staggered finite differences basis {Float64} on 0.0..10.049999999999999 with 100 points spaced by ρ = 0.1, restricted to basis functions 1..100 ⊆ 1..100

julia> axes(B[:,1:20])
(Inclusion(1..4), Base.OneTo(20))