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