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 6a2992895..da97bf8b8 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 dd583b0a5..5da4a2afa 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -84,14 +84,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)