Skip to content

Commit dd72dd4

Browse files
committed
Move MvNormalCDF to test-only dependencies
1 parent 6587798 commit dd72dd4

File tree

3 files changed

+8
-11
lines changed

3 files changed

+8
-11
lines changed

Project.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ version = "0.1.33"
44
authors = ["Oskar Laverny"]
55

66
[deps]
7+
BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf"
78
Combinatorics = "861a8166-3701-5b0c-9a16-15d98fcdc6aa"
89
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
910
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
1011
HCubature = "19dc6840-f33b-545b-b366-655c7e3ffd49"
1112
LambertW = "984bce1d-4616-540c-a9ee-88d1112d94c9"
1213
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
1314
LogExpFunctions = "2ab3a3ac-af41-5b50-aa03-7779005ae688"
14-
MvNormalCDF = "37188c8d-bc69-4638-b057-733e744175ec"
1515
Optim = "429524aa-4258-5aef-a3af-852621145aeb"
1616
PolyLog = "85e3b03c-9856-11eb-0374-4dc1f8670e7f"
1717
Primes = "27ebfcd6-29c5-5fa9-bf4b-fb8fc14df3ae"
@@ -20,6 +20,7 @@ QuadGK = "1fd47b50-473d-5c70-9696-f719f8f3bcdc"
2020
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
2121
Roots = "f2b01f46-fcfa-551c-844a-d8ac1e96c665"
2222
SpecialFunctions = "276daf66-3868-5448-9aa4-cd146d93841b"
23+
StableRNGs = "860ef19b-820b-49d6-a774-d7a799459cd3"
2324
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
2425
StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"
2526
StatsFuns = "4c63d2b9-4356-54db-8cca-17b64c39e42c"
@@ -34,6 +35,7 @@ CopulasPlotsExt = ["Plots", "RecipesBase"]
3435

3536
[compat]
3637
Aqua = "v0.8"
38+
BenchmarkTools = "1.6.0"
3739
Combinatorics = "1"
3840
Distributions = "0.25"
3941
ForwardDiff = "0.10, 1"
@@ -67,6 +69,7 @@ Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
6769
HypothesisTests = "09f84164-cd44-5f33-b23f-e6b0d136a0d5"
6870
InteractiveUtils = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
6971
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
72+
MvNormalCDF = "37188c8d-bc69-4638-b057-733e744175ec"
7073
StableRNGs = "860ef19b-820b-49d6-a774-d7a799459cd3"
7174
StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"
7275
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

src/Copulas.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ module Copulas
1010
import StatsFuns
1111
import ForwardDiff
1212
import HCubature
13-
import MvNormalCDF
1413
import Combinatorics
1514
import LogExpFunctions
1615
import QuadGK

src/EllipticalCopulas/GaussianCopula.jl

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -143,15 +143,10 @@ function qmc_orthant_normal!(Σ::AbstractMatrix{T}, b::AbstractVector{T}; m::Int
143143
(ch, bs) = _chlrdr_orthant!(Σ, b) # ¡muta Σ y b!
144144
qmc_orthant_core!(ch, bs; m=m, r=r, rng=rng)
145145
end
146-
function Distributions.cdf(C::CT, u::AbstractVector; method::Symbol = :qmc, m::Integer = 1000*length(C), r::Int = 12, rng = Random.default_rng()) where {CT<:GaussianCopula}
146+
function Distributions.cdf(C::GaussianCopula{d, MT}, u::AbstractVector; m::Integer = 1000*d, r::Int = 12, rng = Random.default_rng()) where {d, MT}
147147
x = StatsBase.quantile.(Distributions.Normal(), u)
148-
d = length(C)
149-
if method == :qmc
150-
Tx = eltype(x)
151-
Σ_promoted = Tx.(copy(C.Σ))
152-
p, _ = qmc_orthant_normal!(Σ_promoted, x; m=m, r=r, rng=rng)
153-
elseif method == :normal
154-
p = MvNormalCDF.mvnormcdf(C.Σ, fill(-Inf, d), x)[1]
155-
end
148+
Tx = eltype(x)
149+
Σ_promoted = Tx.(copy(C.Σ))
150+
p, _ = qmc_orthant_normal!(Σ_promoted, x; m=m, r=r, rng=rng)
156151
return p
157152
end

0 commit comments

Comments
 (0)