mindquantum.algorithm.nisq.get_reference_circuit

View Source On Gitee
mindquantum.algorithm.nisq.get_reference_circuit(n_qubits: int, n_ele_alpha: Optional[int] = None, n_ele_beta: Optional[int] = None, ref: Union[AVA_REF, Iterable] = 'AllH')[source]

Get preparation circuit for reference circuit according to different methods.

The available methods are:

Method

Description

HF

Generate the Hartree-Fock (HF) reference state, where electrons occupy the lowest energy orbitals, suitable for Hartree-Fock (HF) orbitals.

Neel

Generate the Neel reference state, where electrons with different spins occupy adjacent orbitals, suitable for orthonormalized atomic orbitals.

Bell

Generate the tensor product of the Bell state as the reference state.

AllH

Generate the uniform superposition state as the reference state.

Parameters
  • n_qubits (int) – The total qubit number.

  • n_ele_alpha (int) – The number of alpha electrons. Default: None.

  • n_ele_beta (int) – The number of beta electrons. Default: None.

  • ref (Union[str, Iterable]) – The method to construct reference state. If it is a string, it should be one of 'HF', 'Neel', 'Bell', 'AllH'. Otherwise, it should be a iterator of int, and we place a RX gate on each qubit. Default: 'AllH'.

Examples

>>> from mindquantum.algorithm.nisq import get_reference_circuit
>>> get_reference_circuit(4, 1, 1, 'HF')
      ┏━━━┓
q0: ──┨╺╋╸┠─▓───
      ┗━━━┛ ▓
      ┏━━━┓ ▓
q1: ──┨╺╋╸┠─▓───
      ┗━━━┛ ▓

q2: ────────▓───


q3: ────────▓───