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