jaxvacua.util#
General-purpose utility functions used across JAXVacua.
Purpose#
Collect package-wide helpers that are intentionally independent of the physics class hierarchy, including random-number handling, batching, serialisation, diagnostics and integer-lattice routines.
Main public API#
Random helpers:
PRNGSequence,random_uniform,random_integerand related sampling utilities.JAX helpers: vectorisation, caching, flatten/unflatten adapters and small wrappers for compiled workflows.
IO and diagnostics: pickle helpers, timing/timeout utilities and progress helpers used by search scripts.
Integer and lattice helpers such as
extended_euclideanandorthogonal_lattice.
Design notes#
The file is organised into thematic sections separated by banners. Functions kept here should remain generic enough to be reused without importing the large geometry or flux-EFT modules.
PRNG / random sampling#
|
Splittable JAX PRNG key generator. Adopted from CYJax. |
|
Sample uniformly distributed real numbers on |
|
Sample uniformly distributed integers on |
|
JIT-compiled version of |
|
JIT-compiled version of |
JIT / vmap helpers#
The auto-vectorisation helper auto_vmap() fixes the shapes of the
standard JAXVacua inputs — the complex-structure moduli, the axio-dilaton and
the flux vector — so that the core methods can be vmap-ped over batches of
those inputs in a controlled, testable way (the expected input shapes are set
in one place rather than re-specified at every call site).
|
JAXVacua-local wrapper around |
|
Update JAXVacua-local default sample ranks for |
Return a copy of the active JAXVacua-local auto-vmap ranks. |
|
Reset JAXVacua-local auto-vmap ranks to the package defaults. |
|
|
Update JAXVacua-local exact sample-shape defaults for |
Return a copy of the active JAXVacua-local auto-vmap shapes. |
|
Reset JAXVacua-local auto-vmap shapes to the package defaults. |
Array / numerical helpers#
|
All size- |
|
Recursively flatten an arbitrarily nested iterable of any depth. |
|
Flatten the top |
|
|
Eigenvalues of a Hermitian / symmetric matrix. |
|
|
Matrix rank under a numerical tolerance. |
Pickle I/O#
|
Load and return the contents of a (plain, uncompressed) pickle file. |
|
Load and return the contents of a gzip-compressed pickle file. |
|
Pickle |
Dict / DataFrame helpers#
|
Merge two dictionaries. For keys present in both, values are concatenated along axis 0 via |
|
Boolean outlier mask for |
Timeout / progress#
|
JAX-host-callback progress printer. |
|
Hard-interrupt the main thread. Used by |
|
Decorator factory: wrap a function to abort if its execution exceeds |
Model-data I/O#
|
Write |
Number-theoretic / lattice helpers#
Computes Bézout's identity and a unimodular integer basis transformation for an integer array \(w\). |
|
|
Returns generators of the integer lattice orthogonal to the lattice spanned by |