# Explore Quantum Computing: A Beginner's Guide to Programming

Written on

## Chapter 1: Introduction to Quantum Computing

Quantum computing is advancing at a remarkable pace, with numerous companies and research institutions striving to deliver operational quantum hardware to the market. Each small achievement in this domain represents a substantial leap forward.

Currently, there is no ideal quantum computer capable of executing advanced algorithms like Shor's and Grover's. Nevertheless, the existing quantum devices are improving swiftly. IBM anticipates that in the next ten years, quantum computers will provide a distinct advantage by solving challenges that classical computers cannot tackle.

In 2019, IBM introduced a metric called Quantum Volume (QV) to evaluate the capability and efficiency of quantum hardware. This metric is derived from various factors, including the number of qubits, their interconnectivity, and the probability of measurement errors. For practical algorithm execution on real hardware, a high QV is necessary. As a reference, IBM's current top QV device stands at 32.

On the software front, experts forecast a significant increase in demand for quantum programmers over the next decade. Major players like Google, IBM, and Microsoft are heavily investing in training the next wave of quantum researchers and developers. Interestingly, you don't need an advanced degree in physics or mathematics to program a quantum computer; a vivid imagination is often enough.

### Section 1.1: Classical vs. Quantum Programming

Quantum computers operate on a fundamentally different principle compared to classical systems. In classical computing, we deal exclusively with binary digits—0s and 1s. In contrast, quantum computers utilize 0s, 1s, and the concept of superposition, which allows for a state of "maybe 0 or 1." This unique property is the cornerstone of quantum algorithms, enabling them to harness the full potential of quantum mechanics.

Programming quantum computers today resembles coding classical machines in the 1950s—akin to assembly language but with improved syntax. While this may seem daunting due to the complexities of assembly language, anyone familiar with basic quantum concepts, such as qubits and superposition, can begin to write quantum code without delving deeply into physics.

### Section 1.2: Options for Quantum Programming

Both industry and academia are diligently working to create high-level quantum programming languages that minimize the need for extensive knowledge in quantum physics. Today, there are numerous standalone quantum programming languages and libraries for classical programming languages available.

Your programming options include coding at the quantum assembly level, employing a library for quantum computing within a classical programming environment, or utilizing a dedicated quantum programming language. Below are some popular choices across these categories.

## Chapter 2: Programming Approaches

The first video titled "How to program a quantum computer using Qiskit" provides insights into using Qiskit, a leading quantum programming library developed by IBM. This library is user-friendly and has a vibrant community, making it an excellent starting point for newcomers.

The second video, "How Do We Program the Quantum Computers of the Future? | Elevate Festival 2023," discusses the future prospects and evolving methods in quantum computing programming.

### Section 2.1: Assembly-Level Quantum Programming

For assembly-level programming, the QX Simulator allows developers to simulate a universal quantum computer's behavior. Programmers can design and test their quantum algorithms using Quantum Assembly Language (QASM).

### Section 2.2: Classical Languages with Quantum Libraries

Several classical programming languages are equipped with quantum libraries. Here are a few notable options, ranked by popularity:

**Qiskit**: Developed by IBM Research in 2017, Qiskit is the most widely used quantum programming library, allowing users to run Python code on actual IBM quantum computers.**Cirq**: Created by Google developers, Cirq is an unofficial Python library for writing and testing quantum algorithms, though it does not permit execution on Google's devices.**Pyquil**: This library from Rigetti allows users to implement quantum algorithms using Quil, a quantum instruction language.**Scaffold**: A C++ library for writing and executing quantum algorithms on classical machines.**Strange**: A Java API that facilitates writing and running quantum algorithms.

There are additional libraries available, although many may no longer be actively developed.

### Section 2.3: Standalone Quantum Programming Languages

Researchers have also developed standalone quantum programming languages that mirror the syntax of popular classical languages. These include:

**Q#**: Developed by Microsoft, Q# is part of the Quantum Development Kit (QDK) and includes a simulator and circuit optimizer.**Quipper**: This embedded language supports functional quantum programming and allows for a higher-level algorithm description.**Sliq**: The newest entry, Sliq, offers a Python and C++-like syntax for high-level quantum programming.

### Section 3: Getting Started

With various options available, choosing a starting point for your quantum programming journey can be overwhelming. My recommendation is to begin with a library that integrates into a classical programming language you are already familiar with. Once you grasp the quantum logic, you can progress to a dedicated quantum programming language.

I personally began with Qiskit and continue to use it extensively—not only because it is Python-based but also due to the ability to run code on real quantum computers. Although results may not always be perfect, the opportunity to execute code on actual quantum hardware is fascinating.

To simplify your understanding, let's implement the same quantum code using all nine approaches mentioned earlier. By examining the different implementations, you can determine which method resonates with you the most.

In contemporary quantum programming, you typically construct a circuit that applies your algorithm through quantum gates, analogous to classical gates. For example, to create a superposition between two qubits, you would utilize the Hadamard Gate, which transforms a 0 or 1 into an equal superposition of both states.

## Conclusion

I believe in the value of focused learning, which often leads to better outcomes. Therefore, I suggest starting with a quantum library rooted in a classical programming language. This approach allows you to concentrate on understanding quantum concepts without the added complexity of mastering a new programming language simultaneously. Once you feel at ease with quantum logic, you can transition to a dedicated quantum programming language. As you grow more knowledgeable, you may also explore lower-level options like QASM for deeper insights into quantum computing.

## References

- Cross, L. S. Bishop, S. Sheldon, P. D. Nation, and J. M. Gambetta, “Validating quantum computers using randomized model circuits.”

Wexelblat, Richard L., ed. History of programming languages. Academic Press, 2014.