Is there an equivalent of qiskit's transpiler on strawberry fields?

Is there anyway to define a custom unitary opertaror and have a transpiler find an adequate circuit in strawberry fields ?

for example in qiskit one would do:

from qiskit import *
from qiskit import QuantumCircuit, QuantumRegister
from qiskit.quantum_info.operators import Operator
import numpy as np
controls = QuantumRegister(2)
circuit = QuantumCircuit(controls)
z=1/np.sqrt(2)
cx = Operator([
[z, 1jz, 0, 0],
[-z, 1j
z, 0, 0],
[0, 0, -1jz, z],
[0,0 , -1j
z,-z]
])
circuit.unitary(cx, [0, 1], label=‘loc’)
result = transpile(circuit, basis_gates=[‘u3’,‘rx’,‘ry’,‘u1’,‘u2’, ‘cx’], optimization_level=3)
result.draw(‘mpl’)

is there any equivalent in strawberry fields?

Hi @Gerardo_Suarez,

Thanks for your question, and welcome to the forum!

Yes, Strawberry Fields does have some compilation tools to take arbitrary unitaries to equivalent circuits. (Note, though that this is for continuous-variable operations, and not for multi-qubit operations like in the Qiskit example you provided.)

One aspect of this is the decompositions module, which contains a couple different schemes for turning arbitrary unitaries into fixed patterns of beamsplitters and phase shifts (e.g., triangular and rectangular, both those links contain references therein to the papers with pictures of the decompositions). These are more generally accessible via the Interferometer operation, which allows you to specify a decomposition - there is an usage example of the operation in a section of a tutorial on our hardware.

There is also the capability to compile to specific hardware devices which may not have one of the fixed decomposition patterns. There are examples that show this in the docs as well as in a different tutorial about our hardware.

Please let us know if you have any additional questions :slight_smile:

1 Like

Oh ok got it, I thought maybe using Fock space with n=2 this sort of operations could be implemented on strawberry fields, a little of beginner’s ignorance. I will definitely check those tutorials and be back if I have any questions. Thanks a lot! any resource you could recommend on basic continuous variable information processing, I mainly want to use strawberry fields to simulate an entanglement distillation process, but it was formulated completely in terms of qiskit’s gate model. I thought having the unitary of the circuit would be enough to translated to strawberry fields but I was wrong

is there any simple way to map a quantum circuit (just U3 and CNOT gates) into the continuous variable model?

From my ignorant point of view it shouldn’t be that difficult as I understand that in the optical setting a U3 can be achieved by phase shifter’s and beam splitters, while a CNOT can be achieved with kerr nonlinearities or even linear optics if one uses postselection. Not pretty knowledgeable about the field though, it’s just what I’ve heard

Hi @Gerardo_Suarez,

any resource you could recommend on basic continuous variable information processing,

There is a some info on the SF docs page, and also a nice review article here. As well, there are a few textbooks I quite like and would recommend, “Quantum Optics: An Introduction” by Mark Fox, and “Essential Quantum Optics” by Ulf Leonhardt.

I thought having the unitary of the circuit would be enough to translated to strawberry fields but I was wrong

Looking back, I think my original answer didn’t state things very clearly. You’re correct, a unitary is a unitary, so if you have a unitary matrix you would normally run on a gate model machine, you can use SF to decompose it, and then run it in a continuous variable framework (technically, it would need to be special unitary, but it is straightforward to convert from unitary -> special unitary, it just involves multiplying by some factor of the determinant).

It’s just that the operations it will get decomposed to are not traditional multi-qubit operations like CNOT and U3, they will be the CV operations like beamsplitters. For the case of a single qubit, it lives in effectively the same space as a two-mode CV system. In both cases, operations belong to the special unitary group SU(2) and you can associate things like beamsplitters / phase shifts with RX / RY / RZ qubit operations.

is there any simple way to map a quantum circuit (just U3 and CNOT gates) into the continuous variable model?

Great question! What you point out re. U3/CNOT is correct, and in general there are ways of doing so, but it may be challenging to actually implement physically. There is a nice discussion and some references for converting “both ways” in a forum thread here that might be helpful.

Happy to answer any other questions you may have!