View source on GitHub
|
Orchestrates allocation and reuse of helper ancilla qubits used in a circuit.
QubitManager keeps track of ancilla qubits which it can supply in either a clean, |0> state or dirty, arbitrary state. Ancilla qubits can be deallocated to become available for reuse later. Circuit creators can use QubitManager to obtain ancilla qubits without having to manually track their availability and state.
Methods
qalloc
@abc.abstractmethodqalloc( n: int, dim: int = 2 ) -> list[cirq.Qid]
Allocate n clean qubits, i.e. qubits guaranteed to be in state |0>.
qborrow
@abc.abstractmethodqborrow( n: int, dim: int = 2 ) -> list[cirq.Qid]
Allocate n dirty qubits, i.e. the returned qubits can be in any state.
qfree
@abc.abstractmethodqfree( qubits: Iterable[cirq.Qid] ) -> None
Free pre-allocated clean or dirty qubits managed by this qubit manager.
View source on GitHub