To execute your first program on your QMI, we will run a simple quantum coin-toss program using the QVM simulator. This program prepares a quantum state which is in an equal superposition of the (heads) and (tails) states on three separate qubits (coins). It uses quantum mechanics to randomly select between heads and tails, similar to flipping a coin.
This program, with the filename
hello_qmi.py, is already included in the home directory of your QMI (once you've connected to your QMI, type ls -a to list all files).
Launch your JupyterLab instance from the QMI card on the Dashboard
Open a terminal and simply run :
you should see an output similar to the following:
You can see that 3 qubits (each column) gave random results for this experiment over 10 coin flips (each row).
If you run this program many times, you will see different random results each time, but the percentage of results which are 0 or 1 will each approach 50%, like a fair coin.
We invite you to look inside
hello_qmi.py to see how the program was built and executed using pyQuil. We've included verbose comments to explain each step. You can quickly do this with the following command:
Great! Your QMI is now set up and you've used it to successfully simulate a quantum program. Check out the Forest™ SDK documentation to develop your own program, and then after testing it on the QVM simulator, learn how to use the command-line interface to execute your program on the real quantum hardware.
Moving files to/from your QMI Developing programs can be done on your local computer, or on your Quantum Machine Image. Read our guide to learn how to move files to/from your QMI.