PartialState¶
- class guppylang.emulator.PartialState(*args, **kwargs)[source]¶
Protocol for an emulator state type. Different simulation backends may have different state representations.
- __init__(*args, **kwargs)¶
- as_single_state(zero_threshold: float = 1e-12) S[source]¶
If the state is a single pure state return it.
- Args:
- zero_threshold: Threshold for considering a state amplitude to be zero.
Defaults to 1e-12.
- Raises:
NotSingleStateError: If the state is not a pure state.
- Returns:
The state as a single state type.
- state_distribution(zero_threshold: float = 1e-12) list[TracedState[S]][source]¶
Distribution of states after tracing out unspecified qubits. In general this results in a distribution of states, each with a probability.
- Args:
- zero_threshold: Threshold for considering a state amplitude to be zero.
Defaults to 1e-12.
- Returns:
List of traced states, each with a state vector and a probability.