DEV Community

Cover image for Demystifying the Quantum Computing Stack
Zaynul Abedin Miah
Zaynul Abedin Miah

Posted on • Updated on

Demystifying the Quantum Computing Stack

Most people don’t fully understand how computers work from circuits to apps. Hardware and software specialists understand their domain, but few see the full picture.

Let's take typing an email as an example. You input text via the keyboard (input). The processor encodes into bits (computation). The bits go through gates/circuits to render letters on screen (processing). The email text appears (output).

Behind the scenes, the computer manipulates bits with circuits and gates programmed with code. As the user, you don't need these details. We'll peel back the layers, to appreciate how the electronics and hardware run the software. This will make it easier to understand qubits for quantum computing.

Classical Computing Stack

This explains the layers of classical computing, from physical bits, to logic gates, circuits, algorithms and finally applications. It shows how each layer builds on the previous one.

Let's imagine you want to stream a movie on Netflix. This involves several layers:

Physical Bits - This is the lowest level of the stack. Bits are physically implemented as transistors and electronic switches in the hardware. Transistors act like switches that are either on or off, representing 1 or 0. Modern CPUs have billions of transistors packed extremely densely using nanotechnology.

Logic Gates - The basic building blocks of logical operations. Common gates include:

  • NOT gate - Flips the input bit, 0 becomes 1, 1 becomes 0.
  • AND gate - Outputs 1 only if both input bits are 1, otherwise outputs 0.
  • OR gate - Outputs 1 if either input bit is 1, otherwise 0.
  • XOR (exclusive OR) gate - Outputs 1 if the input bits are different, 0 if they are the same. Gates are combined together to create components like adders, flip-flops, registers that are used to build circuits.

Circuits - Gates are connected together into circuits that perform operations like adding two numbers. More complex circuits include ALUs (arithmetic logic units) and control units in CPUs. They are typically represented using digital logic diagrams. For streaming, circuits encode and decode video data.

Algorithms- Step-by-step sequences of instructions or operations to perform tasks like sorting data, encrypting information, compressing files. Circuits are designed to implement algorithms. For Netflix, the compression algorithm squeezes the movie file size, the encryption algorithm scrambles data for security.

Protocols - Common sets of steps like the internet protocols telling data how to route across the network.Common ones include TCP/IP, HTTP, FTP. This allows your computer to request the movie data from Netflix's servers.

Application - The top layer that ties everything together into an application like the Netflix app. It uses the lower protocols, algorithms, circuits down to the physical bits to store and play your movie.

Image description

What is Programming?

Programming involves writing instructions for a computer to execute and transform inputs to outputs.

At its core, programming requires:

  • Inputs - data needed for the task

  • Program Logic - step-by-step instructions to manipulate inputs to calculate desired outputs

  • Outputs - results produced after processing inputs

For example, a program to calculate circle area would take radius as input. The logic would:

  1. Get radius value

  2. Calculate area using formula πr^2

  3. Display area

The output would be the numerical area printed.

The logic contains unambiguous instructions in a language like Python executed sequentially.

Other examples include:

  • Banking app accepting deposits

  • Accounting program generating reports

  • Online store fetching and processing data

Real-world programming requires analyzing requirements, designing logic, coding, and testing.

Python as a programming language

Python is a high-level, general purpose programming language used to build diverse applications.

Key features:

  • Readability - Python code is designed to be easy to understand, almost like English. For example: print("Hello World!").

  • Versatility - Used for web, data science, AI, scientific computing, and more.

  • Rich Ecosystem - Many high-quality libraries like NumPy, TensorFlow, Django/Flask. Allows reusing code.

  • Easy to Learn - Intuitive syntax compared to Java/C++. Good first language.

Example projects:

  • Web apps like Dropbox, Instagram

  • Data science/AI - NumPy, Pandas, Scikit-Learn

  • Automation scripts

Python libraries are pre-written code packages that extend capabilities. They provide common implementations so developers don't rewrite everything.

Key Python libraries for quantum:

  1. NumPy - Scientific computing tools

  2. Cirq - Quantum computing/circuits library

  3. TensorFlow Quantum - Quantum machine learning

  4. PyQuil - Quantum programs for Rigetti chips

  5. Qiskit - IBM's quantum circuit simulator

So Python plus quantum libraries provide a full stack for developing/simulating quantum algorithms and running them on quantum hardware.

Image description

Top comments (0)