# Classical Simulation of Quantum Circuits¶

Performing a quantum computation (commonly described as a quantum circuit) entails evolving an initial quantum state by applying a sequence of operations (also called gates) and measuring the resulting system.
Eventually, the goal should obviously be to do that on a real device.
However, there are several important reasons for simulating the corresponding computations on a classical machine, particularly in the early stages of the design:
As long as no suitable devices are available (e.g., in terms of scale, feasible computation depth, or accuracy), classical simulations of quantum circuits still allow one to explore and test quantum applications, even if only on a limited scale.
However, also with further progress in the capabilities of the hardware platforms, classical simulation will remain an essential part of the quantum computing design process, since it additionally allows access to *all* amplitudes of a resulting quantum state in contrast to a real device that only probabilistically returns measurement results.
Moreover, classical simulation provides means to study quantum error correction as well as a baseline to estimate the advantage of quantum computers over classical computers.

The classical simulation of quantum circuits is commonly conducted by performing consecutive matrix-vector multiplication, which many simulators realize by storing a dense representation of the complete state vector in memory and evolving it correspondingly (see, e.g., [66, 67, 68, 69, 70]) or by relying on tensor network methods (see, e.g., [71, 72, 73, 74]). This approach quickly becomes intractable due to the exponential growth of the quantum state with respect to the number of qubits—quickly rendering such simulations infeasible even on supercomputer clusters. Simulation methodologies based on decision diagrams [12, 62, 75] are a promising complementary approach that frequently allows reducing the required memory by exploiting redundancies in the simulated quantum state.

The *MQT* offers the classical quantum circuit simulator *DDSIM* that can be used to perform various quantum circuit simulation tasks based on using decision diagrams as a data structure.
This includes strong and weak simulation [12, 13, 14], approximation techniques [15, 16], noise-aware simulation [17, 18, 19], hybrid Schrödinger-Feynman techniques [20], support for dynamic circuits, the computation of expectation values [21], the simulation of mixed-dimensional systems [22], and more [23, 24, 25, 26].

Consider the following listing that describes the quantum circuit for generating a three-qubit GHZ state (also shown in Fig. 1):

```
1from qiskit import QuantumCircuit
2
3circ = QuantumCircuit(3)
4circ.h(2)
5circ.cx(2, 1)
6circ.cx(1, 0)
7circ.measure_all()
```

This circuit can be classically simulated using DDSIM as a backend for IBM Qiskit:

```
1from mqt.ddsim import DDSIMProvider
2
3provider = DDSIMProvider()
4backend = provider.get_backend("qasm_simulator")
5result = backend.run(circ, shots=10000).result()
6result.get_counts()
```

```
{'000': 4981, '111': 5019}
```

```
(venv) $ pip install mqt.ddsim
```