dwavesystems / dwave-gate

dwave-gate is a software package for constructing, modifying and running quantum circuits on the provided state-vector simulator.
Apache License 2.0
12 stars 7 forks source link

Consider adding unknown qubits to a circuit automatically #16

Open arcondello opened 1 year ago

arcondello commented 1 year ago
from dwave.gate import Circuit, Qubit
from dwave.gate.operations import SWAP

c = Circuit(1)

q2 = Qubit("q2")

with c.context as reg:
    q1 = reg[0]

    SWAP([q1, q2])

currently raises

ValueError: Qubit '<qubit: q2, id:q0dt>' not in circuit.

it would be nice if the qubit would be automatically added to the circuit.

Additional Considerations This might end up adding too much complication, the error message is already super clear so the current behavior make sense as well.