qml.labs.resource_estimation.QubitManager¶
- class QubitManager(work_wires, algo_wires=0, tight_budget=False)[source]¶
Bases:
object
Manages and tracks the auxiliary and algorithmic qubits used in a quantum circuit.
- Parameters:
work_wires (int or Dict[str, int]) – Number of work wires or a dictionary containing number of clean and dirty work wires. All
work_wires
are assumed to be clean when int is provided.algo_wires (int) – Number of algorithmic wires, default value is
0
.tight_budget (bool) – Determines whether extra clean qubits can be allocated when they exceed the available amount. The default is
False
.
Example
>>> q = QubitManager( ... work_wires={"clean": 2, "dirty": 2}, ... tight_budget=False, ... ) >>> print(q) QubitManager(clean=2, dirty=2, logic=0, tight_budget=False)
Attributes
Returns the number of algorithmic qubits.
Returns the number of clean qubits.
Returns the number of dirty qubits.
Returns the number of total qubits.
- algo_qubits¶
Returns the number of algorithmic qubits.
- clean_qubits¶
Returns the number of clean qubits.
- dirty_qubits¶
Returns the number of dirty qubits.
- total_qubits¶
Returns the number of total qubits.
Methods
allocate_qubits
(num_qubits)Allocates extra clean qubits.
free_qubits
(num_qubits)Frees dirty qubits and converts them to clean qubits.
grab_clean_qubits
(num_qubits)Grabs clean qubits.
- allocate_qubits(num_qubits)[source]¶
Allocates extra clean qubits.
- Parameters:
num_qubits (int) – number of qubits to be allocated