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

New package: ProductArrays v1.0.0 #84683

Merged

Conversation

JuliaRegistrator
Copy link
Contributor

UUID: 39a08dd0-b4b7-4086-afbb-eb1796240846
Repo: https://github.com/lazyLibraries/ProductArrays.jl.git
Tree: b101c921fe636be236ba9ab5e5ea348e67f1f72e

Registrator tree SHA: f73a20c99934db92a256057d0d83ba394036a701
JuliaRegistrator referenced this pull request in lazyLibraries/ProductArrays.jl Jun 1, 2023
@JuliaRegistrator JuliaRegistrator temporarily deployed to stopwatch June 1, 2023 18:40 — with GitHub Actions Inactive
@github-actions
Copy link
Contributor

github-actions bot commented Jun 1, 2023

Your new package pull request met all of the guidelines for auto-merging and is scheduled to be merged when the mandatory waiting period (3 days) has elapsed.

Since you are registering a new package, please make sure that you have read the package naming guidelines: https://julialang.github.io/Pkg.jl/dev/creating-packages/#Package-naming-guidelines-1


If you want to prevent this pull request from being auto-merged, simply leave a comment. If you want to post a comment without blocking auto-merging, you must include the text [noblock] in your comment. You can edit blocking comments, adding [noblock] to them in order to unblock auto-merging.

@aplavin
Copy link
Contributor

aplavin commented Jun 2, 2023

There are at least three packages that do similar things already. In the order of registration date and increasing functionality: StructuredGrids, LazyGrids, RectiGrids.
Do really none of them suit your usecase? What's the difference of ProductArrays?

[noblock]

@FelixBenning
Copy link

FelixBenning commented Jun 2, 2023

There are at least three packages that do similar things already. In the order of registration date and increasing functionality: StructuredGrids, LazyGrids, RectiGrids. Do really none of them suit your usecase? What's the difference of ProductArrays? @aplavin

I actually didn't know about them - thanks for pointing them out. I didn't know I should search for "grid". RectiGrid actually doesn't behave the same as collected Iterators.product though (that is the single promise of this package)

julia> grid(1:2, (:a, :b))
ERROR: MethodError: no method matching grid(::UnitRange{Int64}, ::Tuple{Symbol, Symbol})
Closest candidates are:
  grid(::AbstractVector...) at ~/.julia/packages/RectiGrids/K7F4a/src/RectiGrids.jl:88
Stacktrace:
 [1] top-level scope
   @ REPL[24]:1

julia> grid([1 2; 3 4], (:a, :b))
ERROR: MethodError: no method matching grid(::Matrix{Int64}, ::Tuple{Symbol, Symbol})
Stacktrace:
 [1] top-level scope
   @ REPL[25]:1

julia> Iterators.product(1:2, (:a, :b)) |> collect
2×2 Matrix{Tuple{Int64, Symbol}}:
 (1, :a)  (1, :b)
 (2, :a)  (2, :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)

I will check out the other packages shortly.

EDIT: LazyGrids does something else: it is a tuple of grids not a grid of tuples.
EDIT2: StructuredGrids promises the same but fails on the same edge cases and has less test coverage (I'll contact the author)

[noblock]

@aplavin
Copy link
Contributor

aplavin commented Jun 2, 2023

See also:

All of these work with abstractarrays only, indeed - no tuples. Just wanted to point out prior art so that not to duplicate functionality unnecessarily.
Still, nothing wrong with creating a new thing if existing packages don't do what you need, and this cannot easily fit into their interface. That's why I made RectiGrids, for example: I need keyed/labeled arrays, an no other grid package focuses on that.

[noblock]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants