mindquantum.algorithm.compiler.cy_decompose

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

Decompose controlled YGate gate.

Parameters

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

Returns

List[Circuit], all possible decompose solution.

Examples

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

      ┏━┻━┓
q1: ──┨ Y ┠───
      ┗━━━┛
>>> decomposed_circ
q0: ───────────■───────────

      ┏━━━━┓ ┏━┻━┓ ┏━━━┓
q1: ──┨ S† ┠─┨╺╋╸┠─┨ S ┠───
      ┗━━━━┛ ┗━━━┛ ┗━━━┛