mindquantum.algorithm.compiler.cz_decompose
- mindquantum.algorithm.compiler.cz_decompose(gate: gates.ZGate)[source]
Decompose controlled
ZGate
gate.- Parameters
- Returns
List[
Circuit
], all possible decompose solution.
Examples
>>> 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 ┠─── ┗━━━┛ ┗━━━┛ ┗━━━┛