In the last 3 months I have been studying more and more about quantum computing, spoken to members of the Q# team at Microsoft, recorded a new Pluralsight Play by Play course and recorded a new episode of The Future of Tech. I find the area both incredible mystifying and very rewarding every time I understand a new concept. The below article is a quick intro to starting with Q# and Visual Studio and was first published on gooroo.io.
For the past 47 years since Intel released the 4004 in 1971, computing has been following very much the same path. Microprocessors based on transistors and bits switching between 0 and 1 have been the cornerstone of every single consumer and commercial computing experience since then. While we rely on computers for increasingly more tasks, there are calculations that just aren’t feasible with traditional computing, and this is where quantum computing can prove both superior and immensely powerful.
Quantum computing and quantum mechanics has been topics of research for over 100 years, since Max Planck release his Quantum Hypothesis in 1900. Albert Einstein has used quantum theory to explain several hypothesis and many more scientists since expanded and corroborated the theories. Today we have quantum computing which promises dramatic improvements for certain types of problems.
The Promise of Quantum Computing
To understand the real potential of quantum computing, a comparison to traditional computing is the best way. A typical example is to imagine 40 bits. With a traditional processor this would require 2^40 calculations to cover all possibilities, or 1,099,511,627,776 bits of memory (about 137GB). Adding a single bit to the calculation doubles the use of memory. Conversely, using quantum computing you only need 40 bits, or qubits, of memory. That is a huge difference going from 2^n bits needed to just n.
Some of the industries that have been noted as gaining significantly from quantum computing advances are healthcare and pharmaceuticals, aviation, engineering, predictive analytics, car manufacturing (in particular self-driving cars), and of course cryptography. Real world progress has already been made by Volkswagen with optimizing the traffic patterns for taxis in Beijing. As soon as businesses and large companies get their thinking aligned with the problems that quantum computing can help solve, they will start investing large amounts in it.
However, it isn’t as simple “just use it”, or “let’s get some developers onto it”.
One of the most fundamental principles in quantum mechanics, and hence quantum computing, is the principle of superposition. It states that two or more valid quantum states can be added, or superposed, to create a new valid quantum state. Conversely, every quantum state can be represented as two or more distinct quantum states as well. Furthermore, quantum objects (which are often electrons or atoms), can be in more than one quantum state at the same time. Yes, at the same time. It can have two different state both in appearance, with speed and in location. Quantum mechanics stipulates that quantum states can be in two places at the same time.
If you think of quantum particles as waves, then these waves are in all possible states at the same time, rather than being in one state or another. It is like the waves are overlapping and at the same time not. As weird as it is that a particle can be in two places at once, as soon as you observe it (measure it) it will collapse into its final state. This means as soon as you take a measurement, all of the quantum particles will stop in a single state.
Another fundamental part of quantum computing is entanglement. This occurs when pairs of quantum particles are linked so that each particle cannot be observed independently of the other. The really strange part is that these particles don’t have to be anywhere near each other. At all. When a pair or group of particles can only be described by the quantum state for the system, and not by individual quantum states, we say the particles are “entangled”.
The paradox is that a measurement made on either of the particles apparently collapses the state of the entire entangled system—and does so instantaneously, before any information about the measurement result could have been communicated to the other particle. This concept is fundamental to quantum computing but has also meant that some scientist (like Albert Einstein) doubted the principle. It is probably the hardest theory, or principle, to understand and accept within quantum mechanics.
Inviting developers into the world of quantum computing is difficult at the best of times. There are several hurdles to overcome, starting with understanding the field in general. The two points mentioned previously, while fundamental to the field, are just the tip of the iceberg. There is a lot of theory and a lot of very advanced mathematics, and if you get through all that you need a quantum computer and a programming interface.
Microsoft has attempted to bridge that gap with their new quantum language Q# (Q-sharp). The whole idea is to leverage traditional computing for the control logic and then invoke the quantum code on the quantum processor. The results are sent back to the control logic and used from there. This way you get the best of both worlds.
Q# is used with the tools we know, such as Visual Studio and your own laptop. It is a simple Visual Studio Extension you install into your Visual Studio installation.
You now have access to the Q# project templates under File -> New Project -> Visual C#
Once you create your Q# Application project, you get two files created. One is the Operation.qs, which is a Q# file, and the Driver.cs, which is the C# file to hold your control logic for the quantum program. The best way to get started learning about Q# is to clone the GitHub repo containing the samples and libraries. Once you have all the tools and libraries installed, follow the official tutorial on the Microsoft Quantum docs page.
The main obvious hurdle for working with quantum computing is that there aren’t many physical machines around. Getting access to a genuine quantum computer is almost impossible, as only IBM, Google and a few other major players have them. The Canadian company D-Wave has a type of quantum computer commercially available that you can buy for around USD15,000,000.
While it will be a long time before we have personal quantum computers (if ever), getting access to the power of one is not as far away as you might think. Most of the major tech companies, including Microsoft and IBM, will provide cloud access to their installations. You can then buy access to use the quantum computer, just like you would with your AWS or Azure compute time.
Q# is a great way to get some insight and get a step ahead in the quantum space. Be ready for the future of computing.