diff --git a/Project.toml b/Project.toml index 501afc8..1924c69 100644 --- a/Project.toml +++ b/Project.toml @@ -6,6 +6,7 @@ version = "0.3.0" [deps] CovarianceSelection = "fb9f034c-9bf8-4e47-a0a4-723273363029" LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" +PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a" ProximalBase = "0a755509-c5b1-5d6f-9b24-59bcda3c37a3" ProximalSolvers = "fc4971f5-6616-4709-9bfc-89a819252f6b" Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" @@ -24,6 +25,7 @@ CovarianceSelection = "0.1" Ipopt = "1" JuMP = "1" LinearAlgebra = "1" +PrecompileTools = "1" ProximalBase = "0.5" ProximalSolvers = "0.1" Random = "1" diff --git a/src/DiffPrecTest.jl b/src/DiffPrecTest.jl index a01fce8..91effe6 100644 --- a/src/DiffPrecTest.jl +++ b/src/DiffPrecTest.jl @@ -647,11 +647,6 @@ function estimate( DiffPrecResultNormal(Δab, sqrt(v)) end - - - - - - +include("precompile.jl") end diff --git a/src/precompile.jl b/src/precompile.jl new file mode 100644 index 0000000..a416c35 --- /dev/null +++ b/src/precompile.jl @@ -0,0 +1,25 @@ +#################################### +# +# Precompilation +# +#################################### + +# The estimators' first calls, compiled into the package image. PrecompileTools +# runs this workload when the package is precompiled; the preference +# `precompile_workload = false` skips it. +using PrecompileTools: @setup_workload, @compile_workload + +@setup_workload begin + p, n = 5, 300 + Σy = [0.5^abs(i - j) for i in 1:p, j in 1:p] + X = randn(Xoshiro(1), n, p) + Y = randn(Xoshiro(2), n, p) * cholesky(Σy).U + @compile_workload begin + estimate(SymmetricNormal(), X, Y, 2, 1) + estimate(AsymmetricNormal(), X, Y, 2, 1) + estimate(SeparateNormal(), X, Y, 2, 1) + estimate(ReducedNormal(), X, Y, tril_index(p, 2, 1)) + straps, = bootstrap(X, Y; bootSamples = 2) + simulCIstudentized(straps, 0.95) + end +end