Challenges
Datasets
Workspaces
Papers
Discussions
Leaderboard
Log inSign up
Challenges
Datasets
Workspaces
Papers
Discussions
Leaderboard
Blog
Job Board
Q3AS

© 2026 Aqora Quantum S.A.S.

TermsPrivacyLegal Notice

arXiv:2506.08142 · SciPost Physics Lecture Notes

How to write a simulator for quantum circuits from scratch: A tutorial

Michael J. McGuffin, Jean-Marc Robert, Kazuki Ikeda

Published Aug 3, 2026• 5 citations
arXivHTMLPDF

Abstract

We guide a competent programmer through the programming of a quantum circuit simulator, supporting quantum logic gates with arbitrary control qubits on 20+ qubits, assuming no previous knowledge of quantum computing. We explain qubit-wise multiplication for updating the state vector; how to compute partial traces on arbitrary subsets of qubits to find reduced density matrices; and computing qubit phase and purity. A sample implementation in JavaScript is provided, which also demonstrates how to compute von Neumann entropy, concurrence (to quantify entanglement), and magic, with source code much smaller and easier to study than other popular software packages.

DOI
10.21468/scipostphyslectnotes.131

Related papers

Practical Guide to Quantum Computing: Quantum Logic Gates (Based on IBM Q Platform)

Mikhail Pavlov

Abstract This practical guide provides a detailed introduction to quantum logic gates and unitary operators as implemented on the IBM Q platform. It focuses on the fundamental gate structures used in quantum programming, particularly within the Composer interface, and provides screenshots and detailed descriptions of each operator’s functionality. The guide emphasizes the operational role of gates in controlling qubit states and constructing quantum circuits. To enhance understanding, the behavior of gates is visualized on the Bloch sphere, demonstrating how single-qubit operations rotate qubit states around the XXX, YYY, and ZZZ axes, as well as how phase shifts and amplitude adjustments modify the qubit. These operations are essential for measurement, state preparation, and precise manipulation of quantum systems. The relevance of this study is underscored by the rapid development of quantum technologies and the increasing accessibility of quantum computing platforms like IBM Q. A thorough understanding of quantum gates and their implementations is critical for advancing quantum algorithm design and for training specialists capable of deploying quantum computational solutions in fields ranging from cryptography to complex physical system simulations. This guide provides both theoretical insights and practical exercises, bridging the gap between abstract quantum mechanics and applied quantum programming, thereby equipping readers with foundational skills for effective circuit construction and quantum computation.

•Mar 3, 2026•0 citations

Quantum Computing Fundamentals

Robert Hundt

This chapter introduces the fundamental concepts and rules of quantum computing. In parallel, it develops an initial, easy-to-understand codebase in Python for building and simulating small-scale quantum circuits and algorithms. The chapter details single qubits, superposition, quantum states with many qubits, operators, including a sizable set of important single-qubit gates and controlled gates. The Bloch sphere and the quantum circuit notation are introduced. Entanglement follows, that fascinating “spooky action at a distance,” as Einstein called it. With this background, the chapter discusses maximally entangled Bell states, the no-cloning theorem, the noneffect of global phases, the partial trace and reduced density matrix, and uncomputation. The quantum postulates are discussed in a nonphilosophical way, leading to measurement and how to simulate it.

Cambridge University Press eBooks•Feb 28, 2022•11 citations

Quantum Computing (QC)

Rubin H. Landau, Manuel José Páez

We start this chapter by reviewing how quantum states and spaces are described with Dirac notation. We then examine qubits, the quantum memory bits, and the states formed with multiple qubits. We next discuss quantum gates and their low-level processing of qubits. And, at last, we get on to quantum programming and QC applications. We explore the use of several software packages that simulate QC, or provide the programs to run on quantum computers. We explore an example of the latter using the IBM Quantum Platform. The assortment of examples and problems that follow includes simple circuits, Monte Carlo techniques, Schrödinger's cat, and quantum Fourier transforms.

CRC Press eBooks•Oct 23, 2026•0 citations

A software simulator for noisy quantum circuits

Himanshu Chaudhary, Biplab Mahato, Lakshya Priyadarshi +3 more

We have developed a software library that simulates noisy quantum logic circuits. We represent quantum states by their density matrices in the Pauli basis, and incorporate possible errors in initialization, logic gates, memory and measurement using simple models. Our quantum simulator is implemented as a new backend on IBM’s open-source Qiskit platform. In this paper, we provide its description, and illustrate it with some simple examples.

arXiv:1908.05154•International Journal of Modern Physics C•Feb 16, 2022•10 citations

Quantum computer simulator based on the circuit model of quantum computation

Ioannis G. Karafyllidis

A quantum computer simulator is presented. This simulator is an engineering work and no deep understanding of quantum mechanics is required from the user. The simulator is based on the circuit model of quantum computation in which quantum gates act on quantum registers which comprise a number of quantum bits (qubits). The inputs to the simulator are the initial states of the qubits that form a quantum register and the quantum gates applied at each computation step. The inputs are entered through a graphical user interface. The outputs of the simulator are the matrices that represent the quantum register state at each quantum computation step and graphical outputs that show the probability of measuring each one of the possible quantum register base states and the phase of each state at each computation step. The well-known Deutsch's algorithm and the quantum Fourier transform, which is the base of many quantum algorithms, are presented using this simulator. Furthermore, the generation and variation of entanglement during quantum computations can be calculated using this simulator. The quantum computer simulator is a useful tool for the study of quantum computer circuits, quantum computing, and the development of new quantum algorithms.

IEEE Transactions on Circuits and Systems I Fundamental Theory and Applications•Aug 1, 2005•56 citations

Quantifying Entangling Power of Controlled Unitary Gates

Ankur Haldar, Pankaj Agrawal, Prasenjit Deb

Applying controlled unitary gates to generate entanglement between qubits is a routine task in both quantum communication and computation. The existing tools for predicting how much entanglement a given gate can generate require either simulation of the entangling circuit or averaging over a distribution of inputs for a given controlled unitary gate. Here, we introduce a computable quantity $ζ$ that not only determines whether a controlled unitary gate generates entanglement, but also quantifies the entanglement for any specific input without requiring the construction of the output state. For two-qubit controlled unitary gates, we establish the physical conditions corresponding to the extremum values of the proposed quantity. Extending the dimension of control and target registers to arbitrary size through a generalized controlled unitary architecture, we derive a universal upper bound on $ζ$ and identify the conditions for its saturation. Later we establish functional relation between the quantity and other known quantities, such as purity, normalized linear entropy, and von Neumann entropy. Finally, we compare our results with previous research work and show that the quantity proposed in this work achieves the previously known optimal values of entangling power of controlled unitary gates for some specific dimensions of target and control registers.

quant-pharXiv:2608.21105•Aug 24, 2026•0 citations
We guide a competent programmer through the programming of a quantum circuit simulator, supporting quantum logic gates with arbitrary control qubits on 20+ qubits, assuming no previous knowledge of quantum computing. We explain qubit-wise multiplication for updating the state vector; how to compute partial traces on arbitrary subsets of qubits to find reduced density matrices; and computing qubit phase and purity. A sample implementation in JavaScript is provided, which also demonstrates how to compute von Neumann entropy, concurrence (to quantify entanglement), and magic, with source code much smaller and easier to study than other popular software packages.
Abstract This practical guide provides a detailed introduction to quantum logic gates and unitary operators as implemented on the IBM Q platform. It focuses on the fundamental gate structures used in quantum programming, particularly within the Composer interface, and provides screenshots and detailed descriptions of each operator’s functionality. The guide emphasizes the operational role of gates in controlling qubit states and constructing quantum circuits. To enhance understanding, the behavior of gates is visualized on the Bloch sphere, demonstrating how single-qubit operations rotate qubit states around the XXX, YYY, and ZZZ axes, as well as how phase shifts and amplitude adjustments modify the qubit. These operations are essential for measurement, state preparation, and precise manipulation of quantum systems. The relevance of this study is underscored by the rapid development of quantum technologies and the increasing accessibility of quantum computing platforms like IBM Q. A thorough understanding of quantum gates and their implementations is critical for advancing quantum algorithm design and for training specialists capable of deploying quantum computational solutions in fields ranging from cryptography to complex physical system simulations. This guide provides both theoretical insights and practical exercises, bridging the gap between abstract quantum mechanics and applied quantum programming, thereby equipping readers with foundational skills for effective circuit construction and quantum computation.
This chapter introduces the fundamental concepts and rules of quantum computing. In parallel, it develops an initial, easy-to-understand codebase in Python for building and simulating small-scale quantum circuits and algorithms. The chapter details single qubits, superposition, quantum states with many qubits, operators, including a sizable set of important single-qubit gates and controlled gates. The Bloch sphere and the quantum circuit notation are introduced. Entanglement follows, that fascinating “spooky action at a distance,” as Einstein called it. With this background, the chapter discusses maximally entangled Bell states, the no-cloning theorem, the noneffect of global phases, the partial trace and reduced density matrix, and uncomputation. The quantum postulates are discussed in a nonphilosophical way, leading to measurement and how to simulate it.
We start this chapter by reviewing how quantum states and spaces are described with Dirac notation. We then examine qubits, the quantum memory bits, and the states formed with multiple qubits. We next discuss quantum gates and their low-level processing of qubits. And, at last, we get on to quantum programming and QC applications. We explore the use of several software packages that simulate QC, or provide the programs to run on quantum computers. We explore an example of the latter using the IBM Quantum Platform. The assortment of examples and problems that follow includes simple circuits, Monte Carlo techniques, Schrödinger's cat, and quantum Fourier transforms.
A quantum computer simulator is presented. This simulator is an engineering work and no deep understanding of quantum mechanics is required from the user. The simulator is based on the circuit model of quantum computation in which quantum gates act on quantum registers which comprise a number of quantum bits (qubits). The inputs to the simulator are the initial states of the qubits that form a quantum register and the quantum gates applied at each computation step. The inputs are entered through a graphical user interface. The outputs of the simulator are the matrices that represent the quantum register state at each quantum computation step and graphical outputs that show the probability of measuring each one of the possible quantum register base states and the phase of each state at each computation step. The well-known Deutsch's algorithm and the quantum Fourier transform, which is the base of many quantum algorithms, are presented using this simulator. Furthermore, the generation and variation of entanglement during quantum computations can be calculated using this simulator. The quantum computer simulator is a useful tool for the study of quantum computer circuits, quantum computing, and the development of new quantum algorithms.
Applying controlled unitary gates to generate entanglement between qubits is a routine task in both quantum communication and computation. The existing tools for predicting how much entanglement a given gate can generate require either simulation of the entangling circuit or averaging over a distribution of inputs for a given controlled unitary gate. Here, we introduce a computable quantity ζζζ that not only determines whether a controlled unitary gate generates entanglement, but also quantifies the entanglement for any specific input without requiring the construction of the output state. For two-qubit controlled unitary gates, we establish the physical conditions corresponding to the extremum values of the proposed quantity. Extending the dimension of control and target registers to arbitrary size through a generalized controlled unitary architecture, we derive a universal upper bound on ζζζ and identify the conditions for its saturation. Later we establish functional relation between the quantity and other known quantities, such as purity, normalized linear entropy, and von Neumann entropy. Finally, we compare our results with previous research work and show that the quantity proposed in this work achieves the previously known optimal values of entangling power of controlled unitary gates for some specific dimensions of target and control registers.