-
Notifications
You must be signed in to change notification settings - Fork 24
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
master form_qasm() #140
Comments
|
Zhaoyilunnn
added a commit
that referenced
this issue
Apr 15, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
pq = QuantumCircuit(4)
theta = [Parameter("theta_%d" % (i), i + 1) for i in range(4)]
for i in range(4):
pq.rx(i, theta[i])
pq.rx(0, 55)
pq.ry(2, 4. * theta[0]+0.8)
pq.to_openqasm()
Out[8]: 'OPENQASM 2.0;\ninclude "qelib1.inc";\nqreg q[4];\ncreg meas[0];\nrx(2) q[0];\nrx(2) q[1];\nrx(2) q[2];\nrx(2) q[3];\nrx(55) q[0];\nry(8.8) q[2];\n'
qc.from_openqasm(pq.to_openqasm())
Traceback (most recent call last):
File "/Users/xhz/miniforge3/envs/quafumaster/lib/python3.10/site-packages/IPython/core/interactiveshell.py", line 3577, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "", line 1, in
qc.from_openqasm(pq.to_openqasm())
File "/Users/xhz/miniforge3/envs/quafumaster/lib/python3.10/site-packages/pyquafu-0.4.0-py3.10-macosx-14.0-arm64.egg/quafu/circuits/quantum_circuit.py", line 483, in from_openqasm
return qasm2_to_quafu_qc(self, openqasm)
File "/Users/xhz/miniforge3/envs/quafumaster/lib/python3.10/site-packages/pyquafu-0.4.0-py3.10-macosx-14.0-arm64.egg/quafu/qfasm/qfasm_convertor.py", line 47, in qasm2_to_quafu_qc
newqc = qparser.parse(openqasm)
File "/Users/xhz/miniforge3/envs/quafumaster/lib/python3.10/site-packages/pyquafu-0.4.0-py3.10-macosx-14.0-arm64.egg/quafu/qfasm/qfasm_parser.py", line 100, in parse
self.parser.parse(data, lexer=self.lexer, debug=debug)
File "/Users/xhz/miniforge3/envs/quafumaster/lib/python3.10/site-packages/ply-3.11-py3.10.egg/ply/yacc.py", line 333, in parse
return self.parseopt_notrack(input, lexer, debug, tracking, tokenfunc)
File "/Users/xhz/miniforge3/envs/quafumaster/lib/python3.10/site-packages/ply-3.11-py3.10.egg/ply/yacc.py", line 1120, in parseopt_notrack
p.callable(pslice)
File "/Users/xhz/miniforge3/envs/quafumaster/lib/python3.10/site-packages/pyquafu-0.4.0-py3.10-macosx-14.0-arm64.egg/quafu/qfasm/qfasm_parser.py", line 1021, in p_cdecl
raise ParserError(
quafu.qfasm.exceptions.ParserError: CREG size must be positive at line 4 file None
The text was updated successfully, but these errors were encountered: