Quantum Computing for the Curious
In my article Quantum Computing for the Confused, I shared some criticisms of science explanations I find confusing; explanations that could be explained better. This time around, I want to get more into some aspects of Quantum Computing I am coming to understand better.
Recently I started playing with Qiskit, "an open-source SDK for working with quantum computers at the level of pulses, circuits, and application modules." Also, I have been chatting with people on the Qiskit Slack Site https://ibm.co/joinqiskitslack.
Quantum Programming
My first program looks like
import numpy as n
from qiskit import QuantumCircuit, transpile
from qiskit.providers.aer import QasmSimulator
from qiskit.visualization import plot_histogram
# Use Aer's qasm_simulator
simulator = QasmSimulator()
# Create a Quantum Circuit acting on the q register
circuit = QuantumCircuit(2, 2)
# Add a H gate on qubit 0
circuit.h(0)
# Add a CX (CNOT) gate on control qubit 0 and target qubit 1
circuit.cx(0, 1)
# Map the quantum measurement to the classical bits
circuit.measure([0,1], [0,1])
# compile the circuit down to low-level QASM instructions
# supported by the backend (not needed for simple circuits)
compiled_circuit = transpile(circuit, simulator)
# Execute the circuit on the qasm simulator
job = simulator.run(compiled_circuit, shots=1000)
# Grab results from the job
result = job.result()
# Returns counts
counts = result.get_counts(compiled_circuit)
print("\nTotal count for 00 and 11 are:",counts)
# Draw the circuit
circuit.draw()
and outputs
Total count for 00 and 11 are: {'11': 502, '00': 498}
┌───┐ ┌─┐
q_0: ┤ H ├──■──┤M├───
└───┘┌─┴─┐└╥┘┌─┐
q_1: ─────┤ X ├─╫─┤M├
└───┘ ║ └╥┘
c_0: ═══════════╩══╬═
║
c_1: ══════════════╩═
That's the starter example they give.
Conditions
领英推荐
Reality
What is not so obvious from this program is that qbits are ephemeral like soap bubbles. This is another reason I like the Bloch Sphere, because it reminds me of soap bubbles. Quantum bits typically last for tens of microseconds before the coherent quantum bubble pops, and becomes useless. In some technologies, qbits can stay coherent for much longer, but in IBM's System Q, at 15 milli-kelvins, this is about average. Other factors such as heat can cause these bubbles to pop much sooner.
Unlike binary computers with digital circuits that constantly regenerate the state to 0 or 1, making such circuits very robust, quantum bits are more like analog computers where the state is some voltage (or other quantity) that represents a spectrum of values. Such circuits are prone to drift because the state of bits is not constantly regenerated, where noise is a leading cause of drift.
Unlike analog circuits and analog computers, quantum computers have a more complex state, that is also based on complex mathematics.
Some of these issues can be addressed by techniques such as quantum error correction, but they are not yet a panacea.
Entanglement
I won't say much about entanglement now, but maybe later in a follow up post. Suffice it to say that an operation on one entangled qbit affects all the other entangled qbits at once. This is not possible in classic computers, and gives quantum computers the potential to compute some solutions much faster.
Explanations
I have deliberately avoided using terms such as "super-position," "multiple states," "collapse of the wave function," etc. because I believe these terms cause more harm than good. They are only good in historical terms, and not good in understanding anything useful. (Wow, that's opinionated...)
In this world, I trust the adage "Shut up and calculate!"