ffsim.apply_fsim_gate¶
- ffsim.apply_fsim_gate(vec, theta, phi, target_orbs, norb, nelec, spin=<Spin.ALPHA_AND_BETA: 3>, *, copy=True)[source]¶
Apply an fSim gate.
An fSim gate consists of a tunneling interaction followed by a number-number interaction (note the negative sign convention for the angles):
\[\begin{split}\begin{align} \text{fSim}&(\theta, \phi, (p, q)) = \text{NN}(-\phi, (p, q)) \text{T}(-\theta, (p, q)) \\ &= \prod_\sigma \exp\left(-i \phi a^\dagger_{p\sigma} a_{p\sigma} a^\dagger_{q\sigma} a_{q\sigma}\right) \exp\left(-i \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) & -i \sin(\theta) & 0\\ 0 & -i \sin(\theta) & \cos(\theta) & 0\\ 0 & 0 & 0 & e^{-i \phi} \\ \end{pmatrix}\end{split}\]- Parameters:
vec (
ndarray) – The state vector to be transformed.theta (
float) – The rotation angle for the tunneling interaction.phi (
float) – The phase angle for the number-number interaction.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=Truethen this function always returns a newly allocated vector and the original vector is left untouched.If
copy=Falsethen 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: