cirq.QubitManager

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

View source

Allocate n clean qubits, i.e. qubits guaranteed to be in state |0>.

qborrow

View source

Allocate n dirty qubits, i.e. the returned qubits can be in any state.

qfree

View source

Free pre-allocated clean or dirty qubits managed by this qubit manager.