mindquantum.algorithm.compiler.rxx_decompose
- mindquantum.algorithm.compiler.rxx_decompose(gate: gates.Rxx)[源代码]
分解一个的
Rxx
门。样例:
>>> from mindquantum.algorithm.compiler import rxx_decompose >>> from mindquantum.core.circuit import Circuit >>> from mindquantum.core.gates import Rxx >>> rxx = Rxx(1).on([0, 1]) >>> origin_circ = Circuit() + rxx >>> decomposed_circ = rxx_decompose(rxx)[0] >>> origin_circ ┏━━━━━━━━┓ q0: ──┨ ┠─── ┃ ┃ ┃ Rxx(1) ┃ q1: ──┨ ┠─── ┗━━━━━━━━┛ >>> decomposed_circ ┏━━━┓ ┏━━━┓ q0: ──┨ H ┠───■───────────────■───┨ H ┠─── ┗━━━┛ ┃ ┃ ┗━━━┛ ┏━━━┓ ┏━┻━┓ ┏━━━━━━━┓ ┏━┻━┓ ┏━━━┓ q1: ──┨ H ┠─┨╺╋╸┠─┨ RZ(1) ┠─┨╺╋╸┠─┨ H ┠─── ┗━━━┛ ┗━━━┛ ┗━━━━━━━┛ ┗━━━┛ ┗━━━┛