Skip to content

Commit

Permalink
Fix PermutedDimsArrays typo
Browse files Browse the repository at this point in the history
  • Loading branch information
timholy authored and mfasi committed Sep 5, 2016
1 parent 2e9dbf2 commit d8fe0bf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion base/permuteddimsarray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ immutable PermutedDimsArray{T,N,perm,iperm,AA<:AbstractArray} <: AbstractArray{T
end

function PermutedDimsArray{T,N}(data::AbstractArray{T,N}, perm)
length(perm) == N || throw(ArgumentError(string(p, " is not a valid permutation of dimensions 1:", N)))
length(perm) == N || throw(ArgumentError(string(perm, " is not a valid permutation of dimensions 1:", N)))
iperm = invperm(perm)
PermutedDimsArray{T,N,(perm...,),(iperm...,),typeof(data)}(data)
end
Expand Down
5 changes: 5 additions & 0 deletions test/arrayops.jl
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,12 @@ s = view(a,:,[1,2,4],[1,5])
c = convert(Array, s)
for p in ([1,2,3], [1,3,2], [2,1,3], [2,3,1], [3,1,2], [3,2,1])
@test permutedims(s, p) == permutedims(c, p)
@test Base.PermutedDimsArrays.PermutedDimsArray(s, p) == permutedims(c, p)
end
@test_throws ArgumentError permutedims(a, (1,1,1))
@test_throws ArgumentError permutedims(s, (1,1,1))
@test_throws ArgumentError Base.PermutedDimsArrays.PermutedDimsArray(a, (1,1,1))
@test_throws ArgumentError Base.PermutedDimsArrays.PermutedDimsArray(s, (1,1,1))

## ipermutedims ##

Expand Down

0 comments on commit d8fe0bf

Please sign in to comment.