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

Preserve axes in permutedims #319

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

jishnub
Copy link
Member

@jishnub jishnub commented Dec 5, 2023

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.

Copy link

codecov bot commented Dec 5, 2023

Codecov Report

Attention: Patch coverage is 0% with 7 lines in your changes missing coverage. Please review.

Project coverage is 0.00%. Comparing base (6f61dc3) to head (899b469).

Files with missing lines Patch % Lines
src/fillalgebra.jl 0.00% 7 Missing ⚠️

❗ There is a different number of reports uploaded between BASE (6f61dc3) and HEAD (899b469). Click for more details.

HEAD has 10 uploads less than BASE
Flag BASE (6f61dc3) HEAD (899b469)
19 9
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #319       +/-   ##
==========================================
- Coverage   99.91%   0.00%   -99.92%     
==========================================
  Files           8       8               
  Lines        1147    1145        -2     
==========================================
- Hits         1146       0     -1146     
- Misses          1    1145     +1144     

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

@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
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.

2 participants