Constructor
new MultivariateNormal(mean, covariance, isSingle)
Parameters:
| Name | Type | Description |
|---|---|---|
mean |
Array.<number> | posterior mean vector (length n) |
covariance |
Array.<Array.<number>> | posterior covariance matrix (n×n), symmetric positive-definite |
isSingle |
boolean | true when the GP input was a single point (number[]); false when multiple points (number[][]) |
Classes
Members
_L :Array.<Array.<number>>
- Description:
Lower-triangular Cholesky factor L of the covariance (Σ = L·Lᵀ).
- Source:
Lower-triangular Cholesky factor L of the covariance (Σ = L·Lᵀ).
Type:
- Array.<Array.<number>>
_isSingle :boolean
Type:
- boolean
_mean :Array.<number>
Type:
- Array.<number>
Methods
mean() → {number|Array.<number>}
- Description:
Posterior mean.
Returns a
numberwhenisSingleis true (single-point query), or anumber[]when false (multi-point query).
- Source:
Returns:
- Type
- number | Array.<number>
sample(rng) → {number|Array.<number>}
- Description:
Draw one sample from N(mean, Σ).
Algorithm (PORT_SPEC §8):
- z = [standardNormal(rng), …] (one N(0,1) per dimension)
- sampleVec = mean + L·z
- return fromVector(sampleVec, isSingle)
rngmust be a() => number ∈ [0, 1)function, e.g. the closure returned bymulberry32(seed). The output type mirrorsmean().Numeric note: the PRNG and Box-Muller implementation differ from Rust's
rand/rand_distr, so sample values will not match Rust bit-for-bit. Statistical correctness and reproducibility given a seed are guaranteed.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
rng |
Returns:
- Type
- number | Array.<number>