diff --git a/README.md b/README.md index 94d356475..0b1fbe89f 100644 --- a/README.md +++ b/README.md @@ -150,6 +150,10 @@ Currently, the `@compat` macro supports the following syntaxes: * `Val(x)` constructs `Val{x}()`. ([#22475]) +* `chol` and `chol!` for `UniformScalings` ([#22633]). + +* `logdet` for `Number`s ([#22629]). + ## Renamed functions @@ -297,3 +301,5 @@ includes this fix. Find the minimum version from there. [#22064]: https://github.com/JuliaLang/julia/issues/22064 [#22182]: https://github.com/JuliaLang/julia/issues/22182 [#22475]: https://github.com/JuliaLang/julia/issues/22475 +[#22633]: https://github.com/JuliaLang/julia/issues/22633 +[#22629]: https://github.com/JuliaLang/julia/issues/22629 diff --git a/src/Compat.jl b/src/Compat.jl index c771257fa..7b596cbd0 100644 --- a/src/Compat.jl +++ b/src/Compat.jl @@ -621,6 +621,19 @@ if VERSION < v"0.7.0-DEV.843" (::Type{Val})(x) = (Base.@_pure_meta; Val{x}()) end +# https://github.com/JuliaLang/julia/pull/22629 +if VERSION < v"0.7.0-DEV.848" + import Base: logdet + logdet(A) = log(det(A)) +end + +# https://github.com/JuliaLang/julia/pull/22633 +if VERSION < v"0.7.0-DEV.1041" + import Base.LinAlg: chol, chol! + chol!(J::UniformScaling, uplo) = UniformScaling(chol!(J.λ, uplo)) + chol(J::UniformScaling, args...) = UniformScaling(chol(J.λ, args...)) +end + include("deprecated.jl") # https://github.com/JuliaLang/julia/pull/21746 diff --git a/test/runtests.jl b/test/runtests.jl index 178b550af..ddb5b6b58 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1882,6 +1882,16 @@ let @test_throws MethodError Dates.Month(1) < Dates.Day(1) end +# PR 22629 +@test logdet(0.5) == log(det(0.5)) + +# PR 22633 +for T in (Float64, Complex64, BigFloat, Int) + λ = T(4) + @test chol(λ*I).λ ≈ √λ + @test_throws Union{ArgumentError,LinAlg.PosDefException} chol(-λ*I) +end + let @compat cr(::CartesianRange{2}) = 2 @test cr(CartesianRange((5, 3))) == 2