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