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

permutedims for vectors and matrices #917

Merged
merged 5 commits into from
Jul 28, 2021

Conversation

mcabbott
Copy link
Collaborator

@mcabbott mcabbott commented May 30, 2021

Before:

julia> permutedims(SA[1,2,3])
1×3 reshape(::SVector{3, Int64}, 1, 3) with eltype Int64:
 1  2  3

julia> axes(ans)
(Base.OneTo(1), Base.OneTo(3))

julia> permutedims(SA[1 2; 3 4])
2×2 MMatrix{2, 2, Int64, 4} with indices SOneTo(2)×SOneTo(2):
 1  3
 2  4

After:

julia> permutedims(SA[1,2,3])
1×3 SMatrix{1, 3, Int64, 3} with indices SOneTo(1)×SOneTo(3):
 1  2  3

julia> permutedims(SA[1 2;3 4])
2×2 SMatrix{2, 2, Int64, 4} with indices SOneTo(2)×SOneTo(2):
 1  3
 2  4 

Unchanged are all the cases taking perm, discussed in #806.

julia> permutedims(@SArray(rand(1,2,3)), (3,2,1))
3×2×1 MArray{Tuple{3, 2, 1}, Float64, 3, 6} with indices SOneTo(3)×SOneTo(2)×SOneTo(1):

I'm not too sure what should happen for MArrays or SizedArrays.

src/abstractarray.jl Outdated Show resolved Hide resolved
test/abstractarray.jl Outdated Show resolved Hide resolved
test/abstractarray.jl Outdated Show resolved Hide resolved
@mateuszbaran
Copy link
Collaborator

Sorry for the delay but could you bump the patch version? I'm going to merge this soon and tag a new release.

@mateuszbaran mateuszbaran merged commit 22a05ef into JuliaArrays:master Jul 28, 2021
@mcabbott mcabbott deleted the permutedims branch July 28, 2021 15:11
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.

2 participants