Skip to main content

View on GitHub

Open this notebook in GitHub to run it yourself
Fermionic Gaussian states are ground states of quadratic fermionic Hamiltonians [1]. They are widely used as initial states for simulations of electronic systems and as mean-field ansatz states, including Hartree-Fock states, BCS superconductors, and filled Fermi seas. This notebook prepares such states on a quantum register from the matrices defining the underlying quadratic Hamiltonian
H=∑μνcμ†hμνcν+12∑μνΔμν(cμ†cν†+h.c.)  ,(1)H = \sum_{\mu \nu} c_\mu^\dagger h_{\mu \nu} c_{\nu} + \frac{1}{2}\sum_{\mu \nu}\Delta_{\mu \nu}\left(c_\mu^\dagger c_\nu^\dagger + \text{h.c.}\right)~~, \tag{1}
where cμ†/cμc_{\mu}^\dagger / c_{\mu} are the (particle) fermionic creation / annihilation operators (also termed Dirac operators) and hμν,Δμνh_{\mu \nu}, \Delta_{\mu \nu} are the coupling frequencies (ℏ=1\hbar = 1 notation throughout the notebook). The algorithm treats the problem in the following way:
  • Input: A Hermitian one-body matrix hh (M×MM \times M) and a antisymmetric pairing matrix Δ\Delta (M×MM \times M), where MM is the number of fermionic modes. For number-conserving Slater determinants (Δ=0\Delta = 0), a target particle number NN is also specified.
  • Output: An MM-qubit register (under the Jordan-Wigner mapping) prepared in the ground state ∣ψg.s.⟩|\psi_{\rm g.s.}\rangle of HH, up to a global phase.
Complexity: For MM fermionic modes, the classical pre-processing costs O(M3)O(M^3) (diagonalization of an O(M)O(M) matrix) and the state preparation quantum circuit requires NG=O(M2)N_G = O(M^2) two-qubit Givens rotations. When Δ=0\Delta =0, the circuit depth satisfies ≤M−1\le M-1 (preparation of a Slater determinant). In general, (Δ≠0\Delta \neq 0 case) the depth is upper bounded by 2M−12M-1.
Keywords: Fermionic Gaussian state, Slater determinant, Bogoliubov-de Gennes, Givens rotations, Jordan-Wigner, mean-field

Overview

Gaussian fermionic states are widely used as initial states of simulations of electronic systems and as mean field ansatz states [2]. The presented algorithm was introduced by Jiang et al. [1]. It includes two stages:
  1. Classical pre-processing. The quadratic Hamiltonian of MM fermionic modes is diagonalized to obtain a basis transformation matrix.
This matrix relates the original Dirac operators {cμ,cμ†}\{c_\mu, c_\mu^\dagger\} to the diagonal-basis quasiparticle operators {dη,dη†}\{d_\eta, d_\eta^\dagger\}. Following, the transformation matrix is decomposed into a sequence of O(M2)O(M^2) Givens rotations, these are two-mode operations which conserve the number of modes. Following, a Jordan-Wigner transformation maps the fermionic modes to a qubit representation, where the Givens rotations correspond to two-qubit gates on adjacent qubits.
  1. Quantum state preparation. Apply the resulting two-qubit gates (encoded under the Jordan-Wigner mapping) in reverse order to the vacuum ∣0M⟩|0^M\rangle, yielding the desired ground state with circuit depth ≤2M−1\le 2M-1.
We treat two cases:
  • Number-conserving (Slater determinants): Ground states of Hamiltonians of the form: H=∑μν=1Mcμ†hμνcνH = \sum_{\mu\nu=1}^M c_\mu^\dagger h_{\mu\nu} c_\nu.
The required gates are (number-conserving) Givens rotations and the algorithm reduces to a modified QRQR decomposition of the occupied-orbital matrix. Demonstrated on a 11-D periodic lattice.
  • Ground state of General quadratic Hamiltonian: In addition to the particle conserving terms, HH also contains pairing terms 12∑μνΔμνcμ†cν†+h.c.\frac{1}{2}\sum_{\mu\nu}\Delta_{\mu\nu} c_\mu^\dagger c_\nu^\dagger + \text{h.c.}, which break particle-number conservation. Here, Δμν\Delta_{\mu\nu} are frequencies.
The gate set is augmented with particle-hole transformations on the last mode (an XX gate on the last qubit), and each tuple becomes a phased Givens rotation eiφcj†cj eθ(ci†cj−cj†ci)e^{i\varphi c_j^\dagger c_j}\,e^{\theta(c_i^\dagger c_j - c_j^\dagger c_i)}. Demonstrated on a small n=2n=2 example whose ground state is verified by direct exact diagonalization in the 44-dimensional Fock space.

Introduction

Fermionic Gaussian States (FGS) are a class of many-body quantum states of fermions, which are completely characterized by their “second moments” (two-point correlation functions). They underpin many approximate techniques in condensed matter physics and quantum chemistry. In these approaches, the interacting many-electron problem is treated by determining the optimal set of effective non-interacting orbitals that best approximate the full system [3]. The structure of FGSs is governed by the anticommutation relations of the Dirac operators {cμ,cν†}=δμν  ,  {cμ,cν}={cμ†,cν†}=0  ,\{c_\mu, c_\nu^\dagger \} = \delta_{\mu \nu}~~,~~\{c_\mu, c_\nu \} = \{c_\mu^\dagger, c_\nu^\dagger \} =0~~, where {a,b}=ab+ba\{a,b\} = ab + ba, while cμc_\mu and cν†c_\nu^\dagger annihilate and create a fermion in the μ\mu‘th fermionic mode, respectively. Important fermionic gaussian states include,
  • The vacuum state ∣vac⟩|\text{vac}\rangle (defined as the state for which cμ∣vac⟩=∣vac⟩c_{\mu}|\text{vac}\rangle=|\text{vac}\rangle for all μ\mu).
  • Slater Determinants: Πμ=1Mbμ†∣vac⟩\Pi_{\mu=1}^M b_\mu^\dagger |\text{vac}\rangle, where bμb_\mu are linear combinations of {cμ}\{c_\mu\}.
These include Hartree-Fock states and a Filled Fermi sea.
  • BCS states:
∝exp⁡(∑μνΔμνcμ†cν†)∣vac⟩  .\propto \exp \left( \sum_{\mu \nu}\Delta_{\mu \nu}c_\mu^\dagger c_\nu^\dagger \right)|\text{vac}\rangle~~. These states, named after Nobel laureates Bardeen, Cooper and Schrieffer, describe the pairing of electrons (forming Cooper pairs), which leads to superconducting charge flow in solid state materials.
  • Ground states of quadratic Hamiltonians (see overview). As ground states of such Hamiltonians, they have an important role in quantum simulations of fermionic systems.
For example, in the celebrated Fermi-Hubbard model, simulations are usually initialized in easy to prepare fermionic gaussian state, or as ground states of mean-field Hamiltonians. Gaussian fermionic states have a number of equivalent properties (these properties can also constitute as alternative definitions of these states) [3]: Consider an MM-mode fermionic gaussian state ρ\rho
  • ρ\rho can be represented (or defined) as the exponential of a quadratic form in the fermionic operators:
ρ=Z−1exp⁡(−cTHc)  , \rho = Z^{-1} \exp(-\mathbf{c}^T{\cal H} \mathbf{c})~~, where ρ\rho is the density matrix, c={c1,…,cM}T\mathbf{c} = \{c_1,\dots,c_M \}^T and H\cal H is an Hermitian matrix.
  • All higher order correlation functions (i.e. ⟨c1†...cM†cM+1…c2M⟩\langle c_1^\dagger...c_M^\dagger c_{M+1}\dots c_{2M} \rangle) are determined by Wick’s theorem from the two-point correlators.
  • They maximise the von-Neumann entropy given the second order expectation values.
These constitute the elements of the correlation matrix: Γ=⟨cc†⟩.\Gamma = \langle \mathbf{c} \mathbf{c}^\dagger \rangle.
  • Alternatively, their properties can be fully described by the covariance matrix, which is related to the correlation matrix, γ=−iΩ(2Γ−IΩ†)\gamma = -i \Omega (2\Gamma -\mathbb{I}\Omega^\dagger), where Ω\Omega is a transformation to the fermionic Majorana operators, defined below.

Classiq Implementation

We will next describe the classical calculation involved in deriving the state preparation circuit, and implement the circuit with Classiq. Throughout this notebook, we will use the Jordan-Wigner transformation, which maps fermionic creation and annihilation operators to qubit operators suitable for quantum computing. Under this encoding, Fock states are represented directly as computational basis states: each occupation state maps to the same bitstring. Therefore, particle number and particle conservation have the same meaning in the qubit representation. In addition, we can define certain unitaries directly by their action on the encoded Fock space. For example, a unitary that maps ∣01⟩|01\rangle to ∣10⟩|10\rangle, corresponds to moving a particle from the second mode to the first, i.e., annihilating it in one mode and creating it in the other. We begin by importing the required software packages and defining global constants

Preparation of a Slater Determinant State

A Slater-Determinant is the ground state of a quadratic Fermionic Hamiltonian which conserves the number of particles. In the following section, we define such an Hamiltonian and prepare its ground state. We begin, by demonstrating a simple example utilizing only numpy data structures. Following, we introduce Classiq quantum functions which prepare the desired fermionic gaussian state. The form of general number conserving quadratic fermionic Hamiltonian is (Δ=0\Delta = 0 in Eq. (1)) H=∑μ,ν=1Mcμ†hμνcν  ,    (2)H = \sum_{\mu,\nu=1}^M c_\mu^\dagger h_{\mu\nu}c_\nu~~,~~~~\tag{2} where hh is known as the one-body Hamiltonian. Remarkably, this implies that the diagonalization of hh, (an MM by MM matrix) allows us to prepare the ground state. The idea is the following: We assume that the number of particles NN is known. The Hamiltonian conserves the number of particles, that is, it commutes the number operator ∑μ=1Mcμ†cμ  .\sum_{\mu = 1}^M c_\mu^\dagger c_\mu~~. Diagonalizing the single particle Hamiltonian h=QˉDQˉ†h= \bar{Q} D \bar{Q}^\dagger, where Qˉ\bar{Q} is an MM-by-MM unitary matrix and D=diag(ϵ1,...,ϵM)D = \text{diag}(\epsilon_1,...,\epsilon_M), where ϵ1≤ϵ2≤⋯≤ϵM\epsilon_1 \leq \epsilon_2 \leq \cdots \leq \epsilon_M, we obtain H=∑k=1Mϵkdk†dkH=\sum_{k=1}^M \epsilon_k d_k^\dagger d_k, where dη†=∑μ=1MQˉμηcμ†  .(3)d_\eta^\dagger= \sum_{\mu=1}^{M} \bar{Q}_{\mu \eta}c_\mu^\dagger~~. \tag{3} Then since each dη†d_\eta^\dagger is a linear combination of the Dirac operators {cμ†}\{c_\mu^\dagger\}, it excites only a single particle, and the number conservation (NN particles) implies that the ground state can be written as ∣ψg.s⟩=Πk=1Ndk†∣0M⟩  .|\psi_{g.s}\rangle = \Pi_{k=1}^N d_k^\dagger |0^M\rangle ~~. The basis transformation can also be expressed in terms of the single-particle transformation, Uc†=d† ,U\mathbf{c}^\dagger = \mathbf{d}^\dagger~, where we collected the creation operators to form an operator valued vector. Each element of the vector corresponds to a transformation by a unitary operator U\cal U, Ucj†U†=U[j,:]d†=dj†{\cal U} c_j^\dagger {\cal U}^\dagger = U_{[j,:]} \mathbf{d}^\dagger = d_j^\dagger. Crucially, the cost of evaluating UU and diagonalizing of hh scales only polynomially with the number of fermionic modes, O(M3)O(M^3) and can be efficiently done on a classical computer. In order to prepare the desired ground state we focus on a part of Qˉ\bar{Q} which corresponds to the occupied modes, and denote the NN by MM matrix describing these modes by Q=(QˉT)[occupied modes,:]Q = (\bar{Q}^T)_{[{\text{occupied modes}},:]}. This identification leads to an alternative form for Eq. (3), for the occupied modes we have dη†=∑μ=1MQημcμ†  .d_\eta^\dagger= \sum_{\mu=1}^{M} {Q}_{\eta \mu}c_\mu^\dagger~~. An efficient quantum circuit for the ground state preparation can be obtained by a modified QR decomposition of QQ, using a product of elementary two-mode rotations, called Givens rotations. Each rotation can be expressed as \begin{pmatrix} \mathcal{G}c_j^\dagger\mathcal{G}\\ \mathcal{G}c_k^\dagger\mathcal{G} \end{pmatrix} = G_{jk}(\theta,\varphi)\, \begin{pmatrix} c_j^\dagger\\ c_k^\dagger \end{pmatrix}~~, $ and the form of a Givens rotation is $$G_\{jk\}(\theta,\varphi) = \begin\{pmatrix\} \cos(\theta) & -e^\{i\varphi\}\sin(\theta)\\ \sin(\theta) & e^\{i\varphi\}\cos(\theta) \end\{pmatrix\}~~. \tag\{4\} Within the algorithm, the Givens rotations operate on the subspace with a defined number of excitations, therefore, they conserve the number of particles. To simplify the decomposition we begin by utilizing the invariance of the Slater determinant (up to a global phase) under the mapping Q→VQ{Q}\rightarrow V{Q}, where VV is a unitary transformation. For the transformation of basis to be valid we require that the first NN rows of VQVQ are equal to UU, or alternatively V{Q}U†=(IN,{0})  .V\{Q\}U^\dagger = (I_N, \boldsymbol\{0\})~~. Each Givens transformation operates only on two columns, and its parameters, θ\theta and ϕ\phi, are set so as to nullify elements in the upper right part of the matrix. Due to the orthogonality of the rows of QQ, some transformations nullify more than a single matrix element. As a result, the total number of required Givens transformations is NG=N(M−N)N_G = N(M-N), where NN is the number of electrons and MM is the number of fermionic modes. The diagonalization procedure results in a product of Givens rotations U=G{NG}⋯G2G1  .U = G_\{N_G\}\cdots G_2 G_1~~. After the Jordan-Wigner transformation, each two-mode (j,kj,k) rotations correspond to a rotation in the single particle subspace of the two qubits jj and kk (∣01⟩|01\rangle and ∣10⟩|10\rangle). This completely defines the state preparation circuit in terms of a sequence of two-qubit rotations. The gate complexity is O(NG)=O(N2)O(N_G) = O(N^2) (worst case achieved for M=N/2M=N/2), and parallelization leads to a circuit depth of M−1M-1.

Summary of the Algorithmic Steps:

  1. Evaluate the diagonalizing matrix Qˉ\bar{Q}, and filter the non-occupied states by calculating QQ.
  2. Zero out the upper-right matrix elements of QQ, applying the transformation Q→VQQ\rightarrow V Q.
  3. Diagonalize VQVQ applying a sequence of Givens rotations.
  4. Map the Givens rotations to corresponding quantum gates, to obtain the quantum circuit.

Givens Rotations Example

In order to understand the state preparation algorithm, we first show how Givens rotations are utilized to diagonalize a simple one-body Hamiltonian. Consider a simple 44-by-44 Hermitian matrix, representing a one-body Hamiltonian: h = \begin\{pmatrix\} \varepsilon_0 & t_\{01\} & 0 & t_\{03\} \\ t_\{01\} & \varepsilon_1 & t_\{12\} & 0 \\ 0 & t_\{12\} & \varepsilon_2 & t_\{23\} \\ t_\{03\} & 0 & t_\{23\} & \varepsilon_3 \end\{pmatrix\} $
For a number-conserving quadratic Hamiltonian the diagonalizing Bogoliubov transformation reduces to ordinary diagonalization of the one-body matrix hh. We obtain the orbital energies and the transformation matrix Qˉ\bar{Q} via numpy.linalg.eigh; the rows of QˉT\bar{Q}^T are the diagonal-basis modes, and the matrix QQ describing the Slater determinant is the subset of those rows corresponding to the occupied orbitals (here, the modes with negative single-particle energy).
We extract the Givens rotations utilizing OpenFermion’s givens_decomposition, returning a list of tuples: [(G_1,G_2),(G_3,),...]. Each tuple includes the Givens rotations which can be operated in parallel. The Givens rotations are encoded as a tuple: Gk=(ik,jk,θk,ϕk)G_k = (i_k,j_k,\theta_k,\phi_k), where iki_k and jkj_k are the columns of U†U^\dagger which the Givens rotation Gk†G_k^\dagger is operated on from the right (see calculation below).
We introduce two utility functions that classically replay the decomposition: build_U_from_rotations reassembles the unitary UU as a product of Givens rotations, and build_state_from_rotations applies the Givens rotations in single-particle space starting from a reference vector with the first NN entries equal to 11.
Next, we decompose UU into Givens rotations: U=GNG,…,G1U = G_{N_G},\dots,G_1 and verify that VQU†=(I,0)V Q U^\dagger = (I,\mathbf{0}).
Output:
State preparation check

Preparation of an Electronic State Ground State

We now prepare the ground state of a fermionic lattice model. This is a Slater determinant state of the form: Πμ=1Mdμ†∣vac⟩  ,\Pi_{\mu=1}^M d_\mu^\dagger |\text{vac}\rangle~~, where dμd_\mu are linear combinations of {cμ}\{c_\mu\}. First, we define the model, introduce global parameters, and define utility quantum functions. The model considers nearest neighbor interaction with periodic boundary conditions. Each fermionic mode cjσc_{j\sigma} has two degrees of freedom
  • The lattice site number, jj
  • Spin, σ∈{0,1}\sigma\in\{0,1\}
The global parameters of the problem are therefore:
  • LL - number of lattice sites
  • MM - total number of fermionic modes
In addition, we introduce functions mapping between the qubit index and the lattice spin degrees of freedom. The mapping corresponds to a Jordan-Wigner transformation (fermionic operators to qubits) with an interleaved up-down (even-odd) ordering (similar to OpenFermion convention). The Jordan-Wigner transformation maps the states and operations of the fermionic Fock space to corresponding operators and states in the qubit Hilbert space. The particle conserving property of the Givens rotation maps to an operation on states of fixed particle number. For example, for a single excitation on two modes, the subspace is spanned by ∣01⟩|01\rangle and ∣10⟩|10\rangle. Hence, a rotation within this space corresponds to annihilation/creation of a particle in the second state and creation/annihilation of one in the first. Next, we introduce quantum functions that convert the sequence of Givens rotations to a corresponding state preparation quantum circuit U=GNG…G1U = G_{N_G}\dots G_1. We utilize OpenFermion’s givens_decomposition to obtain the sequence of rotations. The decomposition includes a list of sets, where each set includes the rotations which can be operated in parallel, and each rotation operates on adjacent qubits. Each entry (i,j,θ,φ)(i, j, \theta, \varphi) returned by openfermion’s givens_decomposition (and likewise fermionic_gaussian_decomposition) corresponds to the operator Mij(θ,φ)  =  eiφ nj  eθ (ai†aj−aj†ai)  ,M_{ij}(\theta,\varphi) \;=\; e^{i\varphi\,n_j}\;e^{\theta\,(a_i^\dagger a_j - a_j^\dagger a_i)}~~, i.e. a Givens rotation in the single-particle subspace (Eq. 4) followed by a phase eiφe^{i\varphi} on mode jj. In the four-dimensional Fock subspace spanned by modes i,ji,j, {∣vac⟩, ∣1i⟩, ∣1j⟩, ∣1i1j⟩}\{|\text{vac}\rangle,\, |1_i\rangle,\, |1_j\rangle,\, |1_i 1_j\rangle\}, this acts as Mij(θ,φ)  =  (10000cos⁡θsin⁡θ00−eiφsin⁡θeiφcos⁡θ0000eiφ)  .M_{ij}(\theta,\varphi) \;=\; \begin{pmatrix} 1 & 0 & 0 & 0 \\ 0 & \cos\theta & \sin\theta & 0 \\ 0 & -e^{i\varphi}\sin\theta & e^{i\varphi}\cos\theta & 0 \\ 0 & 0 & 0 & e^{i\varphi} \end{pmatrix}~~. Two observations:
  • The central 2×22\times 2 block (acting on ∣1i⟩,∣1j⟩|1_i\rangle, |1_j\rangle) is the transpose of Eq. (4). The transpose appears because Eq. (4) is written in the Heisenberg picture (transformation of ci†,cj†c_i^\dagger, c_j^\dagger), whereas the matrix above acts on states.
  • The corner element eiφe^{i\varphi} on ∣1i1j⟩|1_i 1_j\rangle comes from eiφ nje^{i\varphi\,n_j}. For a Slater determinant whose pair (i,j)(i,j) is never doubly occupied during the circuit, this factor is invisible and a plain Givens would suffice; for a non-particle-conserving (BCS-style) state the doubly-occupied corner does get amplitude, and dropping the phase produces wrong relative signs.
The phased_givens qfunc implements exactly the matrix above. We invoke it via phased_givens(theta, phi, [qba[i], qba[j]]): in Classiq’s qubit-ordering convention the first qubit in the list is the least-significant bit, so the basis index seen by the unitary gate is 2 nj+ni2\,n_j + n_i, which lines up with the Fock ordering {∣vac⟩,∣1i⟩,∣1j⟩,∣1i1j⟩}\{|\text{vac}\rangle, |1_i\rangle, |1_j\rangle, |1_i 1_j\rangle\}.
The circuit is verified by considering the single excitation subspace and comparing the prepared state to the analytical result. The ground state of the single excitation subspace is up to a global phase just d1†∣0M⟩=∑μQ1,μcμ†∣0M⟩  ,d_1^\dagger | 0^M\rangle =\sum_\mu Q_{1,\mu} c^{\dagger}_\mu | 0^M\rangle ~~, which after the Jordan-Wigner transformation corresponds to the qubit state with amplitudes [Q1,1,Q1,2,…,Q1,M]  .[Q_{1,1},Q_{1,2},\dots, Q_{1,M}]~~. After introducing the utility functions we can now define the Hamiltonian, and apply the Classiq functions to prepare its ground state.
We next syntesize the quantum program, check the circuit depth and extract the amplitudes of the prepared state.
Output:
Output:
For the single excitation subspace we can easily compare the preparation of the quantum state with the exact diagonalization. To compare between the two we normalize the quantum solution so as to cancel the difference in the global phase with respect to the classical result.
output
Output:

General Quadratic Hamiltonian

In the general case the number of particles is not conserved under the dynamics of HH (Eq. (1)). This scenario is more involved than the particle-conserving case. Here, we will employ several classical transformations that will effectively diagonalize the Hamiltonian. Following, similarly to the simpler particle conserving case, we construct a unitary transformation that excites the ground state from the vacuum. The general quadratic fermionic Hamiltonian can be written in a concise form H=∑μ,ν=1Mhμνcμ†cν+12∑μ,νΔμνcμ†cν†+h.c  ,H =\sum_{\mu, \nu = 1}^M h_{\mu \nu}c_\mu^{\dagger} c_\nu + \frac{1}{2} \sum_{\mu,\nu} \Delta_{\mu\nu} c_\mu^\dagger c_\nu^{\dagger} + \text{h.c} ~~, where hh and Δ\Delta matrices are hermitian and anti-symmetric, correspondingly. For numerical diagonalization it is convenient to introduce the Majorana operators: xμ=12(cμ†+cμ)   ,   pμ=i2(cμ†−cμ)  ,x_\mu = \frac{1}{\sqrt{2}}\left(c_\mu^\dagger + c_\mu \right)~~~,~~~p_\mu = \frac{i}{\sqrt{2}}\left(c_\mu^\dagger - c_\mu \right)~~, for μ=1,…,M\mu=1,\dots ,M. The Majorana operators satisfy the anticommutation relations {xμ,xν}={pμ,pν}=δμν  ,  {xμ,pν}=0  .\{x_\mu,x_\nu \}= \{p_\mu,p_\nu \} = \delta_{\mu\nu}~~,~~\{x_\mu, p_\nu\} = 0 ~~. A unitary mapping relates between the two representations [1] f=Ω(c†c)  ,      Ω=12(IIiI−iI)  ,\mathbf{f} = \Omega \begin{pmatrix} \mathbf{c}^\dagger \\ \mathbf{c} \end{pmatrix}~~,~~~~~~ \Omega = \frac{1}{\sqrt{2}} \begin{pmatrix} \mathbb{I} & \mathbb{I} \\ i\mathbb{I} & -i\mathbb{I} \end{pmatrix}~~, where f=(x1,⋯ ,xM,p1,⋯pM)T\mathbf{f} = (x_1,\cdots,x_M, p_1,\cdots p_{M})^T. Expressing the Hamiltonian in terms of the Majorana fermion operators, we have H=i2 fTA f+const  ,(5)H = \frac{i}{2}\,\mathbf{f}^T A\, \mathbf{f} + \text{const}~~,\tag{5} where AA is a 2M×2M2M\times 2M real antisymmetric matrix. A=−i Ω∗(Δh−h∗−Δ∗)Ω†  .A = -i\,\Omega^* \begin{pmatrix} \Delta & h \\ -h^* & -\Delta^* \end{pmatrix} \Omega^\dagger~~. To simplify the solution, we perform another basis transformation with the orthogonal matrix RR, f′=Rf\mathbf{f}' = R\mathbf{f}, casting AA into its real Schur form: RART=(0E−E0)  ,R AR^T =\begin{pmatrix} 0 & E \\ -E & 0 \end{pmatrix} ~~, where E=diag(ϵ1,…,ϵM)E = \text{diag}(\epsilon_1,\dots, \epsilon_M) is a diagonal matrix of size MM with positive increasing eigenvalues. The transformation splits the operators into two distinct pairs, where the dynamics of each pair of operators is decoupled from the rest. Finally, we transform back to fermionic operators (d†d)=Ω†(f′†f′)=Ω†R(f†f)=Ω†RΩ(c†c)≡W(c†c)  ,\begin{pmatrix} \mathbf{d}^\dagger \\ \mathbf{d} \end{pmatrix} = \Omega^\dagger \begin{pmatrix} \mathbf{f'}^{\dagger} \\ \mathbf{f'} \end{pmatrix} = \Omega^\dagger R \begin{pmatrix} \mathbf{f}^{\dagger} \\ \mathbf{f} \end{pmatrix} = \Omega^\dagger R \Omega \begin{pmatrix} \mathbf{c}^{\dagger} \\ \mathbf{c} \end{pmatrix} \equiv W \begin{pmatrix} \mathbf{c}^{\dagger} \\ \mathbf{c} \end{pmatrix}~~, which is concisely expressed in terms of the unitary matrix W=Ω†RΩW = \Omega^\dagger R \Omega, known as the Bogoliubov-de Gennes (BdG) matrix. The operator basis transformation brings the Hamiltonian to the desired diagonal form H=∑ηϵη(dη†dη+dηdη†)+const  .H = \sum_\eta \epsilon_{\eta}(d_\eta^\dagger d_\eta + d_\eta d_\eta^\dagger) + \text{const}~~. The transformation matrix has a block form, W=(W1∗W2∗W2W1)  ,W=\begin{pmatrix} W_1^* & W_2^* \\ W_2 & W_1 \end{pmatrix} ~~, therefore it suffices to treat only the lower half WL=(W2  W1)W_L = (W_2 ~~ W_1). By applying Givens rotations on adjacent fermionic modes (encoded by the Jordan Wigner transformation) and particle-hole Bogoliubov transformations on the last fermionic mode. Crucially, the later transformations modify the particle number (unlike the Givens rotations), allowing to prepare ground states of non-particle conserving Hamiltonians. The Givens rotation for the general case is given by the 4 by 4 matrix Gij(gen)(θ,φ)=(Gij(θ,φ)00Gij(θ,−φ))  ,G^{(\text{gen})}_{ij}(\theta,\varphi) = \begin{pmatrix} G_{ij}(\theta,\varphi) & \mathbf{0} \\ \mathbf{0} & G_{ij}(\theta,-\varphi) \end{pmatrix}~~, where the two mode Givens rotation Gij(θ,φ)G_{ij}(\theta, \varphi) is defined in Eq. (4). The Bogoliubov transformation modifies only the last fermionic mode cM→cM†c_M\rightarrow c_M^\dagger, while the rest of the modes remain unchanged cj→cjc_j\rightarrow c_j, for j∈[1,M−1]j\in [1,M-1]. In the qubit representation this corresponds to application of an XX gate on the last qubit. We next introduce the matrix UU, satisfying VWLU†=(0 1)VW_LU^\dagger = (\mathbf{0}~ \mathbf{1}), where VV is an arbitrary unitary matrix. By employing a modified QR decomposition equation we can decompose UU into a sequence of NG=O(M2)N_G = O(M^2) Givens and particle-hole transformations U=BGNG…BG1B  .U = B G_{N_G}\dots BG_1 B~~. The corresponding gates can be performed in parallel leading to a circuit depth which is at most 2M−12M-1.

Algorithmic Steps

The state preparation algorithm includes the following steps:
  1. Constructs AA
  2. Evaluates transformation RR, bringing AA to the real Schur form, and constructs BdG matrix, WW.
  3. Decomposes UU into a sequence of Givens rotations and particle-hole Bogoliubov transformations.
Comparing to the particle conserving case, we notice a few important differences. First, here we diagonalize an 2M2M by 2M2M matrix, AA, while in the particle conserving case we diagonalized hh (an MM by MM matrix). As a consequence, the diagonalization technique is slightly different. Furthermore, in the particle conserving case, the phase of the Givens rotation did not effect the result (φ=0\varphi = 0), while in the present case, the phase degree of freedom is required in the diagonalization procedure. Finally, we include intertwined Givens and particle hole-Bogoliubov transformations, the former, rotate fermionic modes within subspaces of defined particle numbers, while the later transition between these subspaces. The combined effect is crucial in order to prepare the ground state of a general quadratic fermionic Hamiltonian. A simple example, utilizing only numpy data structures is presented in the technical notes section below. The example demonstrates the theoretical steps for the case of a 44 by 44 BdG matrix. In the following section, we prepare the ground state of a general fermionic Hamiltonian (including particle non-conserving terms).

Preparation of a Fermionic Ground State

For two fermionic modes the full Fock space is only 44-dimensional, so we can compare the prepared state directly to the analytical ground state of HH obtained by exact diagonalization. We first evaluate the analytical result by building the 44 by 44 Hamiltonian matrix, diagonalizing it, and picking the lowest-energy eigenvector as the analytical ground state. The Hamiltonian is defined by the following matrices:
Output:
Next, we synthesize a 2-qubit circuit that employs prepare_fermionic_gaussian to prepare the ground state, the amplitudes match up to a global phase.
Now we execute on the statevector simulator, and compute the fidelity.
Output:
Output:

Technical Notes

Heisenberg Dynamics of the Dirac Operators Under a Number-Conserving Quadratic Hamiltonian

Referenced from the Preparation of a Slater Determinant State section. We show why diagonalizing the M×MM\times M one-body matrix hh is enough to capture the dynamics generated by HH in the full 2M2^M-dimensional Fock space. Using the anti-commutation relations and the Heisenberg equation (dO(t)dt=i[H,O(t)]\frac{dO(t)}{dt} = i\left[H, O(t) \right]), we have dcλ†dt=i[H,cλ†]=i∑μνhμν[cμ†cν,cλ]\frac{dc_\lambda^\dagger}{dt} = i\left[H, c_\lambda^\dagger \right]= i \sum_{\mu\nu} h_{\mu\nu}[c_\mu^\dagger c_\nu,c_\lambda] =i∑μνhμν[cμ†cν,cλ†]=i∑μνhμνcμ†δνλ=i∑μhμλcμ†  ,= i \sum_{\mu\nu} h_{\mu\nu}[c_\mu^\dagger c_\nu,c_\lambda^\dagger] = i \sum_{\mu\nu} h_{\mu\nu}c_\mu^\dagger \delta_{\nu \lambda} = i \sum_{\mu} h_{\mu\lambda}c_\mu^\dagger ~~, where the time-dependence is suppressed for conciseness. The dynamics in the Heisenberg representation can therefore be expressed as c†(t)=eiHtc†e−iHt=eihTc†  ,\mathbf{c}^\dagger (t) = e^{i H t} \mathbf{c}^\dagger e^{-i H t} = e^{i h^T }\mathbf{c}^\dagger~~, where c†={c1†,…,cM†}T\mathbf{c}^\dagger = \{c_1^\dagger,\dots,c_M^\dagger\}^T and MM is the total number of fermionic modes. Remarkably, this implies that the diagonalization of hh, (an MM by MM matrix) provides the dynamics in the 2M2^M Hilbert space.

Heisenberg Dynamics of the Dirac Operators for a General Quadratic Fermion Hamiltonian

Substituting Eq. (5) into the Heisenberg equation, we obtain dfηdt=i[H,fη]=−12∑μνAμν(−δημfν+δηνfμ)=−∑μAμηfμ  ,\frac{d f_\eta}{dt} = i[H, f_\eta] = -\frac{1}{2} \sum_{\mu \nu} A_{\mu \nu}(-\delta_{\eta\mu}f_\nu + \delta_{\eta \nu}f_{\mu}) = -\sum_{\mu}A_{\mu \eta}f_{\mu}~~, where the last equality stems from AA being antisymmetric. This leads to a vector equation describing the Heisenberg dynamics of the Majorana operators f(t)=e−tAf  .\mathbf{f}(t) = e^{-tA}\mathbf{f}~~. Thus, the system dynamics under HH, can be represented in terms of a simple linear relation, involving the Majorana operators.

Simple Example for a General Hamiltonian (Particle Non-Conserving)

We consider a quadratic Hamiltonian of the form H=∑μνcμ†hμνcν+12∑μνΔμν(cμ†cν†+h.c)  ,H = \sum_{\mu \nu} c_\mu^\dagger h_{\mu \nu} c_{\nu} + \frac{1}{2}\sum_{\mu \nu}\Delta_{\mu \nu}\left(c_\mu^\dagger c_\nu^\dagger +\text{h.c} \right)~~, Two 22 by 22 matrices, hh and Δ\Delta, are considered, where hh is hermitian and Δ\Delta is antisymmetric, corresponding to one-body terms in the Hamiltonian. Following, we construct the matrix AA, associated with the Majorana fermion representation of the Hamiltonian, evaluate the BdG matrix WW, decompose it into Givens rotations and Bogoliubov transformations and verify the decomposition.
Output:
We utilize OpenFermion’s fermionic_gaussian_decomposition method which receives the lower half of WW, and outputs four objects describing the canonical decomposition V WL U†=(0    D)  ,V\, W_L\, U^\dagger = (\mathbf{0}\;\; D)~~, where VV is an M×MM\times M unitary, UU is a 2M×2M2M\times 2M unitary, and DD is an M×MM\times M diagonal matrix of unit-modulus phases, where MM is the number of fermionic modes.
  • decomposition: the description of UU as a sequence of two-mode operations applied to the columns of WLW_L.
The list groups operations into layers that can be performed in parallel. Each layer entry is either the string 'pht', indicating a particle-hole Bogoliubov transformation on the last fermionic mode, or a tuple specifying a “double” Givens rotation on adjacent fermionic modes, acting on the upper MM columns of WLW_L and as its complex conjugate on the lower MM columns.
  • left_decomposition and left_diagonal: are utilized to compose auxiliary M×MM\times M unitary VTD∗V^T D^*
  • diagonal: a length-MM array of unit-modulus complex numbers - the diagonal entries of DD in the identity above. It is utilized to evaluate V=DD†VV=D D^\dagger V.
In the next cell we use these four outputs to reconstruct both UU and VV explicitly and check the identity VWLU†=(0    D)V W_L U^\dagger = (\mathbf{0}\;\; D) holds.

References

[1] : Jiang, Z., Sung, K. J., Kechedzhi, K., Smelyanskiy, V. N., & Boixo, S. (2018). Quantum algorithms to simulate many-body physics of correlated fermions. Physical Review Applied, 9(4), 044036. arXiv:1711.05395. [2] : Arute, F., Arya, K., Babbush, R., Bacon, D., Bardin, J. C., Barends, R., … & Zanker, S. (2020). Observation of separated dynamics of charge and spin in the Fermi-Hubbard model. arXiv:2010.07965. [3] :Surace, J., & Tagliacozzo, L. (2022). Fermionic Gaussian states: an introduction to numerical approaches. SciPost Physics Lecture Notes, 054. arXiv:2111.08343.