from pytket.extensions.qiskit import qiskit_to_tk
from pytket.qasm import circuit_to_qasm_str
from qiskit import QuantumCircuit
import numpy as np
qc = QuantumCircuit(1)
qc.rx((1e14 + 0.12)*np.pi, 0) # rx gate with a large parameter value
circ = qiskit_to_tk(qc)
print(circuit_to_qasm_str(circ))
QASM output
OPENQASM 2.0;
include "qelib1.inc";
qreg q[1];
rx(0.21875*pi) q[0];
The operators for rx(0.21875*pi) and rx(0.12*pi) are not unitarily equivalent. Seems like there is some rounding error occuring when converting the large parameter value to pytket.
As far as I know for the converision from qiskit params to pytket params simply consists in dividing by sympy.pi (for numeric values) to account for the differing angle conventions.
QASM output
The operators for
rx(0.21875*pi)
andrx(0.12*pi)
are not unitarily equivalent. Seems like there is some rounding error occuring when converting the large parameter value to pytket.As far as I know for the converision from qiskit params to pytket params simply consists in dividing by
sympy.pi
(for numeric values) to account for the differing angle conventions.See https://github.com/CQCL/pytket-qiskit/blob/main/pytket/extensions/qiskit/qiskit_convert.py#L571