export a circuit to IBM's qiskit python format. Note that only
gates can be exported where the correspondence in qiskit is known
and well defined. Qiskit can then be used for IBM's QASM to run on
real hardware.
character. The filename of the textfile where to store the circuit
append
boolean. Whether or not to append to the file. For this the file has to exist.
import
boolean. Shall numpy and qiskit be loaded explicitly?
Details
Export to IBM's Qiskit
Currently the following gates can be exported: H, X, Y, Z, S,
Tgate, Rz, Rx, Ry, CNOT, SWAP, CCNOT, CSWAP, measure.
note that only standard gates can be exported, not self defined ones.
The function will draw a warning in case a gate cannot be exported
and indicate it in the output file.
x <- qstate(2)
x <- H(1) * x
x <- X(2) * x
x <- CNOT(c(1,2)) * x
export2qiskit(measure(x,1)$psi)
cat(readLines("circuit.py"), sep = '\n')
file.remove("circuit.py")