mindquantum.algorithm.compiler.rzz_decompose

View Source On Gitee
mindquantum.algorithm.compiler.rzz_decompose(gate: gates.Rzz)[source]

Decompose Rzz gate.

Parameters

gate (Rzz) – a Rzz gate with one control qubits.

Returns

List[Circuit], all possible decompose solution.

Examples

>>> from mindquantum.algorithm.compiler import rzz_decompose
>>> from mindquantum.core.circuit import Circuit
>>> from mindquantum.core.gates import Rzz
>>> rzz = Rzz(1).on([0, 1])
>>> origin_circ = Circuit() + rzz
>>> decomposed_circ = rzz_decompose(rzz)[0]
>>> origin_circ
     ┏━━━━━━━━┓
q0: ──┨        ┠───
     ┃        ┃
     ┃ Rzz(1) ┃
q1: ──┨        ┠───
     ┗━━━━━━━━┛
>>> decomposed_circ
q0: ────■───────────────■─────
        ┃               ┃
      ┏━┻━┓ ┏━━━━━━━┓ ┏━┻━┓
q1: ──┨╺╋╸┠─┨ RZ(1) ┠─┨╺╋╸┠───
      ┗━━━┛ ┗━━━━━━━┛ ┗━━━┛