QuantumLibraries icon indicating copy to clipboard operation
QuantumLibraries copied to clipboard

Rename MeasureInteger to make it clear it resets its input

Open Strilanc opened this issue 5 years ago • 1 comments

Describe the bug

I just lost a half hour trying to debug why a measurement was returning 0 instead of the correct value. It was because an earlier MeasureInteger had cleared the value. This is inconsistent with what the measurement operation M does, and especially problematic given that methods like MResetZ establish a convention of mentioning the reset, so it should have a distinct name like MeasureResetInteger.

To Reproduce

let a = MeasureInteger(r);
let b = MeasureInteger(r);
if (a != b) { fail "reset"; }

Strilanc avatar Nov 26 '20 00:11 Strilanc

Thanks for the feedback, and I apologize for the hassle caused! We've been working to improve the consistency of operations acting on numeric data in the proposal at #337, such I think it would make sense to incorporate your suggestion as part of that proposal. In particular, given that qubits no longer need to be returned to the zero state in order to release them (it's now sufficient for each qubit to be measured before releasing), there's a lot less need for measurement to also reset.

cgranade avatar Nov 26 '20 01:11 cgranade