A fast and exact algorithm for stabilizer Rényi entropy via XOR-FWHT
Xuyang Huang, Han-Ze Li, Jian-Xin Zhong
TL;DR
This work tackles the computational bottleneck of evaluating the second-order stabilizer Rényi entropy (2-SRE) for generic $N$-qubit states by reformulating the Pauli-string sum as an XOR-convolution over bitstrings, revealed through a bitstring representation and the Walsh-Hadamard transform (WHT). The authors derive a deterministic, exact algorithm, the XOR-FWHT, which reduces the cost from naive $O(8^N)$ to $O(N4^N)$ by performing $d=2^N$ FWHTs of length $d$ and using a concise final expression $\mathcal{M}_2(|\psi\rangle) = -\log\left( \frac{1}{d} \sum_{x,k} |\mathrm{FWHT}(\phi_{x\oplus k}^* \phi_x)|^4 \right)$. They provide pseudocode, a Python implementation, and benchmarks showing accurate results for Haar-random states and dynamical models (e.g., XXZ and TFIM-LF), highlighting improved numerical precision and scalable, parallelizable performance. The method enables high-precision, medium-scale exact calculations of quantum magic and offers a foundation for studying its dynamical and scaling properties in many-body systems. The open-source availability and potential extensions to higher-order SREs further enhance its practical impact for quantum information and many-body physics research.
Abstract
Quantum advantage is widely understood to rely on key quantum resources beyond entanglement, among which nonstabilizerness (quantum ``magic'') plays a central role in enabling universal quantum computation. However, a direct brute-force enumeration of all Pauli strings and the corresponding expectation values from a length-$2^N$ state vector, where $N$ is the system size, yields an overall computational cost scaling as $O(8^N)$, which quickly becomes infeasible as the system size grows. Here we reformulate the second-order stabilizer Rényi entropy in a bitstring language, expose an underlying XOR-convolution structure on $\mathbb Z_2^N$, and reduce the computation to $2^N$ fast Walsh-Hadamard transforms of length, together with pointwise operations, yielding a deterministic and exact XOR fast Walsh-Hadamard transforms algorithm with runtime scaling $O(N4^N)$ and natural parallelism. This algorithm enables high-precision, medium-scale exact calculations for generic state vectors. It provides a practical tool for probing the scaling, phase diagnostics, and dynamical fine structure of quantum magic in many-body systems.
