Marz is a measurement and reset simplification routine that collapses measure + reset pairs of operations on into a single measurement followed by a conditional-x gate. This optimization is suitable for use on IBM Quantum systems where the reset operation is performed by a measurement followed by a conditional x-gate:
marz
therefore saves one measurement per operation pair. Because measurements are the operations with the largest error rates on IBM Quantum systems, and each measurement takes ~2 CNOT gates worth of time, this optimization reduces error rates, and can reduce the duration (dephasing) of quantum circuits that impliment qubit reuse. It can also eliminate the dreaded BufferOverflow
error where measurement results are beinging generated faster than they can be stored.
pip install marz
Marz is really easy to use as it has a single function:
import marz
optim_circ = marz.collapse_meas_reset_pairs(input_circ)
One can also pass a list of circuits and get a list of optimized circuits back.