PartialVector¶
- class guppylang.emulator.PartialVector(base_state: ndarray[tuple[Any, ...], dtype[complexfloating]], total_qubits: int, specified_qubits: list[int])[source]¶
Partial state vector for simulator backends with statevector representation. Partial in the sense that some qubits may be traced out, and the state is represented as a distribution of state vectors.
- __init__(base_state: ndarray[tuple[Any, ...], dtype[complexfloating]], total_qubits: int, specified_qubits: list[int]) None[source]¶
Initialize a PartialVector from a base state vector, total qubits, and specified qubits.
- Parameters:
base_state – The state vector over all qubits in the system.
total_qubits – Total number of qubits in the system
specified_qubits – List of specified qubits in the state. Those not in this
out. (list are considered traced)
- property specified_qubits: list[int]¶
List of specified qubits in the state. Those not in this list are considered traced out.
- state_distribution(zero_threshold: float = 1e-12) list[TracedState[ndarray[tuple[Any, ...], dtype[complexfloating]]]][source]¶
Distribution of states after tracing out unspecified qubits. In general this results in a distribution of states, each with a probability.
- Parameters:
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.