Skip to content
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

Failure on edge cases #2

Open
FelixBenning opened this issue Jun 2, 2023 · 0 comments
Open

Failure on edge cases #2

FelixBenning opened this issue Jun 2, 2023 · 0 comments

Comments

@FelixBenning
Copy link

Hi there, someone pointed out this package to me when I tried to solve the same problem resulting in ProductArrays currently in the registering process. It might make sense to stop its publishing now, but I also noticed that you did not cover a few edge cases making the behavior of StructuredGrid not quite the same as the collected product.Iterator. This is something ProductArray promises (I would count any failure to do so as a bug). Here are the edge cases:

julia> grid([1 2; 3 4], [:a, :b])
2×2 StructuredGrids.Grid{Tuple{Int64, Symbol}, 2, Tuple{Matrix{Int64}, Vector{Symbol}}}:
 (1, :a)  (1, :b)
 (3, :a)  (3, :b)

julia> Iterators.product([1 2; 3 4], [:a, :b]) |> collect
2×2×2 Array{Tuple{Int64, Symbol}, 3}:
[:, :, 1] =
 (1, :a)  (2, :a)
 (3, :a)  (4, :a)

[:, :, 2] =
 (1, :b)  (2, :b)
 (3, :b)  (4, :b)

julia> grid(1:2, (:a, :b))
Error showing value of type StructuredGrids.Grid{Tuple{Int64, Symbol}, 2, Tuple{UnitRange{Int64}, Tuple{Symbol, Symbol}}}:
ERROR: MethodError: no method matching axes(::Tuple{Symbol, Symbol}, ::Int64)
Closest candidates are:
  axes(::Tuple) at tuple.jl:28
  axes(::Number, ::Integer) at number.jl:83
  axes(::Base.Broadcast.Broadcasted{<:Any, <:Tuple{Vararg{T, N}} where T}, ::Integer) where N at broadcast.jl:227
  ...
Stacktrace:
  [1] _axes (repeats 2 times)
    @ ~/.julia/packages/StructuredGrids/ndiJn/src/StructuredGrids.jl:17 [inlined]
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant