Skip to content

Commit

Permalink
single-argument permutedims(x) (#582)
Browse files Browse the repository at this point in the history
  • Loading branch information
stevengj authored Jul 5, 2018
1 parent 416ea4b commit b5aa7e0
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,8 @@ Currently, the `@compat` macro supports the following syntaxes:

* `squeeze` with `dims` as keyword argument ([#26660]).

* Single-argument `permutedims(x)` for matrices and vectors ([#24839]).

* `fetch` for `Task`s ([#25940]).

* `Compat.qr` takes `pivot` as a `Val` _instance_ ([#22475]).
Expand Down Expand Up @@ -583,6 +585,7 @@ includes this fix. Find the minimum version from there.
[#24785]: https://github.com/JuliaLang/julia/issues/24785
[#24808]: https://github.com/JuliaLang/julia/issues/24808
[#24831]: https://github.com/JuliaLang/julia/issues/24831
[#24839]: https://github.com/JuliaLang/julia/issues/24839
[#24874]: https://github.com/JuliaLang/julia/issues/24874
[#24999]: https://github.com/JuliaLang/julia/issues/24999
[#25012]: https://github.com/JuliaLang/julia/issues/25012
Expand Down
5 changes: 5 additions & 0 deletions src/Compat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1936,6 +1936,11 @@ else
end
const = dot

if VERSION < v"0.7.0-DEV.2956" # julia#24839
Base.permutedims(A::AbstractMatrix) = permutedims(A, (2,1))
Base.permutedims(v::AbstractVector) = reshape(v, (1, length(v)))
end

# https://github.com/JuliaLang/julia/pull/27253
@static if VERSION < v"0.7.0-alpha.44"
Base.atan(x::Real, y::Real) = atan2(x, y)
Expand Down
4 changes: 4 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1816,6 +1816,10 @@ let sep = Compat.Sys.iswindows() ? ';' : ':'
end
end

# julia#24839
@test permutedims([1 2; 3 4]) == [1 3; 2 4]
@test permutedims([1,2,3]) == [1 2 3]

# julia#27401
import Compat:
@test Compat.opnorm([1 2;3 4]) 5.464985704219043
Expand Down

0 comments on commit b5aa7e0

Please sign in to comment.