From 7e63c662e1a51b9ceffd4b21f1f3c116b1944f5b Mon Sep 17 00:00:00 2001 From: kmarray98 Date: Wed, 28 Feb 2024 12:37:44 +0100 Subject: [PATCH] removing multiple precompilation --- Manifest.toml | 2 +- Project.toml | 5 ++++- src/PowerLawSamplers.jl | 20 +++++++++++++++++--- src/RandomGraph.jl | 13 ------------- src/Samplers.jl | 5 +---- src/hello | 1 - 6 files changed, 23 insertions(+), 23 deletions(-) delete mode 100644 src/hello diff --git a/Manifest.toml b/Manifest.toml index c28f1b7..42d8ba2 100644 --- a/Manifest.toml +++ b/Manifest.toml @@ -2,7 +2,7 @@ julia_version = "1.10.0" manifest_format = "2.0" -project_hash = "b63f305d0ed85d8bed38a9eb0d9764806b256538" +project_hash = "e7cfeb6672a779b8a5adb0ecf46a10b9bba4c575" [[deps.ArgTools]] uuid = "0dad84c5-d112-42e6-8d28-ef12dabb789f" diff --git a/Project.toml b/Project.toml index da359fd..87010a6 100644 --- a/Project.toml +++ b/Project.toml @@ -4,11 +4,14 @@ authors = ["Kieran Marray"] version = "0.1.0" [deps] +LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" +Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" SpecialFunctions = "276daf66-3868-5448-9aa4-cd146d93841b" [compat] -julia = "1" SpecialFunctions = "2.3" +julia = "1" + [extras] Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" diff --git a/src/PowerLawSamplers.jl b/src/PowerLawSamplers.jl index 1cd41f4..b0f53ee 100644 --- a/src/PowerLawSamplers.jl +++ b/src/PowerLawSamplers.jl @@ -1,11 +1,25 @@ module PowerLawSamplers -using SpecialFunctions +using SpecialFunctions, LinearAlgebra, Random # Write your package code here. -export doubling_up_sampler, bounded_doubling_up_sampler, inexact_sampler, pl_graph include("Samplers.jl") -include("RandomGraph.jl") +#include("RandomGraph.jl") + +function pl_graph(n, α, x_min) + G = Matrix{Float64}(zeros(n, n)) + us = rand(n) + for i in 1:n + #println(i) + neighbours = sample(1:n, bounded_doubling_up_sampler(α, x_min, us[i], n); replace=false) + G[i,neighbours] .= 1.0 + end + + return(G) + +end + +export doubling_up_sampler, bounded_doubling_up_sampler, inexact_sampler, pl_graph end diff --git a/src/RandomGraph.jl b/src/RandomGraph.jl index 70d7a6b..d3f5a12 100644 --- a/src/RandomGraph.jl +++ b/src/RandomGraph.jl @@ -1,14 +1 @@ -include("Samplers.jl") -function pl_graph(n, α, x_min) - G = Matrix{Float64}(zeros(n, n)) - us = rand(n) - for i in 1:n - #println(i) - neighbours = sample(1:n, bounded_double_up_sampler(α, x_min, us[i], n); replace=false) - G[i,neighbours] .= 1.0 - end - - return(G) - -end diff --git a/src/Samplers.jl b/src/Samplers.jl index 350905a..76e6de9 100644 --- a/src/Samplers.jl +++ b/src/Samplers.jl @@ -1,6 +1,3 @@ -using SpecialFunctions - - """ Exact sampler for observations from discrete power law distribution from Appendix D of Clauset, Shalizi, and Newman - power law distributions in empirical data. @@ -25,7 +22,7 @@ function doubling_up_sampler(α, x_min,u) while zeta(α, guess)/zeta(α, x_min) ≥ 1-u guess += 1 end - return(guess) + return(Int64(guess)) end """ diff --git a/src/hello b/src/hello deleted file mode 100644 index 8b13789..0000000 --- a/src/hello +++ /dev/null @@ -1 +0,0 @@ -