LatticeRules

LatticeRules.LatticeRule32Method
LatticeRule32(file, s, n)
LatticeRule32(file, s)
LatticeRule32(file)

Returns a rank-1 lattice rule in s dimensions with generating vector z read from the file file and with at most n points.

Examples

julia> z_file = K_3600_32_file;

julia> lattice_rule = LatticeRule32(z_file, 16)
LatticeRule32{16}

julia> getpoint(lattice_rule, 123)
16-element Array{Float64,1}:
 0.8671875
 0.9609375
 0.6015625
 0.8984375
 0.6484375
 0.6328125
 0.3203125
 0.2890625
 0.0234375
 0.1015625
 0.7890625
 0.0703125
 0.6953125
 0.0234375
 0.1171875
 0.0859375

See also: getpoint, ShiftedLatticeRule32

source
LatticeRules.LatticeRule32Method
LatticeRule32(z, s, n)
LatticeRule32(z, s)
LatticeRule32(z)

Returns a rank-1 lattice rule in s dimensions with generating vector z and at most n points.

When no maximum number of points n is provided, we assume n = typemax(UInt32) = 2^32 - 1. When no number of dimensions s is provided, we assume s = length(z).

Info

Technically, we return an extensible lattice sequence where the k-th point is transformed using the gray coded radical inverse function. This has the advantage that we can add points to the lattice without changing the already computed points.

More generating vectors can be found online here or here.

Examples

julia> lattice_rule = LatticeRule32([UInt32(1), UInt32(5)], 2, 8) # Fibonacci lattice
LatticeRule32{2}

julia> getpoint(lattice_rule, 2)
2-element Array{Float64,1}:
 0.25
 0.25

See also: getpoint, ShiftedLatticeRule32

source
LatticeRules.LatticeRule32Method
LatticeRule32(s)

Returns a rank-1 lattice rule in s dimensions that uses a default generating vector with order-2 weights.

Examples

julia> lattice_rule = LatticeRule32(16)
LatticeRule32{16}

julia> getpoint(lattice_rule, 123)
16-element Array{Float64,1}:
 0.8671875
 0.5390625
 0.6015625
 0.3671875
 0.6796875
 0.8203125
 0.3046875
 0.8515625
 0.7109375
 0.6328125
 0.5703125
 0.2578125
 0.6953125
 0.0390625
 0.2421875
 0.4453125

See also: getpoint, ShiftedLatticeRule32

source
LatticeRules.ShiftedLatticeRule32Method
ShiftedLatticeRule32(s)

Returns a shifted rank-1 lattice rule in s dimensions that uses a default generating vector with order-2 weights and a randomly generated shift vector.

Examples

julia> shifted_lattice_rule = ShiftedLatticeRule32(16)
ShiftedLatticeRule32{16}

julia> shifted_lattice_rule[0]
16-element Array{Float64,1}:
 0.23603334566204692
 0.34651701419196046
 0.3127069683360675
 0.00790928339056074
 0.4886128300795012
 0.21096820215853596
 0.951916339835734
 0.9999046588986136
 0.25166218303197185
 0.9866663668987996
 0.5557510873245723
 0.43710797460962514
 0.42471785049513144
 0.773223048457377
 0.2811902322857298
 0.20947237319807077

See also: getpoint, ShiftedLatticeRule32

source
LatticeRules.ShiftedLatticeRule32Method
ShiftedLatticeRule32(lattice_rule)
ShiftedLatticeRule32(lattice_rule, shift)

Returns a shifted rank-1 lattice rule based on the lattice rule lattice_rule using the random shift shift. If no random shift is provided, we use shift = rand(length(lattice_rule)).

Examples

julia> lattice_rule = LatticeRule32(16)
LatticeRule32{16}

julia> shifted_lattice_rule = ShiftedLatticeRule32(lattice_rule)
ShiftedLatticeRule32{16}

julia> getpoint(shifted_lattice_rule, 0)
16-element Array{Float64,1}:
 0.23603334566204692
 0.34651701419196046
 0.3127069683360675
 0.00790928339056074
 0.4886128300795012
 0.21096820215853596
 0.951916339835734
 0.9999046588986136
 0.25166218303197185
 0.9866663668987996
 0.5557510873245723
 0.43710797460962514
 0.42471785049513144
 0.773223048457377
 0.2811902322857298
 0.20947237319807077

See also: LatticeRule32, getpoint

source
LatticeRules.getpointMethod
getpoint(lattice_rule, k)

Get the k-th point of the lattice rule lattice_rule.

Note

An alternative syntax is getindex(lattice_rule, k) or lattice_rule[k], this allows you to write the one-liner Q = mean(f.(lattice_rule[0:N-1])) for the quasi-Monte Carlo estimator for $E[f]$.

julia> lattice_rule = LatticeRule32(2)
LatticeRule32{2}

julia> getpoint(lattice_rule, 3)
2-element Array{Float64,1}:
 0.75
 0.25

See also: LatticeRule32, ShiftedLatticeRule32

source