Module: qmc

Quasi-Monte Carlo: low-discrepancy sequences and space filling designs, in the spirit of scipy.stats.qmc.

Source:
Example
import { qmc } from 'randlibjs'
const sobol = new qmc.Sobol(2, { scramble: false })
sobol.random(4)   // [[0, 0], [0.5, 0.5], [0.75, 0.25], [0.25, 0.75]]
qmc.scale(sobol.random(4), [-1, 0], [1, 10])

Classes

Halton
LatinHypercube
PoissonDisk
Sobol
QMCEngine

Namespaces

qmc

Methods

(static) discrepancy(sample, methodopt) → {number}

Discrepancy of a sample in the unit hypercube (lower is more uniform), as scipy.stats.qmc.discrepancy.

Parameters:
Name Type Attributes Default Description
sample Array.<Array.<number>>

Points in [0, 1]^d.

method string <optional>
'CD'

'CD' (centered L2), 'WD' (wrap-around), 'MD' (mixture) or 'L2-star'.

Source:
Returns:

The squared discrepancy.

Type
number

(static) scale(sample, lower, upper, reverseopt) → {Array.<Array.<number>>}

Scales a sample from the unit hypercube to [lower, upper] bounds (or back, with reverse).

Parameters:
Name Type Attributes Default Description
sample Array.<Array.<number>>

Points.

lower Array.<number>

Lower bounds per dimension.

upper Array.<number>

Upper bounds per dimension.

reverse boolean <optional>
false

Map from the bounds back to the unit hypercube.

Source:
Returns:
Type
Array.<Array.<number>>

(inner) directionNumbers()

Direction numbers V_j (scaled to BITS bits) from [poly, m_1..m_s].

Source:

(inner) using()

Runs fn with the optional generator's bit generator, or the active one.

Source: