Program.get_qubits

Program.get_qubits(indices=True)[source]

Returns all of the qubit indices used in this program, including gate applications and allocated qubits. e.g.

>>> p = Program()
>>> p.inst(("H", 1))
>>> p.get_qubits()
{1}
>>> q = p.alloc()
>>> p.inst(H(q))
>>> len(p.get_qubits())
2
Parameters:indices (bool) – Return qubit indices as integers intead of the wrapping Qubit object
Return type:Set[Union[Qubit, QubitPlaceholder, int]]
Returns:A set of all the qubit indices used in this program