global_defs#
In global_defs, users can define and check global constants used in the simulation,
including datatypes, random keys, and Hilbert space information. The settings should
be done right after importing Quantax, and before defining any model or state.
- quantax.set_default_dtype(dtype: dtype) None#
Set the default data type in Quantax. Recommended to be
jnp.float64orjnp.complex128. Default tojnp.float64.Note
This doesn’t alter the computation inside
quantax.model.
- quantax.get_default_dtype() dtype#
Return the default data type in Quantax.
- quantax.get_real_dtype() dtype#
Return the default real data type in Quantax. If the default data type is complex, then return the corresponding real data type.
- quantax.is_default_cpl() bool#
Return whether the default data type is complex.
- quantax.set_random_seed(seed: int) None#
Set the initial random seed in Quantax. Default to be 42.
- quantax.get_subkeys(num: int | None = None) Array#
Get jax keys stored in Quantax. The keys are replicated across all devices.
- Parameters:
num – The number of returned keys. If
numis not given, then return only 1 key instead of an array of keys.
Warning
This function is not jittable, because it reads and writes the global key stored in quantax.
- quantax.PARTICLE_TYPE(*values)#
The enums to distinguish different particle types.
0: spin
1: spinful_fermion
2: spinless_fermion
(Not implemented) 3: boson