Skip to content

Commit

Permalink
Mark Compat.norm abd friends from #577 for deprecation
Browse files Browse the repository at this point in the history
  • Loading branch information
martinholters committed Oct 8, 2019
1 parent 86873ad commit 2881e77
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 23 deletions.
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand Down
15 changes: 4 additions & 11 deletions src/Compat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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)))
Expand Down
8 changes: 8 additions & 0 deletions test/old.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
8 changes: 0 additions & 8 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 2881e77

Please sign in to comment.