I’m struggling with the next exercise (Who likes the beatles, k-NN) on the ML track, I will have to read up on embeddings and the swap test. My web search lead me to this Pennylane forum entry, but the proposed solution looks not quite right to me. Well, after some coding and some tests, I decided I was too tired to do the harder reading and opted to solidify some concepts and solve a few easier exercises instead. On the Pennylane 101-track, I solved the exercises 1, 2, 3, and 4. Following, are a few thoughts I had along the way…
Ad Exercise 1, gate order
The exercise highlighted the non-commuting nature of operators.
Ad Exercise 2, devices
Pennylane offers multiple (simulation) devices to choose from, a brief listing
- default device
- devices to use in combination with ML frameworks (JAX, PyTorch, TensorFlow)
- device for mixed state calculations
- device for Quitrits. Quitrits enable calculations in a three-valued logic, there may be some physical advantages to such systems (stability, …), but I picture quite some mental gymnastics to deal with them.
Ad Exercise 3, superdense coding
With super dense coding, it is possible to send 2-bits of information, while transmitting only one qubit after defining the message (One entangled qubit without information is sent before defining the message).
To solve the exercise, I used a RY gate to emulate a noisy Hadamard gate.
Interesting to me, was the qml.broadcast
command, that offers a number of handy wiring patterns, and will spare me a few loops in the future.
Ad Exercise 4, finite difference method
For VQE optimizations, it is essential to have the gradients of a given circuit. Differentiability is generally a very important aspect of the Pennylane library. It is worthwhile to recap the different differentiation methods:
- backprop
- adjoint
- parameter-shift
- finite-diff
These options also enter my reading list.