mitiq icon indicating copy to clipboard operation
mitiq copied to clipboard

Measurements followed by additional gates in a DDD circuit should return a sensible error

Open Aaron-Robertson opened this issue 2 years ago • 2 comments

Issue Description

Old issue with converted measurements is back, potentially isolated to DDD. Measurement names change resulting in an error: qiskit.circuit.exceptions.CircuitError: "Bit 'Clbit(ClassicalRegister(4, 'meas'), 0)' is not in the circuit."

How to Reproduce

  1. Use circuit:
# Qiskit test with measurement
circuit_qiskit_two = qiskit.QuantumCircuit(qreg, creg)
for q in qreg:
    circuit_qiskit_two.x(q)
    circuit_qiskit_two.x(3)
circuit_qiskit_two.measure(0, 3)
circuit_qiskit_two.cx(0, 3)
  1. Run circuit through DDD:
circuit_with_ddd = ddd.insert_ddd_sequences(circuit_qiskit_two, rule=xx_rule)

Expected behavior

Circuit should yield an error, saying that measurements cannot be made terminal (and thus the circuit is incompatible with DDD), per discussion on #1446:

Circuit has intermediate measurements that are followed by gates. In this case they cannot be pushed to the end. I think in this case we should raise an error since we are not currently able to support this case.

Aaron-Robertson avatar Aug 26 '22 16:08 Aaron-Robertson

Hi @Aaron-Robertson, do you have any update on this? I am asking since next Friday we are going to make a new release.

andreamari avatar Sep 23 '22 16:09 andreamari

Hey Aaron, wondering if you'd like this to go in the next milestone? I know you mentioned you were close, but if you need any help, let us know!

natestemen avatar Oct 06 '22 17:10 natestemen

@natestemen I've confirmed that I'm available to wrap this up, so let's add it to the milestone!

Aaron-Robertson avatar Oct 21 '22 16:10 Aaron-Robertson

hi @Aaron-Robertson, wanted to check if you're planning to work on this issue in the current milestone (0.21, closes Nov 30). If not, no worries, someone on the UF team can pick this up.

Happy to help clear any roadblocks!

Misty-W avatar Nov 04 '22 22:11 Misty-W