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