neuralqx.utils.dtypes.runtime module¶
Runtime entry points for effective dtype policy and JAX array initialisation.
This module exposes two layers of helpers:
Dtype accessors: return the effective jnp.dtype for each role
defined in DTypePolicy:
jax_real_dtype() # e.g. jnp.float64
jax_complex_dtype() # e.g. jnp.complex128
jax_index_dtype() # e.g. jnp.int64
Array producers: thin wrappers around jax.numpy that pre-fill the
dtype argument from the active policy so call sites don’t have to repeat
it:
zeros_real((3, 4)) # jnp.zeros((3, 4), dtype=jax_real_dtype())
ones_complex((2,)) # jnp.ones((2,), dtype=jax_complex_dtype())
array_real([1.0, 2.0]) # jnp.array([1., 2.], dtype=jax_real_dtype())
Each also accepts an optional config_manager keyword so callers
operating under a custom config override can propagate it without touching
global state.
- array_complex(values, *, config_manager=None)¶
Converts values to a JAX array with the effective complex dtype.
- Return type:
Array
- array_index(values, *, config_manager=None)¶
Converts values to a JAX array with the effective index dtype.
- Return type:
Array
- array_real(values, *, config_manager=None)¶
Converts values to a JAX array with the effective real dtype.
- Return type:
Array
- dtype_name_map(config_manager=None)¶
Returns effective dtype names as a plain dictionary.
- full_complex(shape, fill, *, config_manager=None)¶
Returns an array filled with fill using the effective complex dtype.
- Return type:
Array
- full_real(shape, fill, *, config_manager=None)¶
Returns an array filled with fill using the effective real dtype.
- Return type:
Array
- get_dtype_policy(config_manager=None)¶
Returns the effective dtype policy.
- Parameters:
config_manager (
Any|None) – Optional config manager. If omitted, uses the globalneuralqx.configs.cfgsingleton.- Return type:
- Returns:
Effective
DTypePolicy.
- ones_complex(shape, *, config_manager=None)¶
Returns a one-filled complex array with the effective complex dtype.
- Return type:
Array
- ones_real(shape, *, config_manager=None)¶
Returns a one-filled real array with the effective real dtype.
- Return type:
Array
- zeros_complex(shape, *, config_manager=None)¶
Returns a zero-filled complex array with the effective complex dtype.
- Return type:
Array
- zeros_index(shape, *, config_manager=None)¶
Returns a zero-filled integer array with the effective index dtype.
- Return type:
Array
- zeros_real(shape, *, config_manager=None)¶
Returns a zero-filled real array with the effective real dtype.
- Return type:
Array