mindquantum.algorithm.nisq.ASWAP#
- class mindquantum.algorithm.nisq.ASWAP(n_qubits: int, depth: int, prefix: str = '', suffix: str = '')#
A swap like hardware efficient ansatz.
For more information about this ansatz, please refer to Efficient symmetry-preserving state preparation circuits for the variational quantum eigensolver algorithm.
- Parameters:
n_qubits (int) – total qubits number of this ansatz.
depth (int) – depth of ansatz.
prefix (str) – prefix of parameters. Default:
''.suffix (str) – suffix of parameters. Default:
''.
Examples
>>> from mindquantum.algorithm.nisq import ASWAP >>> ASWAP(3, 1, prefix='a').circuit ┏━━━┓ q0: ──┨╺╋╸┠───────────────────────────────────────────────────■──────────────────────────────↯─ ┗━┳━┛ ┃ ┃ ┏━━━━━━━━━━┓ ┏━━━━━━━┓ ┏━━━━━━━━━━┓ ┏━━━━━━━━━┓ ┏━┻━┓ ┏━━━━━━━━━━┓ ┏━━━━━━━━━━━┓ q1: ────■───┨ RZ(a_p0) ┠─┨ RZ(π) ┠─┨ RY(a_p1) ┠─┨ RY(π/2) ┠─┨╺╋╸┠─┨ RY(-π/2) ┠─┨ RY(-a_p1) ┠─↯─ ┗━━━━━━━━━━┛ ┗━━━━━━━┛ ┗━━━━━━━━━━┛ ┗━━━━━━━━━┛ ┗━━━┛ ┗━━━━━━━━━━┛ ┗━━━━━━━━━━━┛ q2: ─────────────────────────────────────────────────────────────────────────────────────────↯─ ┏━━━┓ q0: ───────────────────────────┨╺╋╸┠───────────────────────────────────────────────────────↯─ ┗━┳━┛ ┏━━━━━━━━┓ ┏━━━━━━━━━━━┓ ┃ ┏━━━┓ q1: ──┨ RZ(-π) ┠─┨ RZ(-a_p0) ┠───■───┨╺╋╸┠─────────────────────────────────────────────────↯─ ┗━━━━━━━━┛ ┗━━━━━━━━━━━┛ ┗━┳━┛ ┃ ┏━━━━━━━━━━┓ ┏━━━━━━━┓ ┏━━━━━━━━━━┓ ┏━━━━━━━━━┓ q2: ───────────────────────────────────■───┨ RZ(a_p2) ┠─┨ RZ(π) ┠─┨ RY(a_p3) ┠─┨ RY(π/2) ┠─↯─ ┗━━━━━━━━━━┛ ┗━━━━━━━┛ ┗━━━━━━━━━━┛ ┗━━━━━━━━━┛ q0: ──────────────────────────────────────────────────────────────────── ┏━━━┓ q1: ────■───────────────────────────────────────────────────────┨╺╋╸┠─── ┃ ┗━┳━┛ ┏━┻━┓ ┏━━━━━━━━━━┓ ┏━━━━━━━━━━━┓ ┏━━━━━━━━┓ ┏━━━━━━━━━━━┓ ┃ q2: ──┨╺╋╸┠─┨ RY(-π/2) ┠─┨ RY(-a_p3) ┠─┨ RZ(-π) ┠─┨ RZ(-a_p2) ┠───■───── ┗━━━┛ ┗━━━━━━━━━━┛ ┗━━━━━━━━━━━┛ ┗━━━━━━━━┛ ┗━━━━━━━━━━━┛