/** * Scales a sample from the unit hypercube to [lower, upper] bounds (or back, with `reverse`). * * @param {number[][]} sample - Points. * @param {number[]} lower - Lower bounds per dimension. * @param {number[]} upper - Upper bounds per dimension. * @param {boolean} [reverse=false] - Map from the bounds back to the unit hypercube. * @returns {number[][]} */ export function scale(sample: number[][], lower: number[], upper: number[], reverse?: boolean): number[][]; /** * Discrepancy of a sample in the unit hypercube (lower is more uniform), as * `scipy.stats.qmc.discrepancy`. * * @param {number[][]} sample - Points in [0, 1]^d. * @param {string} [method='CD'] - 'CD' (centered L2), 'WD' (wrap-around), 'MD' (mixture) or 'L2-star'. * @returns {number} The squared discrepancy. */ export function discrepancy(sample: number[][], method?: string): number; /** * Sobol' low-discrepancy sequence (Joe–Kuo direction numbers, Gray code order), optionally * scrambled with a random linear matrix scramble and digital shift (as scipy). Supports up to * 256 dimensions with the bundled direction numbers, or more with `options.directions`. * * Unscrambled points are identical to `scipy.stats.qmc.Sobol(d, scramble=False)`. * Use sample sizes that are powers of 2 to keep the balance properties. */ export class Sobol extends QMCEngine { /** * @param {number} d - Dimension. * @param {Object} [options] * @param {boolean} [options.scramble=true] - Apply LMS + digital shift scrambling. * @param {Object} [options.rng] - `Generator` used for the scrambling (global generator otherwise). * @param {number[][]} [options.directions] - Custom direction numbers `[poly, m_1, ..., m_s]` per dimension. */ constructor(d: number, options?: { scramble?: boolean; rng?: any; directions?: number[][]; }); v: number[][]; shift: any[]; /** @private */ private _scramble; /** @private */ private _reset; state: any[]; index: number; /** @private */ private _random; } /** * Halton sequence (van der Corput radical inverses in the first `d` prime bases), optionally * scrambled with random digit permutations. Unscrambled points are identical to * `scipy.stats.qmc.Halton(d, scramble=False)`. */ export class Halton extends QMCEngine { /** * @param {number} d - Dimension (up to 1000). * @param {Object} [options] * @param {boolean} [options.scramble=true] - Apply random digit permutations. * @param {Object} [options.rng] - `Generator` used for the scrambling. */ constructor(d: number, options?: { scramble?: boolean; rng?: any; }); bases: number[]; perms: any; /** @private */ private _reset; index: number; /** @private */ private _random; } /** * Latin hypercube sampling: each of the `n` equal-width strata of every axis contains exactly * one point. Each call to `random(n)` produces an independent design. */ export class LatinHypercube extends QMCEngine { /** * @param {number} d - Dimension. * @param {Object} [options] * @param {boolean} [options.centered=false] - Put points at the centre of the strata. * @param {Object} [options.rng] - `Generator` to draw from. */ constructor(d: number, options?: { centered?: boolean; rng?: any; }); centered: boolean; /** @private */ private _reset; /** @private */ private _random; } /** * Poisson disk sampling (Bridson's algorithm) in the unit hypercube: random points that are * never closer than `radius` to each other, giving blue-noise designs. */ export class PoissonDisk extends QMCEngine { /** * @param {number} d - Dimension. * @param {Object} [options] * @param {number} [options.radius=0.05] - Minimal distance between points. * @param {number} [options.ncandidates=30] - Candidates tried around each active point. * @param {Object} [options.rng] - `Generator` to draw from. */ constructor(d: number, options?: { radius?: number; ncandidates?: number; rng?: any; }); radius: number; ncandidates: number; cell: number; gridSize: number; /** @private */ private _reset; points: any[]; active: any[]; grid: Map; started: boolean; /** @private */ private _key; /** @private */ private _fits; /** @private */ private _add; /** @private */ private _random; /** * Fills the hypercube until no more points fit. * @returns {number[][]} */ fillSpace(): number[][]; } /** * Quasi-Monte Carlo namespace. * @namespace qmc */ export const qmc: Readonly<{ Sobol: typeof Sobol; Halton: typeof Halton; LatinHypercube: typeof LatinHypercube; PoissonDisk: typeof PoissonDisk; scale: typeof scale; discrepancy: typeof discrepancy; }>; /** * Base class of the QMC engines. * @abstract */ declare class QMCEngine { constructor(d: any, options?: {}); d: any; rng: any; numGenerated: number; /** * Draws the next `n` points in [0, 1)^d. * @param {number} [n=1] * @returns {number[][]} */ random(n?: number): number[][]; /** * Restarts the sequence (the scrambling, if any, is kept). * @returns {this} */ reset(): this; /** * Skips the next `n` points. * @param {number} n * @returns {this} */ fastForward(n: number): this; } export {};