I am trying to make a quantum circuit with one qubit and 2 classical bits for each measurment in the system below:
I want to make condition on the first bit: if the first collapse to zero so x operator is act on the circuit, else (one) nothing is acting on the circuit.
I am using qiskit language.
but when I try to create my circuit, there is always an error:
#definitions
q = QuantumRegister(1)
c = ClassicalRegister(2)
qc = QuantumCircuit(q,c)
# building the circuit
qc.h(q)
qc.measure(q[0],c[0])
qc.x(q[0]).c[0]_if(c[0], 0)
qc.measure(q[0],c[1])
circuit_drawer(qc)
and the error is:
File "<ipython-input-4-66c70285946b>", line 3
qc.x(q[0]).c[0]_if(c[0], 0)
^
SyntaxError: invalid syntax
how to write it correctly?
When I try to change
qc.x(q[0]).c[0]_if(c[0], 0)
with:
qc.x(q).c_if(c, 0)
I succeed in building my circuit but I get circuit that I don`t want to work with:
I wish for help, thanks.