I was wondering if there is a way to compose a program with multiple quantum circuits without having the register reinitialized at $0$ for each circuit.
Specifically, I would like run a second quantum circuit after running the first one, as in this example:
qp = QuantumProgram() qr = qp.create_quantum_register('qr',2) cr = qp.create_classical_register('cr',2) qc1 = qp.create_circuit('B1',[qr],[cr]) qc1.x(qr) qc1.measure(qr, cr) qc1.measure(qr, cr) qc2 = qp.create_circuit('B2', [qr], [cr]) qc2.x(qr) qc2.measure(qr, cr) qc2.measure(qr, cr) #qp.add_circuit('B1', qc1) #qp.add_circuit('B2', qc2) pprint(qp.get_qasms()) result = qp.execute() print(result.get_counts('B1')) print(result.get_counts('B2'))
Unfortunately, what I get is the same result for the two runs (i.e. a count of
11 for the
B2 instead of
00 for the second, as if
B2 is run on a completely new state initialized on