It's even easier than you probably realised.

I'm talking about a Hamiltonian such as


where the $a_i$ satisfy the canonical anti-commutation relations

$$\{a_i^{\phantom\dagger},a_j^\dagger\}=\delta_{ij},\quad\{a_i^{\phantom\dagger},a_j^{\phantom\dagger}\}=0,\quad \{a_i^\dagger,a_j^\dagger\}=0.$$

And yes, we will allow terms like $a_i^\dagger a_j^\dagger$ that are not number preserving. They appear commonly in the theory of superconductivity.

There is lots of literature on this, see the list at the end. And that's fine, but I wanted a very short recipe, which I found in the following paper:

It's the most concise treatment I could find, so here we go.

Conventions: $a^\dagger$ is the Hermitian conjugate, or adjoint, of $a$; $\bar x$ is the complex conjugate of $x$; and $X^t$ denotes the transpose of $X$.

First, let's write the Hamiltonian in the form




(This is without loss of generality, and I'll explain below what to do if your favourite Hamiltonian isn't of this form yet.)

As a second preparation, we define the anti-unitary operator


for any $u,v\in\mathbb{C}^n$. That's nothing but a 'conjugate swap'.

Now all we have to do is the following:

Step 1 of 2