Skip to content

Commit

Permalink
Compat for chol(::UniformScaling) and fallback for logdet()
Browse files Browse the repository at this point in the history
  • Loading branch information
mschauer committed Jul 19, 2017
1 parent bdf61d8 commit 25f7131
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,10 @@ Currently, the `@compat` macro supports the following syntaxes:

* `@__MODULE__` is aliased to `current_module()` for Julia versions 0.6 and below. Versions of `Base.binding_module`, `expand`, `macroexpand`, and `include_string` were added that accept a module as the first argument. ([#22064])

* `chol` and `chol!` for `UniformScalings` ([#22633]).

* `logdet` for `Number`s ([#22629]).

## Renamed functions


Expand Down Expand Up @@ -283,3 +287,5 @@ includes this fix. Find the minimum version from there.
[#21257]: https://github.com/JuliaLang/julia/issues/21257
[#21346]: https://github.com/JuliaLang/julia/issues/21346
[#22064]: https://github.com/JuliaLang/julia/issues/22064
[#22633]: https://github.com/JuliaLang/julia/issues/22633
[#22629]: https://github.com/JuliaLang/julia/issues/22629
13 changes: 13 additions & 0 deletions src/Compat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -607,6 +607,19 @@ if VERSION < v"0.6.0-pre.beta.455"
isless(x::Dates.OtherPeriod, y::Dates.FixedPeriod) = throw(MethodError(isless, (x, y)))
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
Expand Down
11 changes: 11 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1868,6 +1868,17 @@ 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) λ*I
@test_throws Union{ArgumentError,LinAlg.PosDefException} chol(-λ*I)
end


include("deprecated.jl")

nothing

0 comments on commit 25f7131

Please sign in to comment.