Quantum Computing for the Curious

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.

  1. We first create a QuantumCircuit, in this case with two Quantum Bits and two Classic Bits
  2. We add some gates, specifying how they are connected
  3. We compile the circuit specification into low level QASM (Quantum Assembly Instructions)
  4. We simulate the circuit, running it 1000 times
  5. We observe that 502 times, the result was a classic binary 1, and 498 times, the result was a classic binary 0. Every time we run the simulation, we will get slightly different answers, because measurement of qbits is probabilistic.
  6. We draw the circuit so that we can verify the circuit is what we intended

Conditions

  • the qbits start in a state of |0>
  • the state of each qbit is well represented by the Bloch Sphere, where the actual state is expressed by some vector V of length 1, determined by X, Y, and Z coordinates (or angles if you prefer)
  • generally, each gate has the effect of rotating V according to some Matrix
  • the X gate, rotates the vector around the X axis, hence the clever name for the X gate. This has the effect of turning a |0> into a |1> and visa versa. In this circuit, note that the X gate has two inputs, which means it's actually a conditional Not gate, not a pure X gate. Sorry for any confusion.
  • the H gate, is interesting in many ways, but it rotates V around some axis that is 45° from the other axes. Two H gates in a row restores the state to before the first H gate.
  • the M gate transforms the state from quantum to classic, based the orientation of V, destroying the coherence as 'feedback' (popping the bubble)
  • the state |0> will be measured as 0 100% of the time, while the state |1> will be measured as 1 100% of the time. Any state on the equator of the Block Sphere will be measured as 0 or 1 50% of the time. The probability of measurement depends on the angle θ
  • this combination of gates is especially useful in that afterwards, the bits q_0 and q_1 are entangled ??

Reality

No alt text provided for this image

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!"

要查看或添加评论,请登录

社区洞察

其他会员也浏览了