mindquantum.algorithm.compiler.swap_decompose
- mindquantum.algorithm.compiler.swap_decompose(gate: gates.SWAPGate)[source]
Decompose
SWAPGate
gate.- Parameters
- Returns
List[
Circuit
], All possible decompose solution.
Examples
>>> from mindquantum.algorithm.compiler.decompose import swap_decompose >>> from mindquantum.core.circuit import Circuit >>> from mindquantum.core.gates import SWAP >>> swap = SWAP.on([1, 0]) >>> origin_circ = Circuit() + swap >>> decomposed_circ = swap_decompose(swap)[0] >>> origin_circ q0: ──╳─── ┃ ┃ q1: ──╳─── >>> decomposed_circ ┏━━━┓ ┏━━━┓ q0: ──┨╺╋╸┠───■───┨╺╋╸┠─── ┗━┳━┛ ┃ ┗━┳━┛ ┃ ┏━┻━┓ ┃ q1: ────■───┨╺╋╸┠───■───── ┗━━━┛