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