mindquantum.algorithm.compiler.cry_decompose
- mindquantum.algorithm.compiler.cry_decompose(gate: gates.RY)[source]
Decompose controlled
RY
gate.- Parameters
- 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) ┠─┨╺╋╸┠─── ┗━━━━━━━━━┛ ┗━━━┛ ┗━━━━━━━━━━┛ ┗━━━┛