UQ sampling
Draw seeded multivariate-normal samples over a caller-supplied covariance block and compare sample moments.
Seeded MVN sampling in the SANDY role starts from a covariance block: given a
mean vector and a covariance matrix, draw samples
and check the sample moments recover the inputs. (SANDY itself factorises
with SVD; this kernel uses Cholesky-with-eigen-clip — same distribution,
moment estimators agree.) The demo below runs the
verified nucleide-linalg kernel over caller-supplied arrays — there are
no vendored covariance stores anywhere in this path:
- Cholesky factors positive-definite blocks (
methodreadscholesky). - Eigen-clip takes over for positive-semidefinite but singular blocks
(
methodreadseigen_clipwith the unclipped extremes reported).
Seeded sampling
Set the mean, the row-major covariance, the draw count, and the seed, then
press Run sampling. The defaults replay the synthetic block from
fixtures/uq/cov_2x2.json (variances 0.25/0.16, covariance 0.10, seed
20260913 — round numbers, no evaluated data). Draws are capped at 5000 to
keep the demo slice cheap; identical inputs always yield identical
samples.
LHS mode keeps the same inputs and result shape but swaps the normal source for stratified draws — one jittered uniform per stratum per dimension (Fisher–Yates permutation, inverse-normal CDF), then the shared factor path — so the IID -SE standard-error null is the wrong benchmark: stratified draws have smaller variance than IID by construction. The kernel’s separate correctness checks (G1/G2 on the theory page) therefore require stratification-exactness (each dimension hits each of the strata exactly once at the pinned seed) and use the IID standard errors as an upper bound on the sample mean/covariance, never an equality null. LHS is a draw mode, not a perturbation convention.
Loading the live demo…
See also
- Tutorial: UQ sampling
- Theory: UQ sampling
- Crate docs:
crates/linalg/src/sample.rs