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