Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Internals] Switch to TaylorDiff.jl for generator derivatives. #38

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
Roots = "f2b01f46-fcfa-551c-844a-d8ac1e96c665"
SpecialFunctions = "276daf66-3868-5448-9aa4-cd146d93841b"
StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"
TaylorSeries = "6aa5eb33-94cf-58f4-a9d0-e4b2c4fc25ea"
TaylorDiff = "b36ab563-344f-407b-a36a-4f200bebf99c"

[compat]
Cubature = "1.5"
Expand All @@ -24,7 +24,6 @@ MvNormalCDF = "0.2, 0.3"
Roots = "1, 2"
SpecialFunctions = "2"
StatsBase = "0.33, 0.34"
TaylorSeries = "0.12, 0.13, 0.14, 0.15"
julia = "1.6.0"

[extras]
Expand Down
6 changes: 1 addition & 5 deletions src/ArchimedeanCopula.jl
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,7 @@ function Distributions.cdf(C::CT,u) where {CT<:ArchimedeanCopula}
end
ϕ⁽¹⁾(C::CT, t) where {CT<:ArchimedeanCopula} = ForwardDiff.derivative(x -> ϕ(C,x), t)
function ϕ⁽ᵈ⁾(C::ArchimedeanCopula{d},t) where d
X = Taylor1(eltype(t),d)
taylor_expansion = ϕ(C,t+X)
coef = getcoeff(taylor_expansion,d) # gets the dth coef.
der = coef * factorial(d) # gets the dth derivative of $\phi$ taken in t.
return der
return TaylorDiff.derivative(x -> ϕ(C,x), t, d)
end
function Distributions._logpdf(C::CT, u) where {CT<:ArchimedeanCopula}
d = length(C)
Expand Down
2 changes: 1 addition & 1 deletion src/Copulas.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ end Copulas
import Roots
using Distributions
using StatsBase
using TaylorSeries
import TaylorDiff
import ForwardDiff
import Cubature
import MvNormalCDF
Expand Down
Loading