mindquantum.core.circuit.UN
- class mindquantum.core.circuit.UN(gate: BasicGate, maps_obj, maps_ctrl=None)[source]
Map a quantum gate to different objective qubits and control qubits.
- Parameters
- Returns
Circuit, Return a quantum circuit.
Examples
>>> from mindquantum.core.circuit import UN >>> from mindquantum.core.gates import X >>> circuit1 = UN(X, maps_obj = [0, 1], maps_ctrl = [2, 3]) >>> print(circuit1) ┏━━━┓ q0: ──┨╺╋╸┠───────── ┗━┳━┛ ┃ ┏━━━┓ q1: ────╂───┨╺╋╸┠─── ┃ ┗━┳━┛ ┃ ┃ q2: ────■─────╂───── ┃ ┃ q3: ──────────■───── >>> from mindquantum.core.gates import SWAP >>> circuit2 = UN(SWAP, maps_obj =[[0, 1], [2, 3]]).x(2, 1) >>> print(circuit2) q0: ──╳───────── ┃ ┃ q1: ──╳───■───── ┃ ┏━┻━┓ q2: ──╳─┨╺╋╸┠─── ┃ ┗━━━┛ ┃ q3: ──╳─────────