jaxvacua.sampling.sample_in_ellipsoid#
- sample_in_ellipsoid(key, m, q, n)#
Draw rounded integer points from a positive-definite ellipsoid.
A uniform draw
xin the unit ball is mapped tou = sqrt(2*q) M^{-1/2} x. Before rounding this satisfies1/2 u.T @ M @ u <= q. Rounding can move some points across the bound, so callers should reconstruct the full flux and re-check the signed tadpole.- Parameters:
key (
Array) – PRNG key.m (
Array) – Symmetric positive-definite matrix of shape(d, d).q (
float|Array) – Ellipsoid bound for the continuous draw.n (
int) – Number of points to draw.
- Returns:
Array – Rounded integer-valued samples with shape
(n, d)andthe same real dtype as ``m``.
- Return type:
Array
Note
This routine assumes positive-definite input. Eigenvalues are floored at machine resolution before the inverse square root to avoid NaNs from roundoff in numerically flat directions.