Quantum Computing
Qiskit: programming quantum computers
Цели урока
- Install Qiskit and understand its package structure
- Build quantum circuits with single- and two-qubit gates
- Run circuits on AerSimulator and StatevectorSimulator
- Submit jobs to real IBM quantum processors
Quantum algorithms look elegant on paper. Running them requires a bridge between theory and hardware. Qiskit turned quantum programming from academic curiosity into an accessible tool: a few lines of Python and the circuit runs on a real quantum processor in IBM Cloud.
- **Pharmaceuticals:** Pfizer uses IBM Quantum for molecular simulation
- **Finance:** JPMorgan researches quantum portfolio optimization through Qiskit
- **Research:** 400+ scientific papers per year use Qiskit as the primary tool
- **Education:** over 500 universities have included Qiskit in quantum computing courses
Qiskit: basics and architecture
In 2017, IBM opened cloud access to real quantum processors and released **Qiskit** - an open-source Python library. It has since become the most widely used tool in quantum computing, with over 500 universities and dozens of companies building on it.
Qiskit is split into packages. The core is `qiskit-terra`: circuits, gates, and compilation. Built on top of it are simulators (`qiskit-aer`) and access to real hardware (`qiskit-ibm-runtime`).
Qiskit 1.0 (2024) is the stable release with API compatibility guarantees. Older tutorials before 1.0 may use deprecated `execute()` and `Aer.get_backend()` - the API changed significantly.
What is qiskit-terra responsible for?
Quantum Circuits in Qiskit
`QuantumCircuit` is the central Qiskit object. It represents a sequence of gates applied to qubits. A circuit describes an algorithm abstractly - without binding to specific hardware.
Parameterized circuits (with `Parameter`) are needed for variational algorithms VQE and QAOA - an optimizer substitutes values before each run.
What does qc.barrier() do in Qiskit?
Simulators: Aer and StatevectorSimulator
Real quantum processors are scarce and noisy. For development and debugging, **Qiskit Aer** provides high-performance simulators running on CPU and GPU.
Two main simulators: `AerSimulator` computes measurement distributions for a given number of shots; `StatevectorSimulator` stores the full state vector - a perfect quantum computer, but requires 2^n complex numbers of memory.
Aer can emulate the noise of real hardware. A noise model is loaded from a specific IBM device via `FakeBackend`, and the simulation reproduces its actual behavior.
At n=30 qubits, StatevectorSimulator needs 2^30 = 10^9 complex numbers - about 16 GB of RAM. At n=40 that is 16 TB. For large circuits, the MPS (matrix product state) simulator is used instead.
StatevectorSimulator stores 2^n complex numbers (float64, 16 bytes each). For n=20 that is roughly:
IBM Quantum Experience and running on real hardware
IBM provides free cloud access to real quantum processors. The free tier gives 10 minutes of QPU time per month - sufficient for experiments. Processors range from 5 to 127 qubits.
**Transpilation** is mandatory: real devices support only a limited set of native gates (CX, RZ, X, SX) and limited qubit connectivity. `transpile()` adds SWAP gates for physically disconnected qubit pairs.
The free IBM Quantum queue can wait hours. Use `FakeBackend` for debugging and submit to real hardware only for final experiments.
Why must transpile() be called before sending a circuit to a real IBM device?
Qiskit
- qiskit-terra - core: circuits, gates, transpilation
- qiskit-aer - simulators: AerSimulator (shots) and StatevectorSimulator (amplitudes)
- QuantumCircuit - central object describing a gate sequence
- Parameterized circuits (Parameter) needed for VQE and QAOA
- transpile() converts a circuit for a specific physical device
- IBM Quantum: 10 min/month free, backend selection via service.least_busy()
Related topics
Qiskit is the tool for implementing quantum algorithms from earlier lessons.
- Quantum gates — Building blocks of Qiskit circuits
- Grover's algorithm — Classic implementation example in Qiskit
- Cirq and other frameworks — Alternatives to Qiskit
Вопросы для размышления
- Why can transpilation with optimization_level=3 worsen results on noisy hardware?
- In which cases is StatevectorSimulator preferable to AerSimulator?
- How does qubit mapping choice affect the number of SWAP gates and result quality?