Skip to content

Commit

Permalink
Mark Compat.rmul! from #546 for deprecation
Browse files Browse the repository at this point in the history
  • Loading branch information
martinholters committed Oct 8, 2019
1 parent 430e42d commit 2c001f0
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 36 deletions.
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,6 @@ Currently, the `@compat` macro supports the following syntaxes:

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

* `Compat.rmul!` provides a subset of the functionality of `LinearAlgebra.rmul!` for
use with Julia 0.6 ([#25701], [#25812]).

* `isbits(t::Type)` is now `isbitstype(t)` ([#26850]).

* `something` to get the first argument different from `nothing`, unwrapping those
Expand Down
26 changes: 1 addition & 25 deletions src/Compat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ import InteractiveUtils
import LibGit2
import UUIDs
using LinearAlgebra: qr
using LinearAlgebra: rmul!


include("compatmacro.jl")
Expand All @@ -77,31 +78,6 @@ end
end
end

# rmul! (NOTE: Purposefully not exported)
if VERSION < v"0.7.0-DEV.3563" # scale! not deprecated
if VERSION >= v"0.7.0-DEV.3449" # LinearAlgebra in the stdlib
using LinearAlgebra: UnitUpperTriangular, UnitLowerTriangular, scale!
else
using Base.LinAlg: UnitUpperTriangular, UnitLowerTriangular, scale!
end
const Triangle = Union{UpperTriangular, UnitUpperTriangular,
LowerTriangular, UnitLowerTriangular}
if VERSION < v"0.7.0-DEV.3204" # A_mul_B! not deprecated
rmul!(A::AbstractMatrix, B::Triangle) = A_mul_B!(A, A, B)
else
rmul!(A::AbstractMatrix, B::Triangle) = mul!(A, A, B)
end
rmul!(A::AbstractArray, s::Number) = scale!(A, s)
rmul!(A::AbstractMatrix, D::Diagonal) = scale!(A, D.diag)
rmul!(A::Diagonal, B::Diagonal) = Diagonal(A.diag .*= B.diag)
rmul!(A::Triangle, B::Diagonal) = typeof(A)(rmul!(A.data, B))
elseif v"0.7.0-DEV.3563" <= VERSION < v"0.7.0-DEV.3665" # scale! -> mul1!
using LinearAlgebra: mul1!
const rmul! = mul1!
elseif VERSION >= v"0.7.0-DEV.3665" # mul1! -> rmul!
using LinearAlgebra: rmul!
end

@static if VERSION < v"0.7.0-DEV.3936"
Base.fetch(t::Task) = wait(t)
end
Expand Down
8 changes: 8 additions & 0 deletions test/old.jl
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,14 @@ let A = [1 2; 1 2; 1 2]
@test f.Q * [f.R; [0 0]] A[:,f.p]
end

let A = [1 2; 3 4]
@test Compat.rmul!(A, 2) == [2 4; 6 8]
@test Compat.rmul!(A, Diagonal([1, 2])) == [2 8; 6 16]
@test Compat.rmul!(A, UpperTriangular([2 2; 3 3])) == [4 28; 12 60]
@test Compat.rmul!(LowerTriangular(A), Diagonal([1, 2])) == LowerTriangular([4 0; 12 120])
@test Compat.rmul!(Diagonal(A), Diagonal([2, 1])) == Diagonal([8, 120])
end


# 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 @@ -82,14 +82,6 @@ end

@test codeunit("foo") == codeunit(SubString("fooαβγ",1,3)) == UInt8

let A = [1 2; 3 4]
@test Compat.rmul!(A, 2) == [2 4; 6 8]
@test Compat.rmul!(A, Diagonal([1, 2])) == [2 8; 6 16]
@test Compat.rmul!(A, UpperTriangular([2 2; 3 3])) == [4 28; 12 60]
@test Compat.rmul!(LowerTriangular(A), Diagonal([1, 2])) == LowerTriangular([4 0; 12 120])
@test Compat.rmul!(Diagonal(A), Diagonal([2, 1])) == Diagonal([8, 120])
end

# 0.7.0-DEV.3936
@test let ct = current_task(), t = @task true
schedule(ct)
Expand Down

0 comments on commit 2c001f0

Please sign in to comment.