-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Constistent simulator output #89
Comments
Possibilites to the undefined histogram in the last example:
|
The empty dictionary sounds like the best solution. The counts should always be present (to have at least one reliable output), but in this case there never was a measurement to produce such a count, so empty counts seem right. Maybe use an empty string and assign it the number of shots as value This issue should stay open until it is included in the documentation (either as an ADR or as part of the general documentation on writing plugins, but on its own page). |
The main issue is now resolved through documentation: https://qhana-plugin-runner.readthedocs.io/en/latest/plugin-types/circuit-executor.html Keeping the issue open, as some simulators do not output the statevector after all measurements. For now, these plugins should output a statevector with a different file name. |
Simulator Plugins (i.e., Qiskit Simulator) have the ability to produce histograms for measurement frequencies and statevector outputs. The contents of the statevector output in particular depends on whether the measurement of the circuit has been performed or not. This issue documents the expected behaviour and (if necessary) fixes the behaviour in the existing simulator.
Expected Behavior
The simulator plugins accept QASM code that might contain measurements. The QASM code should be exectued as is (i.e., including possible measurements). The measurement output (the frequency histogram) should reflect the measurements in the classical registers as specified in the QASM code. The statevector output should contain the statevector over the whole system after the whole QASM input is executed.
Why?
Examples
Note that the statevector output might differ in its format from the examples here (i.e. list of string, oder dict: index -> complex...). This issue does not specify this format.
Measurement of all qubits
Output Histogram:
{'010': 514, '001': 510}
Output Statevector*:
Measurement of a subset of qubits
Output Histogram:
{'11': 513, '00': 511}
Output Statevector*:
No measurement (but classical register is defined => there is an output histogram)
Output Histogram:
{'00': 1024}
Output Statevector:
No measurement (and classical register is not defined)
Output Statevector:
The output histogram for this case is somewhat undefined: Since there is no classical register, it is not clear what should be returned. For example, Qiskit then returns a list of measurment probabilities for the histogram (i.e., not the frequencies w.r.t. the shots but actual probabilities):
{'000': 0.25, '001': 0.25, '110': 0.25, '111': 0.25}
. However, it can not be assumed that every simulator library behaves this way. Therefore, this case should be further specified in this issue (see dicsussion).*The statevector for these examples depends the measurement operation. I.e., there could be other statevectors obtained from this quantumcircuit since the measurement collapses the superposition to multiple possible statevectors.
The text was updated successfully, but these errors were encountered: