Skip to content

Preserve axes in permutedims - #319

Open
jishnub wants to merge 6 commits into
JuliaArrays:masterfrom
jishnub:permutedims
Open

Preserve axes in permutedims#319
jishnub wants to merge 6 commits into
JuliaArrays:masterfrom
jishnub:permutedims

Conversation

@jishnub

@jishnub jishnub commented Dec 5, 2023

Copy link
Copy Markdown
Member

The vector method is unnecessary, as the fallback Base method uses reshape, which will do the same.

For the other method:
On master,

julia> F = Fill(2, (SOneTo(2), SOneTo(3)))
2×3 Fill{Int64, 2, Tuple{SOneTo{2}, SOneTo{3}}} with indices SOneTo(2)×SOneTo(3), with entries equal to 2

julia> permutedims(F)
3×2 Fill{Int64, 2, Tuple{SOneTo{3}, SOneTo{2}}} with indices SOneTo(3)×SOneTo(2), with entries equal to 2

julia> permutedims(F, (2,1))
3×2 Fill{Int64}, with entries equal to 2

In the second operation, the static axes are lost. After this PR, the axes are preserved:

julia> permutedims(F, (2,1))
3×2 Fill{Int64, 2, Tuple{SOneTo{3}, SOneTo{2}}} with indices SOneTo(3)×SOneTo(2), with entries equal to 2

To make this type-stable, we require aggressive constant propagation on the permutation tuple.

@codecov

codecov Bot commented Dec 5, 2023

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 83.33333% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 99.83%. Comparing base (5671b89) to head (537c43d).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
src/fillalgebra.jl 83.33% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #319      +/-   ##
==========================================
- Coverage   99.91%   99.83%   -0.09%     
==========================================
  Files           9        9              
  Lines        1200     1200              
==========================================
- Hits         1199     1198       -1     
- Misses          1        2       +1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jishnub jishnub changed the title Remove unnecessary permutedims method Preserve axes in permutedims Dec 5, 2023
@jishnub
jishnub marked this pull request as draft December 5, 2023 15:18
@jishnub
jishnub marked this pull request as ready for review December 12, 2023 09:10
@mtfishman

Copy link
Copy Markdown
Contributor

@jishnub I just came across a need for this, can this be merged?

Comment thread src/fillalgebra.jl
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.

3 participants