mindquantum.algorithm.compiler.cswap_decompose#
- mindquantum.algorithm.compiler.cswap_decompose(gate: SWAPGate)#
Decompose controlled
SWAPGategate.- Parameters:
- Returns:
List[
Circuit], all possible decompose solution.
Examples
>>> from mindquantum.algorithm.compiler.decompose import cswap_decompose >>> from mindquantum.core import Circuit, SWAP >>> cswap = SWAP.on([1, 2], 0) >>> origin_circ = Circuit() + cswap >>> decomposed_circ = cswap_decompose(cswap)[0] >>> origin_circ q0: ──■─── ┃ ┃ q1: ──╳─── ┃ ┃ q2: ──╳─── >>> decomposed_circ q0: ──────────■─────────── ┃ ┏━━━┓ ┃ ┏━━━┓ q1: ──┨╺╋╸┠───■───┨╺╋╸┠─── ┗━┳━┛ ┃ ┗━┳━┛ ┃ ┏━┻━┓ ┃ q2: ────■───┨╺╋╸┠───■───── ┗━━━┛