Quantum Computing Asked by NegativeOne on June 22, 2021
I’m struggling to get a program running where I have a circuit with a measurement and reset mid-execution and I want to use noise mitigation and state tomography together.
The circuit is defined
qreg_q = QuantumRegister(2, "q")
creg_c = ClassicalRegister(1, "c")
qc = QuantumCircuit(qreg_q, creg_c)
qc.u(1, 1, 1, qreg_q[0])
qc.cu(1, 0, 0, 0, qreg_q[0], qreg_q[1])
qc.cx(qreg_q[1], qreg_q[0])
qc.measure(qreg_q[1], creg_c[0])
qc.reset(qreg_q[1])
N.B I don’t need the measurement result here.
I then create my tomography circuits from this
from qiskit.ignis.verification.tomography import state_tomography_circuits, StateTomographyFitter
qpt_circs = state_tomography_circuits(qc, qreg_q[0])
and the calibration circuits
import qiskit.ignis.mitigation.measurement as mc
cal_qr = QuantumRegister(2)
cal_cr = ClassicalRegister(2)
meas_calibs, state_labels = mc.complete_meas_cal(qublit_list=[0])
Using a simulator with a noise-model
backend = provider.get_backend('ibmqx2')
sim = AerSimulator.from_backend(backend)
I run the calibration circuit
job_cal = sim.run(meas_calibs, shots=8192)
meas_fitter = mc.CompleteMeasFitter(job_cal.result(), state_labels)
I then run the tomography circuits
qpt_circs_compiled = transpile(qpt_circs, sim)
job_tomo = sim.run(qpt_circs_compiled, shots=8192)
result = job_tomo.result()
tomo_state = StateTomographyFitter(result, qpt_circs)
I’m able to obtain a state from the result with tomography
state = tomo_state.fit()
However the noise mitigation fails
meas_filter = meas_fitter.filter
mitigated_results = meas_filter.apply(result)
with QiskitError: "Unexpected state label '0 0', verify the fitter's state labels correspond to the input data"
.
It seems to me that the tomography circuits add a second classical register that the noise mitigation circuits isn’t configured to process properly. How can I get around this so I can mitigate the noise in my density matrix output?
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP