mindquantum.algorithm.compiler.cry_decompose

Contents

mindquantum.algorithm.compiler.cry_decompose#

mindquantum.algorithm.compiler.cry_decompose(gate: RY)#

Decompose controlled RY gate.

Parameters:

gate (RY) – A RY gate with one control qubits.

Returns:

List[Circuit], all possible decompose solution.

Examples

>>> from mindquantum.algorithm.compiler import cry_decompose
>>> from mindquantum.core.circuit import Circuit
>>> from mindquantum.core.gates import RY
>>> cry = RY(1).on(1, 0)
>>> origin_circ = Circuit() + cry
>>> decomposed_circ = cry_decompose(cry)[0]
>>> origin_circ
q0: ──────■───────

      ┏━━━┻━━━┓
q1: ──┨ RY(1) ┠───
      ┗━━━━━━━┛
>>> decomposed_circ
q0: ────────────────■──────────────────■─────
                    ┃                  ┃
      ┏━━━━━━━━━┓ ┏━┻━┓ ┏━━━━━━━━━━┓ ┏━┻━┓
q1: ──┨ RY(1/2) ┠─┨╺╋╸┠─┨ RY(-1/2) ┠─┨╺╋╸┠───
      ┗━━━━━━━━━┛ ┗━━━┛ ┗━━━━━━━━━━┛ ┗━━━┛