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#
|
Build a JIT-compiled, vmapped wrapper around |
|
Cached variant of |
|
Wrap |
Build a wrapper that re-JITs |
|
|
Heuristic test for whether |
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 |
Pytree flatten / unflatten#
Generic flatten / unflatten functions used by register_pytree_node for
the project’s pytree-registered classes (periods, css, FluxEFT,
Conifold).
|
Flatten |
|
Inverse of |
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 |