mindquantum.algorithm.compiler.cnry_decompose
- mindquantum.algorithm.compiler.cnry_decompose(gate: gates.RY)[source]
Decompose controlled
RY
gate.- Parameters
- Returns
List[
Circuit
], all possible decompose solution.
Examples
>>> from mindquantum.algorithm.compiler import cnry_decompose >>> from mindquantum.core.circuit import Circuit >>> from mindquantum.core.gates import RY >>> cry = RY(1).on(2, [0, 1]) >>> origin_circ = Circuit() + cry >>> decomposed_circ = cnry_decompose(cry)[0] >>> origin_circ q0: ──────■─────── ┃ ┃ q1: ──────■─────── ┃ ┏━━━┻━━━┓ q2: ──┨ RY(1) ┠─── ┗━━━━━━━┛ >>> decomposed_circ q0: ─────────────────────────────────────────■──────────────────────────────────────────■──── ┃ ┃ ┃ ┃ q1: ────────────────■──────────────────■─────╂──────────────────■─────────────────■─────╂──── ┃ ┃ ┃ ┃ ┃ ┃ ┏━━━━━━━━━┓ ┏━┻━┓ ┏━━━━━━━━━━┓ ┏━┻━┓ ┏━┻━┓ ┏━━━━━━━━━━┓ ┏━┻━┓ ┏━━━━━━━━━┓ ┏━┻━┓ ┏━┻━┓ q2: ──┨ RY(1/4) ┠─┨╺╋╸┠─┨ RY(-1/4) ┠─┨╺╋╸┠─┨╺╋╸┠─┨ RY(-1/4) ┠─┨╺╋╸┠─┨ RY(1/4) ┠─┨╺╋╸┠─┨╺╋╸┠── ┗━━━━━━━━━┛ ┗━━━┛ ┗━━━━━━━━━━┛ ┗━━━┛ ┗━━━┛ ┗━━━━━━━━━━┛ ┗━━━┛ ┗━━━━━━━━━┛ ┗━━━┛ ┗━━━┛