In the theory section we have talked a bit about different types of ansatzes and how can one tailor them to address a specific problem. In this exercise you will code two general-purpose ansatzes for a quantum circuit of 4 qubits. In particular, layered gate architectures, which means that the ansatz will be repeated several times, have been proven to provide a good degree of expressibility to solve a wide range of problems and a relatively low depth.
If the problem we want to address does not require many parameters to be described, one good option would be to use an ansatz known as the Basic Entangler, which looks like
On the other hand, if we do require more expressibility, an option with more entanglement and free parameters is the Strong Entangler, which is made of
Look at the documentation of BasicEntanglerLayers and qml.StronglyEntanglingLayers and complete the code below to implement the Basic and Strong Entanglers as a function of a list of parameters (params
). Your implementation should match the images shown above. Note that the shape of params
will match the shape shown in the documentation. Your circuits should return the expectation value of an observable
.
To interact with codercises, please switch to a larger screen size.
Learning Objectives: