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

[NDTensors] Introduce NestedPermutedDimsArrays submodule #1589

Merged
merged 6 commits into from
Nov 15, 2024

Conversation

mtfishman
Copy link
Member

@mtfishman mtfishman commented Nov 15, 2024

This introduces a NestedPermutedDimsArrays module that defines a NestedPermutedDimsArray type, which is like Base.PermutedDimsArray but is singly nested, i.e. it is a lazily permuted array where the elements are also lazily permuted.

This is meant to serve as the new output type of blocks(::PermutedDimsArray) in BlockSparseArrays, i.e. blocks(a::PermutedDimsArray) = NestedPermutedDimsArray(blocks(parent(a)), perm(a)), as an alternative to the current design based on SparsePermutedDimsArrayBlocks. That will make the PermutedDimsArray wrapper more in line with the design of the Adjoint and Transpose wrappers as of #1580. However, in order for that to work, we will also have to add support for NestedPermutedDimsArrays in SparseArrayInterface, which will be handled in a future PR.

@lkdvos

Note that something similar could be achieved by composing a PermutedDimsArray with a MappedArray where the map (and inverse map) itself constructs a PermutedDimsArray, and in fact that was an earlier design I used in BlockSparseArrays. Maybe we can consider that in the future, though dealing with nested wrappers might be a bit tricky to deal with in SparseArrayInterface right now, so this approach feels simpler for now.

@mtfishman mtfishman merged commit 3594216 into main Nov 15, 2024
12 of 13 checks passed
@mtfishman mtfishman deleted the RecursivePermutedDimsArrays branch November 15, 2024 18:31
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

Successfully merging this pull request may close these issues.

1 participant