diff --git a/README.md b/README.md index e0c0a520f..fdcd805c7 100644 --- a/README.md +++ b/README.md @@ -110,6 +110,9 @@ Currently, the `@compat` macro supports the following syntaxes: * `using Compat.SparseArrays` is provided on versions older than 0.7, where this library is not yet part of the standard library ([#25249]). +* `using Compat.LinearAlgebra` is provided on versions older than 0.7, where this library is + not yet part of the standard library ([#25571]). + * `using Compat.Random` is provided on versions older than 0.7, where this library is not yet part of the standard library ([#24874]). diff --git a/src/Compat.jl b/src/Compat.jl index af1172741..afe34f775 100644 --- a/src/Compat.jl +++ b/src/Compat.jl @@ -796,6 +796,12 @@ else import IterativeEigensolvers end +@static if VERSION < v"0.7.0-DEV.3449" + const LinearAlgebra = Base.LinAlg +else + import LinearAlgebra +end + if VERSION < v"0.7.0-DEV.3389" const SparseArrays = Base.SparseArrays else diff --git a/src/deprecated.jl b/src/deprecated.jl index f496756a5..e9869059a 100644 --- a/src/deprecated.jl +++ b/src/deprecated.jl @@ -175,7 +175,7 @@ end Base.@deprecate_binding AsyncCondition Base.AsyncCondition Base.@deprecate_binding promote_eltype_op Base.promote_eltype_op @eval Base.@deprecate_binding $(Symbol("@irrational")) Base.$(Symbol("@irrational")) - @eval Base.@deprecate_binding $(Symbol("@blasfunc")) Base.LinAlg.BLAS.$(Symbol("@blasfunc")) + @eval Base.@deprecate_binding $(Symbol("@blasfunc")) Compat.LinearAlgebra.BLAS.$(Symbol("@blasfunc")) else const KERNEL = Sys.KERNEL const UTF8String = Core.String diff --git a/test/runtests.jl b/test/runtests.jl index 047c7e654..7c8480276 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,5 +1,6 @@ using Compat using Compat.Test +using Compat.LinearAlgebra using Compat.SparseArrays @test isempty(detect_ambiguities(Base, Core, Compat)) @@ -712,7 +713,7 @@ end for T in (Float64, ComplexF32, BigFloat, Int) λ = T(4) @test chol(λ*I).λ ≈ √λ - @test_throws Union{ArgumentError,LinAlg.PosDefException} chol(-λ*I) + @test_throws Union{ArgumentError,Compat.LinearAlgebra.PosDefException} chol(-λ*I) end let @@ -1091,6 +1092,11 @@ using Compat.Random # 0.7 @test contains("Hello, World!", r"World") +# 0.7.0-DEV.3449 +let A = [2.0 1.0; 1.0 3.0], b = [1.0, 2.0], x = [0.2, 0.6] + @test cholfact(A) \ b ≈ x +end + # 0.7.0-DEV.3173 @test invpermute!(permute!([1, 2], 2:-1:1), 2:-1:1) == [1, 2]