I’ve been reading about quantum computing for many years. I’m a pretty smart guy, but I have extreme difficulty grasping quantum. There are several issues, not the least of which is that quantum is extremely deep and difficult.
Anyway, I happened across the Qiskit library. It’s a Python library that allows you to explore quantum computing on a simulator.
The basic concept in quantum is the qubit. Understanding qubits is very difficult. Another basic concept is the idea of a quantum circuit. The Qiskit documentation has a nice example of a quantum circuit that I decided to redo to test my knowledge.
The quantum circuit implements an adder circuit. Working from left to right:
There are four qubits, q0 to q3. The c stands for classical bits. By default, qubits are initialized to 0 (not really — qubits are simultaneously 0 and 1 and all values in between — but that’s another story).
The X gate is a “not” which is sort of like a regular Boolean not, and flips q0 and q1 to 1.
The dashed line is a barrier, which is a synchronization mechanism.
The left-most “+” is a “conditional not” on q0 and q2, which is like a Boolean xor where the result goes to the second qubit, q2. Because q0 and q2 are different, the result is 1 and goes to q2.
The next “+” is conditional not on q1 = 1 and q2 = 1, and so the result is 0 that goes to q2.
The third purple “+” is the Toffoli gate. It acts like a Boolean and. The gate operates on q0 = 1, and q1 = 1 and so the result is 1 that goes to q3.
The black icon with the dial is the measure operator. It fixes a qubit to a static classical 0 or 1.
The example here demonstrates 1 + 1 = 0 with carry 1. If you trace through the circuit with q0 = 0 and q1 = 1 (after the not gate) you’ll see 0 + 1 = 1 with no carry.
Left: An image from a 2020 Popular Mechanics magazine on quantum mechanics. Center: Olga Kurylenko and Daniel Craig as James Bond in “Quantum of Solace” (2008). Right: From an advertisement for “Quantum Finish” dishwasher soap.