zxcalc / pyzx

Python library for quantum circuit rewriting and optimisation using the ZX-calculus
Apache License 2.0
365 stars 108 forks source link

input qasm file format #87

Closed anitalu724 closed 9 months ago

anitalu724 commented 2 years ago

Hi, thanks for the useful tool for implementing ZX-calculus. I'm wondering if it is possible to enter all formats of qasm files, since I found out that some gates like P-gate, CP-gate, and so on are not supported by the load function provided in this tool. Thanks~

jvdwetering commented 2 years ago

That would certainly be possible. Is there a specific library that uses these gates? I don't really know what a 'P' gate is namely (I'm assuming 'CP' is just a controlled-P gate)

anitalu724 commented 2 years ago

In my viewpoint, qasm format is kind of free style. However, in the tool Qiskit provided by IBM, there are a couple of gate definitions. Qiskit Gate Library The output qasm files of Qiskit contain some of these gates which are not supported in PyZX.

jvdwetering commented 2 years ago

That list you link does not mention a P gate, unless I missed it?

anitalu724 commented 2 years ago

Sorry, I didn't explain it clearly enough. P-gate is equivalent to PhaseGate in the Qiskit Gate Library. Some papers and tutorial called PhaseGate "P-gate" for short.

dlyongemallo commented 9 months ago

Hi, @anitalu724,

I am working on #156 which is going to add support for most of the OpenQASM standard library gates. Besides p and cp, was there anything else you needed?

dlyongemallo commented 9 months ago

As of PR #156 both p and cp are supported, along with the most common qasm gates, so unless there are other requested gates, this issue can be closed.