LowDiscrepancySampling
Documentation for LowDiscrepancySampling.
Here are two examples of how to use the package
using LowDiscrepancySampling
using CairoMakie
P = 300
N = 10
H = hammersley_set(P, N)'
let
f = Figure(resolution = (1200, 400))
ax1 = Axis(f[1, 1], title = "H1 vs H2", xlabel = "H1", ylabel = "H2")
scatter!(ax1, H[1, :], H[2, :], color = :red, markersize = 5)
ax2 = Axis(f[1, 2], title = "H1 vs H3", xlabel = "H1", ylabel = "H3")
scatter!(ax2, H[1, :], H[3, :], color = :blue, markersize = 5)
ax3 = Axis(f[1, 3], title = "H1 vs H4", xlabel = "H1", ylabel = "H4")
scatter!(ax3, H[1, :], H[4, :], color = :magenta, markersize = 5)
f
end

using LowDiscrepancySampling
using CairoMakie
n = 1000
corput_points = [ (corput(i, 2), corput(i, 3)) for i in 1:n ]
hammersley_points = hammersley_set(n, 2)
let
f = Figure(resolution = (800, 400))
ax1 = Axis(f[1, 1], title = "Corput Sequence (2D)", xlabel = "x", ylabel = "y")
scatter!(ax1, first.(corput_points), last.(corput_points), color = :dodgerblue, markersize = 8)
ax2 = Axis(f[1, 2], title = "Hammersley Set (2D)", xlabel = "x", ylabel = "y")
scatter!(ax2, hammersley_points[:, 1], hammersley_points[:, 2], color = :orangered, markersize = 8)
f
end

LowDiscrepancySampling.corput
— Functioncorput(n::Int, b::Int=2)
Computes the n-th number in the van der Corput sequence in base b
using digit reversal. Follows the standard definition: qₙ = ∑ dₖ(n) * b^(-k-1)
LowDiscrepancySampling.halton
— Methodhalton(n::Int, d::Int)
Generates the nth Halton sequence vector in d
dimensions.
LowDiscrepancySampling.hammersley_set
— Methodhammersley_set(n, d)
Generate the Hammersley point set of n
points in d
dimensions. The first dimension is a uniform grid, the remaining dimensions use the radical inverse with different bases.
Arguments
n::Int
: Number of pointsd::Int
: Number of dimensions (d >= 2)
Returns
Array{Float64,2}
: n x d matrix of points