AmplitudeEmbedding

Hello,

I have a very simple question.
Is the function AmplitudeEmbedding( *features* , *wires* ) doing the right series of gate, starting from the 0 state ? Or just creating artificially the state for simulation ?
The documention says that it doesn’t work on all device, I could not find on which devices it works.

regards,

b

Hi @barthelemymp,

Yes, AmplitudeEmbedding acts on the entire system (all wires) by calling the QubitStateVector function. This prepares the given state by using the required gates.

If you use a PennyLane plugin that supports a quantum simulator device like PennyLane’s default.qubit or Qiskit, this function simulates your state. If you use a PennyLane plugin that supports a quantum hardware device like Forest SDK, it should correspond to initialising this state in the hardware.

The documention says that it doesn’t work on all device, I could not find on which devices it works.

This refers to the fact that QubitStateVector (and hence AmplitudeEmbedding) is a qubit state preparation function. Hence, it will only work with devices that simulate discrete variable computing. It will not work if you use default.gaussian device, for example. You can use this with default.qubit, Rigetti Forest SDK, Qiskit plugins.

1 Like

Hello,
Thank you for the answer but I’m not sure to understand.
My question is to know if AmplitudeEmbedding and so if QubitStateVector is a part of a circuit, composed by the appropriate series of gates, or if it is just accessing the state and modifying the value directly.
Another way to ask would be Is AmplitudeEmbedding working on real quantum computers or only on simulator.

In fact for my current project I need to compare different Embedding into a quantum state. That’s why I need to take into account the size of the part of the circuit that would really encode the feature in the proper quantum state (size/time).

Hi @barthelemymp. The way QubitStateVector is implemented depends on the plugin device.

For example, the default.qubit implementation directly sets the wavefunction amplitude value.

forest.qvm, on the other hand, is a hardware device, and implements QubitStateVector by decomposing it into multiple Pauli-X gates.

So amplitude encoding does work on both simulators and hardware devices.

1 Like

Thank you. That was exactly my question :slight_smile:

Hello @josh,

While AmplitudeEmbedding was working just fine on the defaut.qubit, however I’ve just tried to use it on a forest.qvm, and it doesn’t seem to work.
DeviceError: Gate QubitStateVector not supported on device forest.qvm

regards

b

Ah, apologies @barthelemymp - I was thinking of the BasisState operation, which is supported on the Forest QVM. It currently looks like AmplitudeEmbedding isn’t supported, although it should be doable to add support for this.