-
Notifications
You must be signed in to change notification settings - Fork 29
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
Phases of the final states shifted #34
Comments
@DevelopDaily Just curious, how to you test the results? Run it via qpp? If yes, does it produce the same state with an older qpp version which didn't have softwareQinc/qpp#99 fixed? |
Yes, all my tests are done by |
I can't seem to reproduce the
Using the standard Could you paste your |
|
My results:
|
@DevelopDaily Thanks for sending that! I can reproduce the results of
That would explain the phase difference in the results I was getting. It seems like the issue is due to how particular gates are handled in
The files
I get the same outputs with On the other hand, both results are different from the output of At any rate, I'm relatively convinced this isn't an error in either case, just that |
@meamy A very good catch of the The peculiar thing is that there are two versions of |
Yes I think this is what I was referring to. At some point we had made some changes to At any rate sorry for the confusion! We'll work to unify the approach to standard gates. I'll leave this open until we can sort that out. @vsoftco Maybe it makes sense to have a single "softwareQ" version of the |
@meamy Certainly, as we seem to bump into almost-duplicate specs that create confusion. I'll take a look, thanks! One of the issues is that even Qiskit is not fully OpenQASM compliant: it defines CU3 as https://github.com/Qiskit/qiskit-terra/blob/21f78dc5ee236d51697e65db916ccd04f4dfc3bc/qiskit/circuit/library/standard_gates/u3.py#L176 (and we stuck with that in qpp), whereas OpenQASM definition is defined above: #34 (comment) So we should either comply with one or another. Qiskit seem to have a large user base, so I'm tempted to comply with Qiskit (and in fact I documented that in qpp when defining the gates) |
@vsoftco Just a friendly reminder. Whatever you do, please keep in mind the arguments and design decisions you made in the
In my opinion, it is the QISKIT implementation and the Open QASM spec itself that muddy the water. The page 5 of the spec says "For example,
Albeit a Hadamard, it does not look like what people are used to. For that reason, I speculate, the QISKIT people made a design decision, perhaps a wrong one, to shift the phase globally. That is the source of our grief now. Consequently, I cannot run any applications based on the phase estimation algorithm written in QASM, even though I can run them perfectly when they are written in I kind of like what @meamy suggested. A "softwareQ" version/implementation may be a solution? Then, for all other platforms (with various rotations, endianness, spec interpretations, spec extensions or whatever incompatibilities and quirks), |
@DevelopDaily Indeed, thanks. We will fix this soon. My only slight concern is with q++, as it's a header-only library and shouldn't depend on config files etc. We'll figure out a way of keeping the design elegant and address this annoying issue. |
@DevelopDaily Fixed with the new parser decoupling from both qpp and staq |
@meamy You may be aware of the
qpp
issue that has been fixed by @vsoftco.I think there may be something to do at the
staq
side.I attached two files
in.qasm
andout.qasm
.2files.zip
The latter is the result of running this command:
./staq -S -O3 -o out.qasm in.qasm
The two files do not produce the same final states. Could you please take a look at them?
To process my QASM files, I did expand the
qelib1.inc
by adding a few controlled gates and added their references to the thestaq
source code locally:The text was updated successfully, but these errors were encountered: