/QOSF_2020

Repository created for the QOSF Mentorship Program 2020

Primary LanguageJupyter NotebookMIT LicenseMIT


Quantum Computing Mentorship Program Fall 2020

In this repository, you will find my code submission to the QOSF Mentorship Program Fall 2020. The one I have decided to submit is #1. I decided to work in this particular task because I have a lot fun seeing how the optimization evolves tweaking variables and parameters. Sounds like a lot of fun right? 😝

For this version of the repository the master branch correspond precisely to Task #1. I do have the intention to solve the other task and add in their own branch for this same repository. So if you would like to see all the solutions (my solutions with my own style and approach) you have to stay tuned to this repository. 😎

🌟 Bonus feature: I am also planning to include a julia version of all the code, wherever possible of course.


Task #1: Problem Statement

Implement, on a quantum simulator of your choice, the following 4 qubits state $\psi(\theta)$:

img

Where the number of layers, denoted with L, has to be considered as a parameter. We call ¨Layer¨ the combination of 1 yellow + 1 green block, so, for example, U1 + U2 is a layer. The odd/even variational blocks are given by:

Even blocks

img

Odd blocks

img

The angles $\theta_{i,n}$, are variational parameters, lying in the interval (0, 2), initialized at random. Double qubit gates are CZ gates.

Report with a plot, as a function of the number of layers, L, the minimum distance

$\epsilon = min_{\theta} \norm( |\psi(\theta)> - |\phi> )$

Where $|\phi>$ is a randomly generated vector on 4 qubits and the norm $\norm(|v>) $, of a state | v>, simply denotes the square root of the sum of the modulus square of the components of |v >. The right set of parameters $\theta_{i,n}$ can be found via any method of choice (e.g. grid-search or gradient descent)

Bonus question:

Try using other gates for the parametrized gates and see what happens.


Structure of My Code

I have included a utils.py file that contains all of the classes, functions, objects, and imports required for notebooks to run properly.

As a user, you are just required to provide the parameters needs to initialize the simulations. For a detailed description of the parameters take a look at the Notebooks.

For Task #1, I have defined a simulation class that, among other parameters, receives the maximum number of layers that the user wants to include in the simulation. This class prepares the necessary circuits which are later executed. A optimization class has also been define to tune the variational parameters of the circuits. Proper handling and execution of all simulations is already provided within the Notebooks. 👍

Requirements

Nothing out of the ordinary is required for you to run the Notebooks, just make sure you have qiskit and qiskit[visualization] installed. Regarding specific requirements for your OS you can check the following link:

https://qiskit.org/documentation/install.html

Acknowledgments

To the Quantum Open Source Foundation and its fantastic staff for organizing this event!