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