qiskit-community / ffsim

Faster simulations of fermionic quantum circuits.
https://qiskit-community.github.io/ffsim/
Apache License 2.0
25 stars 8 forks source link

Add fswap gate #84

Closed kevinsung closed 3 months ago

kevinsung commented 11 months ago

Add apply_fswap_gate function to python/ffsim/gates/basic_gates.py.

This gate swaps two fermionic modes. Under the Jordan-Wigner transform, this gate has the following matrix when applied to neighboring qubits:

[[1, 0, 0, 0]
 [0, 0, 1, 0]
 [0, 1, 0, 0]
 [0, 0, 0, -1]

It looks like it can be implemented with a combination of tunneling_interaction, num_interaction, and num_num_interaction. Maybe there is a smarter way.

kevinsung commented 10 months ago

Actually, I think it can be implemented with a single call to apply_orbital_rotation. Swapping modes i and j corresponds to an orbital rotation described by the identity matrix with columns i and j swapped.