mindquantum.algorithm.compiler.ryy_decompose
- mindquantum.algorithm.compiler.ryy_decompose(gate: gates.Ryy)[源代码]
分解一个的
Ryy
门。样例:
>>> from mindquantum.algorithm.compiler import ryy_decompose >>> from mindquantum.core.circuit import Circuit >>> from mindquantum.core.gates import Ryy >>> ryy = Ryy(1).on([0, 1]) >>> origin_circ = Circuit() + ryy >>> decomposed_circ = ryy_decompose(ryy)[0] >>> origin_circ ┏━━━━━━━━┓ q0: ──┨ ┠─── ┃ ┃ ┃ Ryy(1) ┃ q1: ──┨ ┠─── ┗━━━━━━━━┛ >>> decomposed_circ ┏━━━━━━━━━┓ ┏━━━━━━━━━━┓ q0: ──┨ RX(π/2) ┠───■───────────────■───┨ RX(-π/2) ┠─── ┗━━━━━━━━━┛ ┃ ┃ ┗━━━━━━━━━━┛ ┏━━━━━━━━━┓ ┏━┻━┓ ┏━━━━━━━┓ ┏━┻━┓ ┏━━━━━━━━━━┓ q1: ──┨ RX(π/2) ┠─┨╺╋╸┠─┨ RZ(1) ┠─┨╺╋╸┠─┨ RX(-π/2) ┠─── ┗━━━━━━━━━┛ ┗━━━┛ ┗━━━━━━━┛ ┗━━━┛ ┗━━━━━━━━━━┛