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