What is an easy way to implement QFT in strawberryfields?

The Fourier Gate provided in the documentation gives a one-mode gate. Now, to create a multi-mode QFT for CV quantum algorithms, one can look at the mathematical structure of QFT from references. But since this process is very popular, I was wondering how can one implement QFT efficiently? Is there any implementation example somewhere?

Hi @Prabhat_Prabhat,

Thank you for your question. We have a module on the Xanadu Quantum Codebook dedicated to QFT. In particular, submodule F.3 covers the n-qubit QFT. The code is not complete here, you’re presented with coding challenges for you to come to the answer.

That being said, maybe the demo on arithmetic with QFT is what you were looking for. Does this answer your question? Or were you looking for something different?

Hi @Prabhat_Prabhat, I just realized that you were looking for something for CV algorithms, not PennyLane. Unfortunately I don’t know of any implementation other than the gate you already found.

1 Like

No problem @CatalinaAlbornoz, I was just confused whether QFT for, let’s say, 5 qumodes will simply be FT gate applied to each of the 5 qumodes. Wondered maybe that’s why it doesn’t have any direct module in strawberry fields. Thank you anyway :slight_smile:

1 Like

Hi @Prabhat_Prabhat, I’m not 100% sure about this. Let me check and get back to you on this.

Hi @Prabhat_Prabhat,

Here’s the answer from my colleague Rafael:

Fourier transforms arise in many different ways in CV optics. When people say QFT for discrete variable systems, the usually mean to apply the unitary operator that corresponds the the “D times D” DFT matrix, where you might have n qubits with D = 2^n. You could define a similar thing for qudits, changing D = d^n. The problem is, if you want to go to the CV case, even a single mode has d = infinite. Given a single mode, if you use the number basis, then the Fourier transform is not the right thing because it is diagonal. If you use the position quadrature basis, then it does look like the right thing. If you have multiple modes, you could also be talking about the “mode label” Fourier transform, which would correspond to the beamsplitter network on n modes that uniformly mixes the intensities but where the amplitudes all have different phase coefficients corresponding to powers of nth roots of unity. All of these generalizations are just different ways in which the DFT matrix crops up in this context, but none of them is quite the same as the QFT operation in the qubit/qudit context (it forms a nontrivial subroutine in qubit algorithms). In contrast, these mode-type DFT implementations are quite simple to implement.

I hope this helps! Please let me know if you have any further questions.