{"cells":[{"cell_type":"markdown","id":"cf304757-1588-4840-ab5c-ae5e78db8dae","metadata":{},"source":["# Efficient simulation of stabilizer circuits with Qiskit Aer primitives\n\nThis page shows how to use Qiskit Aer primitives to efficiently simulate stabilizer circuits, including those subject to Pauli noise.\n\nStabilizer circuits, also known as Clifford circuits, are an important restricted class of quantum circuits that can be efficiently simulated classically. There are several equivalent ways to define stabilizer circuits. One definition is that a stabilizer circuit is a quantum circuit that consists solely of the following gates:\n\n* [CX](../api/qiskit/qiskit.circuit.library.CXGate)\n\n* [Hadamard](../api/qiskit/qiskit.circuit.library.HGate)\n\n* [S](../api/qiskit/qiskit.circuit.library.SGate)\n\n* [Measurement](../api/qiskit/qiskit.circuit.library.Measure)\n\nNote that using Hadamard and S, we can construct any Pauli rotation gate ([$R_x$](/api/qiskit/qiskit.circuit.library.RXGate), [$R_y$](/api/qiskit/qiskit.circuit.library.RYGate), and [$R_z$](/api/qiskit/qiskit.circuit.library.RZGate)) that has an angle contained in the set $\\{0, \\frac{\\pi}{2}, \\pi, \\frac{3\\pi}{2}\\}$ (up to global phase), so we can include these gates in the definition as well.\n\nStabilizer circuits are important to the study of quantum error correction. Their classical simulability also makes them useful for verifying the output of quantum computers. For example, suppose you want to execute a quantum circuit that uses 100 qubits on a quantum computer. How do you know that the quantum computer is behaving correctly? A quantum circuit on 100 qubits is beyond the reach of brute-force classical simulation. By modifying your circuit so that it becomes a stabilizer circuit, you can run circuits on the quantum computer that have a similar structure to your desired circuit, but which you can simulate on a classical computer. By checking the output of the quantum computer on the stabilizer circuits, you can gain confidence that it is behaving correctly on the non-stabilizer circuits as well. See [*Evidence for the utility of quantum computing before fault tolerance*](https://www.nature.com/articles/s41586-023-06096-3) for an example of this idea in practice.\n\n[Exact and noisy simulation with Qiskit Aer primitives](simulate-with-qiskit-aer) shows how to use [Qiskit Aer](https://qiskit.org/ecosystem/aer/) to perform exact and noisy simulations of generic quantum circuits. Consider the example circuit used in that article, an 8-qubit circuit built using [EfficientSU2](../api/qiskit/qiskit.circuit.library.EfficientSU2):\n"]},{"cell_type":"code","execution_count":1,"id":"b1a79c45-1e73-4125-95d0-61a54fca9231","metadata":{},"outputs":[{"data":{"image/svg+xml":[""],"text/plain":["