mindquantum.algorithm.compiler.rxx_decompose

Contents

mindquantum.algorithm.compiler.rxx_decompose#

mindquantum.algorithm.compiler.rxx_decompose(gate: Rxx)#

Decompose Rxx gate.

Parameters:

gate (Rxx) – a Rxx gate.

Returns:

List[Circuit], all possible decompose solution.

Examples

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