mindquantum.algorithm.compiler.ryy_decompose

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

Decompose Ryy gate.

Parameters

gate (Ryy) – a Ryy gate.

Returns

List[Circuit], all possible decompose solution.

Examples

>>> from mindquantum.algorithm.compiler import ryy_decompose
>>> from mindquantum.core.circuit import Circuit
>>> from mindquantum.core.gates import Ryy
>>> ryy = Ryy(1).on([0, 1])
>>> origin_circ = Circuit() + ryy
>>> decomposed_circ = ryy_decompose(ryy)[0]
>>> origin_circ
      ┏━━━━━━━━┓
q0: ──┨        ┠───
      ┃        ┃
      ┃ Ryy(1) ┃
q1: ──┨        ┠───
      ┗━━━━━━━━┛
>>> decomposed_circ
      ┏━━━━━━━━━┓                       ┏━━━━━━━━━━┓
q0: ──┨ RX(π/2) ┠───■───────────────■───┨ RX(-π/2) ┠───
      ┗━━━━━━━━━┛   ┃               ┃   ┗━━━━━━━━━━┛
      ┏━━━━━━━━━┓ ┏━┻━┓ ┏━━━━━━━┓ ┏━┻━┓ ┏━━━━━━━━━━┓
q1: ──┨ RX(π/2) ┠─┨╺╋╸┠─┨ RZ(1) ┠─┨╺╋╸┠─┨ RX(-π/2) ┠───
      ┗━━━━━━━━━┛ ┗━━━┛ ┗━━━━━━━┛ ┗━━━┛ ┗━━━━━━━━━━┛