We write fifteen standard quantum gates and fourteen standard quantum algorithms in qg units [1]. An -qubit state is described by its qg values, for every Pauli string , and a gate acts as . With this one rule each gate becomes a table of qg transformations and each algorithm a readout identity: which qg values hold the answer. The formulation is the Pauli (Heisenberg) representation and adds no new physics. It gives three practical classifications in the units used by the rest of the qang project: which gates conserve Hamming weight, and therefore admit the qg symmetry witness and filter; which algorithms are read out from a few qg values and which need the full outcome histogram; and where reading qg values is strictly worse than the standard readout. Three readout identities are, as far as we know, not stated in this form elsewhere: the per-qubit polar bias after Grover iterations, Simon’s secret as the unique non-trivial Z-parity equal to one, and quantum counting as a single . Every identity is checked numerically and pinned by tests in the open-source library qang (version 0.5.1, pip install qang), module qang.formulation.
We write fifteen standard quantum gates and fourteen standard quantum algorithms in qg units [1]. An -qubit state is described by its qg values, for every Pauli string , and a gate acts as . With this one rule each gate becomes a table of qg transformations and each algorithm a readout identity: which qg values hold the answer. The formulation is the Pauli (Heisenberg) representation and adds no new physics. It gives three practical classifications in the units used by the rest of the qang project: which gates conserve Hamming weight, and therefore admit the qg symmetry witness and filter; which algorithms are read out from a few qg values and which need the full outcome histogram; and where reading qg values is strictly worse than the standard readout. Three readout identities are, as far as we know, not stated in this form elsewhere: the per-qubit polar bias after Grover iterations, Simon’s secret as the unique non-trivial Z-parity equal to one, and quantum counting as a single . Every identity is checked numerically and pinned by tests in the open-source library qang (version 0.5.1, pip install qang), module qang.formulation.
Circuits built from gates that conserve the Hamming weight keep their state in one weight sector, so the shots that left the sector can be discarded at read-out: the qg filter of the open-source library qang [1], a form of symmetry verification [2, 3]. We make it usable on IBM devices through IBM Runtime and Qiskit, and measure it on the noise models of twenty IBM devices. The library adds a Qiskit transpiler pass that decides whether the filter applies, read-out correction from each device's published per-qubit errors, qg read-outs of IBM Runtime Sampler and Estimator results, zero-noise extrapolation by gate folding that stacks with the filter, a prediction of the filter's kept fraction from the calibration, qubit selection with that prediction, a shot planner, and the weight-conserving quantum neural network (QNN) of qang as one parameterized job and as a qiskit-machine-learning SamplerQNN. Every prediction was committed before its run and is reported as passed or failed. On ten five-qubit weight-1 circuits the filter lowers the error of the measured qgZ = ⟨Z⟩ from 0.065-0.104 to 0.018-0.023 on three devices (0.013-0.022 with read-out correction), and filter plus zero-noise extrapolation reaches 0.011-0.015. On seventeen further devices never used before, the filter cuts the error 2.4-8.9× on every one (median 3.1× with read-out correction). Choosing the qubits by the predicted kept fraction keeps 6-17 points more shots than Qiskit's default layout on chain circuits, avoids a qubit published as reading 1 always, and the shot planner met a 0.02 target precision on three devices. For classification the gain is small: the QNN recovers 5-6 of the 10 decisions noise costs it. Reading a known five-component principal-component spectrum out of the data's density matrix in the weight-1 sector, filter plus read-out correction lowers the error 4.6× (median over twenty-one devices) and orders the spectrum correctly on 18 of 21 (13 raw). In Trotter simulation of the XY chain the filter halves the best error and moves the optimal number of Trotter steps deeper (16 of 21 devices), and in a quantum walk it turns a raw spreading indistinguishable from a classical random walk (exponent 0.87) into ballistic spreading (1.84). With two or three interacting excitations (XXZ chain) the gain falls from 5.6× to 2.6×: larger sectors let more of the noise through. Two interoperability bugs were found, one in qiskit-machine-learning and one in the library. All results are on device noise models; no hardware run is reported.
Each qubit’s local qg values are a point in the Bloch ball. Its squared distance from the centre, , is the radius of the sphere on which the qubit lives (area ). For a pure register the deficit is the known one-tangle of the qubit with the rest; with noise it mixes entanglement and impurity. We show that circuits which conserve the Hamming weight remove this ambiguity under one noise model. In a state of fixed weight on every qubit, so and the deficit is read from Z-basis shots alone; under equal amplitude damping the qg symmetry filter returns the noiseless state exactly, so the filtered deficit is the noiseless one-tangle. In a pre-registered simulation (90 configurations) the filtered deficit equals it to , and on product states it is exactly zero, while the unfiltered readout reports a false deficit of 0.60–0.95. On five device noise models (three IBM backends, two IonQ) the filter cuts the deficit error of trained circuits 3.2–4.0 times, but it removes only 15–33% of the false deficit of a product state: errors that move an excitation inside the sector survive the filter, and near a pole the deficit amplifies them as . The radius also separates the polar angle in radians from the length of the vector, : this angle is exact under depolarizing noise, where $\arccosqg_Z$ errs by up to 0.7 rad, and it is 5–9 times more accurate on the device noise models once the noise gates are actually executed. Three of nineteen predictions failed and are reported. Everything is reproduced by the open-source library qang (version 0.6.8, pip install qang).
We are now ready to see how computing with qubits can be done. In this book, we will mainly use the circuit model for computation which was first introduced by Deutsch [25]. We will represent by quantum “wires,” the qubits upon which manipulations. The length of the wire is to be interpreted as the time axis. Manipulations on qubits can be done using basic unitary operators that are the equivalents of logic “gates.” An algorithm, or a complete set of steps for achieving a processing task, is a combination of wires and gates representing a quantum circuit. This circuit must be thought of as a time sequence of events with every wire a way of representing qubit states, and with gates representing processing of those states.
This chapter represents our first step into quantum information theory (QIT). The key to operating such a transition is to become familiar with the concept of the quantum bit, or qubit , which is a probabilistic superposition of the classical 0 and 1 bits. In the quantum world, the classical 0 and 1 bits become the pure states |0〉 and |1〉, respectively. It is as if a coin can be classically in either heads or tails states, but is now allowed to exist in a superposition of both! Then I show that qubits can be physically transformed by the action of unitary matrices , which are also called operators . I show that such qubit transformations, resulting from any qubit manipulation, can be described by rotations on a 2D surface, which is referred to as the Bloch sphere . The Pauli matrices are shown to generate all such unitary transformations. These transformations are reversible , because they are characterized by unitary matrices ; this property always makes it possible to trace the input information carried by qubits. I will then describe different types of elementary quantum computations performed by elementary quantum gates, forming a veritable “zoo” of unitary operators, called I , X , Y , Z , H , CNOT, CCNOT, CROSSOVER or SWAP, controlled- U , and controlled-controlled- U . These gates can be used to form quantum circuits , involving any number of qubits, and of which several examples and tools for analysis are provided. Finally, the concept of tensor product , as progressively introduced through the above description, is eventually formalized.
⟨ ⟩ The qang project describes qubits by measurement—level quantities, the qg values qgP = P [1]. This short note states two classical results in those units, implemented and checked in the qang library (pip install qang, version 0.6.0). First, a polarization state of light is a qubit: the normalized Stokes parameters are exactly the qg values, the degree of polarization P is the length of the qg vector, and a lossless Mueller matrix is the qg gate rule qg′ = qgU†PU . Malus's law becomes I = I0(1 + qgZ cos 2θ + qgX sin 2θ)/2 for any input state. Second, the — geometric phase of a closed loop on the Bloch (Poincaré) sphere is minus half the enclosed solid angle, which is Stokes' theorem for the Berry curvature. For a loop at constant qgZ the phase is (qgZ 1)/2 of a turn: it is fixed by qgZ alone. Nothing here is new physics. The contribution is the translation into qang's units and a set of 26 numerical checks, with the phase computed three independent ways.
Quantum Gates and Circuits IntroductionQuantum gates and quantum circuits form the operational core of quantum computation.While earlier chapters focused on the mathematical structure of quantum states and the physical realization of qubits, this chapter addresses how quantum information is manipulated.In classical computing, logic gates such as AND, OR, and NOT operate on bits to implement algorithms.In quantum computing, quantum gates perform analogous roles, but they act on qubits and obey the laws of quantum mechanics [101].Quantum gates differ fundamentally from classical logic gates in several ways.First, quantum gates must be reversible, because the evolution of closed quantum systems is governed by unitary transformations.Second, quantum gates operate on probability amplitudes, not deterministic bit values.Third, quantum gates can generate superposition and entanglement, which have no classical counterparts.These properties allow quantum circuits to exploit interference effects to achieve computational advantages [102].This chapter presents a detailed theoretical discussion of quantum gates and circuits, including both single-qubit and multi-qubit gates.Mathematical representations using unitary matrices are provided, followed by practical implementation using Julia.The chapter concludes with the construction of simple quantum circuits and interpretation of their outputs. Quantum Gates as Unitary OperatorsA quantum gate is mathematically represented by a unitary matrix U acting on a quantum-state vector | : 10.