Closed DevelopDaily closed 2 years ago
@DevelopDaily Thanks! Will take a look and fix asap. btw, do you have any "minimal" (shorter) example that reproduces the issue?
Here is the minimal version:
OPENQASM 2.0;
include "qelib1.inc";
gate ccc ctrl, ctrl_1, ctrl_2, q0, q1, q2
{
crz(((pi/2)/2)+(pi/2)) ctrl, q0;
}
qreg q[3];
qreg ctrl_0[1];
qreg ctrl_1[1];
qreg ctrl_2[1];
x ctrl_0[0];
ccc ctrl_0[0], ctrl_1[0], ctrl_2[0], q[0], q[1], q[2];
This should be fixed as of https://github.com/softwareQinc/staq/commit/c56c95890e16eb85e18bff6356f4476101732c9a and https://github.com/softwareQinc/qpp/commit/470e38628facfb572605ddb7ea1ddec4e5e7fb00, both with and without USE_QISKIT_SPECS
.
The issue was a difference between qelib1.inc
's crz
definition and the corresponding matrix in qpp's lookup table.
FYI: We've now changed the option to USE_OPENQASM2_SPECS
, and it is OFF
by default.
Great. Thanks. Working like a charm now.
May I suggest you review these two sample qelib1.inc
files too? Are they consistent with what you fixed today? Sometimes, people may want to add more gates to the files to do testing or something. If they reference them, they may get confused.
https://github.com/softwareQinc/qpp/blob/main/qasmtools/qasm/generic/qelib1.inc https://github.com/softwareQinc/staq/blob/main/qasmtools/qasm/generic/qelib1.inc
We have two versions of qelib1.inc
(see https://github.com/softwareQinc/staq/blob/main/qasmtools/include/qasmtools/parser/preprocessor.hpp).
One is for USE_OPENQASM2_SPECS=ON
, which is the same as the official OpenQASM 2 standard library, and is the same as the two linked files. The other is for USE_OPENQASM2_SPECS=OFF
, which is the one that was changed.
I just notice your update on the #34 and thank you for the effort.
But, it still does not produce the correct results.
I attach an
input.qasm
and you can do this to produce two output files.Then, you can run each of the
input.qasm, out2.qasm, out3.qasm
withqpp
example programqpp_qasm
.The final states from executing the three files are different from each other. The phases are different.
I tried both
qpp
andstaq
withoutUSE_QISKIT_SPECS
. The problem exists.Then, I tried both
qpp
andstaq
withUSE_QISKIT_SPECS
. The problem still exists.input.zip