# Quantum computer simulators with proper measurements

I have been looking for quantum computer simulators and came across QCAD (http://qcad.osdn.jp/). It is stated on their website that "Measurement gates on QCAD are different from real measurements."

I wonder if other simulators, like those listed on Quantiki (https://quantiki.org/wiki/list-qc-simulators), might have the same problem of incorrectly mapping the design with the experimental values.

• Community votes, please: is this a) ontopic and b) not too broad?
– Raphael
Mar 18, 2016 at 8:13
• Perhaps you can do the research yourself and report your results here. Mar 18, 2016 at 12:34
• Questions about specific tools or software packages are generally not appropriate here. See our help center.
– D.W.
Mar 19, 2016 at 21:15

## 1 Answer

Based on QCAD's help file, their measurement gates are more like measure-later-suggestions:

The measurement gates on QCAD only set "measurement flags". After the calculation, the measurement is performed.

I'm very surprised they would return a wrong answer instead of throwing an error. Most simlators won't do this, and if they do it should be reported as a bug.

For example, I use the same cheat in my own simulator (which you can play with in your browser), but I prevent any later operations that would cause the result to differ compared to deferring the measurement. So it lets you hit a measured qubit with a NOT gate, but a Hadamard gate or a controlled-by-unmeasured-qubit NOT gate will be forcibly disabled. Which is frustrating, but at least not misleading.

# But Why?

The reason this limitation exists is efficiency. It's the difference between $\Theta(4^n)$ operations and $\Theta(2^n)$ operations needed to simulate a gate applied to an $n$-qubit system. Operations on mixed states are much more expensive to simulate than operations on pure states, and deferring measurement allows the simulation to only use pure states.

# Workaround

A simple workaround for this limitation is to include an extra qubit, CNOT the value you wanted to measure onto the extra qubit, then measure the extra qubit. This is mathematically equivalent to measuring the original qubit, but will sidestep the limitation in the simulator that prevents you from then doing more things with the original qubit and still getting the correct result.

# Easy Alternatives w/o By-Design Silent Mistakes

Microsoft's LiQui|>

Davy Wybiral's toy in-browser simulator

"Quirk", my own toy in-browser simulator

• @ForAndEvenAgainst If you have any issues, report them at the github repo. Mar 21, 2016 at 4:57