neuralqx.utils.dtypes package

DType policy and JAX array initialisation utilities for neuraLQX.

class DTypePolicy(real, complex, index)

Bases: object

Canonical dtype policy for neuraLQX arrays.

real

Default real-valued array dtype.

complex

Default complex-valued array dtype.

index

Integer dtype for index and topology arrays.

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.

Parameters:

config_manager (Any | None) – Optional config manager.

Return type:

dict[str, str]

Returns:

Mapping with keys real, complex, index.

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 global neuralqx.configs.cfg singleton.

Return type:

DTypePolicy

Returns:

Effective DTypePolicy.

jax_complex_dtype(config_manager=None)

Returns the effective JAX complex dtype.

Return type:

dtype

jax_index_dtype(config_manager=None)

Returns the effective JAX index dtype.

Return type:

dtype

jax_real_dtype(config_manager=None)

Returns the effective JAX real dtype.

Return type:

dtype

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

Submodules