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 Vector{Float64}:
 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(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 Vector{Float64}:
 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.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 = Int64(typemax(UInt32)) + 1 = 2^32.

Note

On 32-bit Julia, typemax(UInt32) + 1 wraps to 0x00000000 because 1 is Int32. Always widen to Int64 before adding so the default limit stays 2^32 on every word size. 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 Vector{Float64}:
 0.25
 0.25

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> ndims(shifted_lattice_rule)
16

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([UInt32(1), UInt32(5)], 2, 8)
LatticeRule32{2}

julia> shifted_lattice_rule = ShiftedLatticeRule32(lattice_rule, [0.25, 0.5])
ShiftedLatticeRule32{2}

julia> getpoint(shifted_lattice_rule, 2)
2-element Vector{Float64}:
 0.5
 0.75

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 Vector{Float64}:
 0.75
 0.25

See also: LatticeRule32, ShiftedLatticeRule32

source