Cat state generation?

Hi everyone!

I’m pretty new to pennylane and I’m trying to getting in hand with it. Today, I tried to generate some random cat state, but I could not be able to follow through it.

I found in the documentation the method CatState, and I inserted it inside a basic random state circuit, with device.gaussian.
It produced always the same error: no gate CatState allowed in the device.

May you hand me some help, please?

def local_qubit_rotation_circuit():
    for w in dev.wires:
        qml.CatState(1,np.pi,1, wires=w)
    return qml.state()

Hello @AdriQD!

This is a great catch and it seems to be an issue on our side, since CatState does not seem to be allowed in the list of operations for default.gaussian. We are aware that the documentation seems to be contradicting itself and we need to fix it. An option is for you at the moment is to use qml.InterferometerUnitary to generate the state that you need.

Please also keep in mind that default.gaussian does not accept qml.state() as a return type (since you need an infinite basis to represent CV states in general!) so make sure that you return expectation values using qml.expval.

You can check out this PennyLane tutorial to see the default.gaussian device in action.

Hope this helps!


1 Like

many hthanks alvaro :slight_smile:

1 Like