From 34d2b80ec66e2d928fec4635de5838a92152501e Mon Sep 17 00:00:00 2001 From: Jim Garrison Date: Sun, 12 Aug 2018 12:18:21 -0400 Subject: [PATCH] Support for `trace` -> `tr` rename --- README.md | 3 +++ src/Compat.jl | 8 ++++++++ test/runtests.jl | 3 +++ 3 files changed, 14 insertions(+) diff --git a/README.md b/README.md index e8bc94440..dbc9e7529 100644 --- a/README.md +++ b/README.md @@ -349,6 +349,8 @@ Currently, the `@compat` macro supports the following syntaxes: * `Complex32`, `Complex64`, and `Complex128` are now `ComplexF16`, `ComplexF32`, and `ComplexF64`, respectively ([#24647]). +* `trace` is now `tr`, available as `Compat.tr` (#26365). + * `JULIA_HOME` is now `Sys.BINDIR`, available in the `Compat.Sys` submodule. ([#25102]) * `Associative` is now `AbstractDict` ([#25012]). @@ -651,6 +653,7 @@ includes this fix. Find the minimum version from there. [#26156]: https://github.com/JuliaLang/julia/issues/26156 [#26283]: https://github.com/JuliaLang/julia/issues/26283 [#26316]: https://github.com/JuliaLang/julia/issues/26316 +[#26365]: https://github.com/JuliaLang/julia/issues/26365 [#26369]: https://github.com/JuliaLang/julia/issues/26369 [#26436]: https://github.com/JuliaLang/julia/issues/26436 [#26442]: https://github.com/JuliaLang/julia/issues/26442 diff --git a/src/Compat.jl b/src/Compat.jl index 54adc0724..5d720207c 100644 --- a/src/Compat.jl +++ b/src/Compat.jl @@ -1074,6 +1074,14 @@ end export ComplexF64 end +# julia #26365 +@static if isdefined(LinearAlgebra, :tr) + const tr = LinearAlgebra.tr +else + # 0.6 + const tr = LinearAlgebra.trace +end + # 0.7.0-DEV.2915 module Unicode export graphemes, textwidth, isvalid, diff --git a/test/runtests.jl b/test/runtests.jl index 1fde8d6a1..ae820a490 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -299,6 +299,9 @@ end @test !iszero([0, 1, 2, 3]) @test iszero([0, 0, 0, 0]) +# julia#26365 +@test Compat.tr([1 2; 3 5]) == 6 + let x = view(1:10, 2:4) D = Diagonal(x)