Lesson 7: Simulating Quantum Realities Using Qiskit’s Simulators

H Hannan

What is Qiskit
Back to The Qiskit Home Page

Introduction to Quantum Simulation

Quantum simulation refers to efficiently modelling the time dynamics and properties of complex quantum systems using classical computational resources. Rather than solving intractable analytical equations, numerical simulation provides an exponentially more efficient lens into quantum mechanics.

Qiskit offers a suite of high-performance quantum circuit simulators allowing us to understand the behavior of programmed quantum algorithms before costly execution on real hardware. Mastering these virtual quantum processors is key to pragmatically developing applications today.

In this section, we study various simulation techniques, configure and invoke diverse Aer simulator backends through hands-on Qiskit examples, analyze rich simulation output data and explore caveats around correlating simulated models to real quantum hardware.

Quantum Simulation Algorithms and Techniques

Diverse quantum simulation approaches exist, each with unique strengths:

  1. Statevector simulation tracks a full quantum state vector enabling detailed yet resource-intensive modelling.
  2. Quantum virtual machines emulate operational behaviour on simulated registers and gates.
  3. Tensor network methods like matrix product states leverage special entanglement structures for efficiency.
  4. Quantum Monte Carlo methods use stochastic sampling for estimating properties of quantum systems.
  5. Partitioned simulation divides larger systems into more easily simulatable fragments.

The choice of techniques balances simulation accuracy against computational overhead for the application.

Choosing Qiskit’s Right Simulator

Aer provides a spectrum of high-performance simulator backends emulating different quantum computing paradigms:

  1. StatevectorSimulator: Enables full quantum state tracking for noiseless circuit debugging.
  2. QASMSimulator: Mimics real quantum computer noise signatures.
  3. StabilizerSimulator: Fast Clifford circuit simulation, widely used in error correction.
  4. ExtendedStabilizerSimulator: For noisy Clifford circuit behaviours.
  5. UnitarySimulator: Models idealized quantum circuits via simple unitary matrix evolution.
  6. MatrixProductStateSimulator: For quantum applications in condensed matter physics.

The optimal backend choice depends on balancing simulation precision versus speed for analyzing target algorithms on given hardware architectures.

Executing a Quantum Circuit on Qiskit Simulators

We can execute a circuit on an Aer simulator backend using a familiar Qiskit workflow:

  1. Choose a simulator matching the requirements:
backend = Aer.get_backend('statevector_simulator')
  1. Transpile circuit optimized for target backend:
compiled_circuit = transpile(circuit, backend) 
  1. Assemble experiment job object encoding circuit:
qobj = assemble(compiled_circuit, shots=2048)
  1. Run simulation job on backend:
job = backend.run(qobj)
  1. Retrieve and dissect result outputs in job:
results = job.result()

We can further customize the emulated quantum environment using shots, noise models, optimization passes etc.

Analyzing Quantum Simulation Output Data

Qiskit simulations offer multidimensional perspectives into a quantum circuit’s simulated execution:

Visualizing Qubit State Amplitudes and Entanglement

  1. Plot the trajectory of qubit state probabilities across circuit timesteps:
plot_state_city(results.get_statevector())
  1. Visualize entanglement genesis and correlations between qubits in circuits.
  2. Animate qubit amplitude motions using spherical projections.

This enables following qubit state superpositions as gates entangle and disentangle them.

Validating Algorithmic Outputs

  1. Reconstruct quantum process matrices to validate simulated model fidelity.
  2. Verify custom algorithm snapshot outputs match expected values.
  3. Design circuits themselves as measurement instruments on other circuits.

Debugging and Monitoring Circuits

  1. Embed developer-defined snapshots to trace interim qubit states and diagnostics.
  2. Plot expected vs observed measurement outcome histograms for deviation detection:
compare_counts(sim_counts, real_counts, delta=0.05).plot_histogram()

This provides a monitorable retrospective through the simulation workflow to locate discrepancies from intended behaviour.

Cross-Validation Against Analytical Solutions

Where possible, compare numerical simulations against analytical solutions for small problem scales to bolster confidence in correctly modelling large complex system dynamics.

Through these multifaceted simulation data validation capabilities, Qiskit enables transforming quantum thought experiments into practical computational instrumentation!

Limitations and Correlating Simulations to Hardware

While rapid classical algorithmic improvements allow numerically probing large quantum system sizes approaching practically relevant scales, exponential complexity persists limiting strictly classical simulation of arbitrary quantum processes. We expect small quantum devices to demonstrate “quantum computational supremacy” against the best classical supercomputers soon.

Furthermore, while Aer backends provide sophisticated noise modelling capabilities, real superconducting hardware introduces additional complex environmental coupling requiring intricate calibration. Rigorously predicting and matching an actual quantum chip’s performance via simulation remains an active research challenge.

Nevertheless, Qiskit simulators provide accessible yet powerful windows for scientifically navigating quantum state spaces to build intuition and functionally debugged circuits ready for experiencing quantum advantage in applications when available.

Leave a Comment