merlin.core.computation_space module

Computation space definitions controlling logical basis selection.

class merlin.core.computation_space.ComputationSpace(*values)

Bases: str, Enum

Enumeration of supported computational subspaces.

DUAL_RAIL = 'dual_rail'
FOCK = 'fock'
UNBUNCHED = 'unbunched'
classmethod coerce(value)

Normalize user-provided values (enum instances or case-insensitive strings).

Parameters:

value (ComputationSpace | str) – Enum instance or case-insensitive string value.

Returns:

Normalized computation space value.

Return type:

ComputationSpace

Raises:

ValueError – If value does not match a supported computation space.

classmethod default(*, no_bunching)

Derive the default computation space from the legacy flag.

Parameters:

no_bunching (bool) – Legacy flag indicating whether bunching should be disallowed.

Returns:

Default computation space matching the legacy behavior.

Return type:

ComputationSpace