diff --git a/tensorcircuit/translation.py b/tensorcircuit/translation.py index 6e867fd5..5f001841 100644 --- a/tensorcircuit/translation.py +++ b/tensorcircuit/translation.py @@ -182,6 +182,20 @@ def _circuit_diagram_info_(self) -> List[str]: ci_name = gate_info["name"] cgate = CustomizedCirqGate(gatem, ci_name, len(index)) cmd.append(cgate.on(*index)) + elif gate_name == "measure": + cmd.append(cirq.MeasurementGate(key=gate_info["name"]).on(*index)) + elif gate_name == "reset": + cmd.append(cirq.ResetChannel().on(*index)) + elif gate_name in ["ox", "oy", "oz"]: + cmd.append(getattr(cirq, gate_name[1:])().controlled().on(*index)) + elif gate_name in ["orx", "ory", "orz"]: + cmd.append( + getattr(cirq, gate_name[1:])(_get_float(parameters, "theta")) + .controlled() + .on(*index) + ) + elif gate_name == "phase": + cmd.append(cirq.PhaseGate) else: # Add Customized Gate if there is no match gatem = np.reshape( diff --git a/tests/test_transpile.py b/tests/test_transpile.py new file mode 100644 index 00000000..9c190268 --- /dev/null +++ b/tests/test_transpile.py @@ -0,0 +1,9 @@ +import tensorcircuit as tc + + +def test_qis_to_cirq(): + # TODO + c = tc.Circuit(5) + c.rx(0, theta=0.1) + c.ry(1, theta=0.2) + pass