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