use (qn, q2) = (Qubit[n], Qubit());
.....
let result = MeasureAllZ(qn);
if (result != Zero) {
set isConstant = false;
}
I have this very simple q# snippet. When I try to run it on Azure using IonQ I got the following error
Microsoft.Quantum.Providers.Core.Processor.CannotCompareMeasurementResultException: Measurement results cannot be compared to Zero or One on the target architecture
How do I fix it?
IonQ targets in Azure Quantum don't support mid-circuit measurement: measurement has to be the last thing your code does, and it has to return the measurement results immediately. In your case, try doing return MeasureAllZ(qn);
right away.