From 2881e770669236aed59fa8eb84440b31aff30a87 Mon Sep 17 00:00:00 2001 From: Martin Holters Date: Tue, 8 Oct 2019 19:19:24 +0200 Subject: [PATCH] Mark `Compat.norm` abd friends from #577 for deprecation --- README.md | 4 ---- src/Compat.jl | 15 ++++----------- test/old.jl | 8 ++++++++ test/runtests.jl | 8 -------- 4 files changed, 12 insertions(+), 23 deletions(-) diff --git a/README.md b/README.md index afa280082..3ca4c8b63 100644 --- a/README.md +++ b/README.md @@ -80,10 +80,6 @@ Currently, the `@compat` macro supports the following syntaxes: * `Compat.split` and `Compat.rsplit` accept `keepempty` keyword argument if `splitter` is given as second argument ([#26634]) -* `vecnorm` and `vecdot` are now `Compat.norm` and `Compat.dot`, respectively, while the - old `norm(A::AbstractMatrix, p=2)` is now `Compat.opnorm` ([#27401]). `import Compat: ⋅` - to get `Compat.dot` as the binary operator `⋅`. - * `atan2` is now a 2-argument method of `atan` ([#27253]). * `realmin` and `realmax` are now `floatmin` and `floatmax` ([#28302]) diff --git a/src/Compat.jl b/src/Compat.jl index 17dcefa07..02eced4dd 100644 --- a/src/Compat.jl +++ b/src/Compat.jl @@ -53,6 +53,10 @@ import LibGit2 import UUIDs using LinearAlgebra: qr using LinearAlgebra: rmul! +const opnorm = LinearAlgebra.opnorm +const norm = LinearAlgebra.norm +const dot = LinearAlgebra.dot +const ⋅ = dot include("compatmacro.jl") @@ -78,17 +82,6 @@ end end end -if !isdefined(LinearAlgebra, :opnorm) # julia#27401 - opnorm(A::AbstractMatrix, p::Real=2) = LinearAlgebra.norm(A, p) - const norm = LinearAlgebra.vecnorm - const dot = LinearAlgebra.vecdot -else - const opnorm = LinearAlgebra.opnorm - const norm = LinearAlgebra.norm - const dot = LinearAlgebra.dot -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))) diff --git a/test/old.jl b/test/old.jl index b20dd030c..cac1f384b 100644 --- a/test/old.jl +++ b/test/old.jl @@ -250,6 +250,14 @@ let A = [1 2; 3 4] @test Compat.rmul!(Diagonal(A), Diagonal([2, 1])) == Diagonal([8, 120]) end +# julia#27401 +import Compat: ⋅ +@test Compat.opnorm([1 2;3 4]) ≈ 5.464985704219043 +@test Compat.opnorm([1 2;3 4], 1) ≈ 6 +@test Compat.norm([1 2;3 4]) ≈ 5.477225575051661 +@test Compat.norm([1 2;3 4], 1) ≈ 10 +@test Compat.dot([1 2;3 4], [5 6;7 8]) == [1 2;3 4] ⋅ [5 6;7 8] ≈ 70 + # tests of removed functionality (i.e. justs tests Base) diff --git a/test/runtests.jl b/test/runtests.jl index b358e7b34..d920aeb6b 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -89,14 +89,6 @@ end @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 -@test Compat.opnorm([1 2;3 4], 1) ≈ 6 -@test Compat.norm([1 2;3 4]) ≈ 5.477225575051661 -@test Compat.norm([1 2;3 4], 1) ≈ 10 -@test Compat.dot([1 2;3 4], [5 6;7 8]) == [1 2;3 4] ⋅ [5 6;7 8] ≈ 70 - # 0.7.0-alpha.44 @test atan(1, 2) == atan(0.5) @test atan(1.0, 2.0) == atan(0.5)