Chapters

The whole tutorial, in order.

Every part and chapter, linked. Read it top to bottom the first time through; each chapter also stands on its own. New here? Start with the Outline.

Part 0 Prerequisites & Setup

Get a working C++ and Python quantum environment running in containers, CPU only.

  1. 0 Setup: the containers and your first Bell state Get a working C++ and Python quantum environment running in Docker, CPU only, and measure your first Bell state in both languages before writing any more code.

Part 1 Foundations

Qubits, state vectors, measurement and gates, built from the ground up.

  1. 1 A tour of the two containers What lives in the C++ and Python images, why each tool is there, and how the multi-stage build tests the code before it ever becomes an image.
  2. 2 Qubits, state vectors, and measurement Build a qubit from scratch as a vector of complex amplitudes, apply a gate as a matrix, and measure it by sampling, in C++ and NumPy, before any framework hides the mechanism.
  3. 3 Gates and circuits Single-qubit gates as unitary matrices, multi-qubit gates that entangle, and circuits as sequences of gates, shown with Quantum++ and Qiskit.

Part 2 First Programs

Your first circuits in C++ and Python, and the entanglement that makes them quantum.

  1. 4 Your first quantum program Build a circuit, run it on the simulator for many shots, and read the measured counts, with Quantum++ leading and Qiskit cross-checking.
  2. 5 Measurement and sampling How amplitudes become counts: a weighted coin shows the measured fraction converging on the squared amplitude as shots increase, in Quantum++ and Qiskit.
  3. 6 Entanglement: Bell, GHZ, and teleportation Correlations no classical system can reproduce, read from measured counts: the Bell pair, the GHZ state, and quantum teleportation, in Quantum++ and Qiskit.

Part 3 Algorithms

The classic quantum algorithms, from Deutsch-Jozsa to a small Shor demo.

  1. 7 Query algorithms: Deutsch-Jozsa and Bernstein-Vazirani Two algorithms that answer in a single query what a classical computer needs many queries for: Deutsch-Jozsa decides constant-versus-balanced, and Bernstein-Vazirani recovers a hidden string.
  2. 8 Grover's search Find a marked item in an unstructured space of 2^n in about sqrt(2^n) steps, with a phase oracle and a diffusion operator that rotate amplitude onto the answer, in Quantum++ and Qiskit.
  3. 9 The QFT and phase estimation The quantum Fourier transform and the phase-estimation routine built on it, recovering the phase of a gate's eigenvalue into a counting register, in Quantum++ and Qiskit.
  4. 10 Shor's algorithm Factor a number by finding the order of an element modulo N with phase estimation, then a classical gcd, demonstrated on N = 15 in Quantum++ and Qiskit.

Part 4 Hybrid & Variational

Variational methods that pair a quantum circuit with a classical optimizer: VQE and QAOA.

  1. 11 The variational quantum eigensolver Find a Hamiltonian's lowest energy by tuning a parameterized circuit with a classical optimizer: the variational principle, the energy expectation, and the loop, in Quantum++ and Qiskit.
  2. 12 QAOA for optimization Solve a combinatorial problem, MaxCut, by alternating a cost layer and a mixer and tuning their angles with a classical optimizer, then reading the answer from the measured counts, in Quantum++ and Qiskit.

Part 5 Going Further

Simulator limits, a framework comparison, and an optional run on real hardware.

  1. 13 Simulator limits Why a CPU simulator stops around 25 to 30 qubits: the state vector holds 2^n amplitudes, so memory doubles with every qubit, measured in Quantum++ and Qiskit.
  2. 14 Choosing a framework Quantum++ and Qiskit produce the same results, so the choice is about ergonomics: a comparison of the two, with Cirq and PennyLane noted, plus a shared circuit that agrees across both.
  3. 15 Running on real hardware An optional look at submitting a circuit to real IBM Quantum hardware on the free tier, with the local simulator as the noiseless reference, in Quantum++ and Qiskit.

Part 6 Appendices

A linear-algebra reference, why post-quantum cryptography is a different subject from quantum computing, a glossary, and a guided demo you can run yourself.

  1. A Appendix A: The linear algebra you need A compact reference for the linear algebra this book uses: complex numbers, state vectors, inner products, unitary matrices, tensor products, and eigenvalues.
  2. B Appendix B: Post-quantum cryptography is not quantum computing Clearing up a common confusion: post-quantum cryptography secures today's classical systems against future quantum attacks, and is a different subject from programming a quantum computer.
  3. C Appendix C: Glossary Plain-language definitions of the terms used throughout the book, from qubit and superposition to Hamiltonian, VQE, the Born rule, and post-quantum cryptography.
  4. D Appendix D: A guided demo Run the companion demo yourself: build the containers, watch a Bell pair, a Grover search, and Shor factor 15, then follow the thread from Shor to post-quantum cryptography.