ffsim.apply_hop_gate

ffsim.apply_hop_gate(vec, theta, target_orbs, norb, nelec, spin=<Spin.ALPHA_AND_BETA: 3>, *, copy=True)[source]

Apply a hop gate.

A “hop gate” is a Givens rotation gate followed by a number-number interaction with angle pi:

\[\begin{split}\begin{align} \text{Hop}&(\theta, (p, q)) = \text{NN}(\pi, (p, q)) \text{G}(\theta, (p, q)) \\ &= \prod_{\sigma} \exp\left(i \theta a^\dagger_{p\sigma} a_{p\sigma} a^\dagger_{q\sigma} a_{q\sigma}\right) \exp\left(\theta (a^\dagger_{p\sigma} a_{q\sigma} - a^\dagger_{q\sigma} a_{p\sigma})\right) \end{align}\end{split}\]

Under the Jordan-Wigner transform, this gate has the following matrix when applied to neighboring qubits:

\[\begin{split}\begin{pmatrix} 1 & 0 & 0 & 0 \\ 0 & \cos(\theta) & -\sin(\theta) & 0\\ 0 & \sin(\theta) & \cos(\theta) & 0\\ 0 & 0 & 0 & -1 \\ \end{pmatrix}\end{split}\]
Parameters:
  • vec (ndarray) – The state vector to be transformed.

  • theta (float) – The rotation angle.

  • target_orbs (tuple[int, int]) – The orbitals (p, q) to interact.

  • norb (int) – The number of spatial orbitals.

  • nelec (int | tuple[int, int]) – Either a single integer representing the number of fermions for a spinless system, or a pair of integers storing the numbers of spin alpha and spin beta fermions.

  • spin (Spin) –

    Choice of spin sector(s) to act on.

    • To act on only spin alpha, pass ffsim.Spin.ALPHA.

    • To act on only spin beta, pass ffsim.Spin.BETA.

    • To act on both spin alpha and spin beta, pass ffsim.Spin.ALPHA_AND_BETA (this is the default value).

  • copy (bool) –

    Whether to copy the vector before operating on it.

    • If copy=True then this function always returns a newly allocated vector and the original vector is left untouched.

    • If copy=False then this function may still return a newly allocated vector, but the original vector may have its data overwritten. It is also possible that the original vector is returned, modified in-place.

Return type:

ndarray