Recognition: 2 theorem links
· Lean TheoremPyEncode: An Open-Source Library for Structured Quantum State Preparation
Pith reviewed 2026-05-14 01:17 UTC · model grok-4.3
The pith
PyEncode is an open-source Python library that generates verified Qiskit circuits for amplitude encoding of ten exact structured vector patterns.
A machine-rendered reading of the paper's core claim, the machinery that carries it, and where it could break.
Core claim
PyEncode implements a unified framework covering sparse, step, square, Walsh, Fourier, geometric, Hamming, staircase, Dicke, and polynomial patterns, mapping each to a verified Qiskit circuit via the encode function with no vector materialization or approximation; sparse, step, Walsh, Hamming and staircase patterns use O(m) gates, square and Fourier use O(m^2), Dicke states use O(k(m-k)), and degree-d polynomials use O(m^{d+1}), supported by SUM, PARTITION and TENSOR composition primitives plus an MPS loader for other vectors.
What carries the argument
The encode function, which accepts a pattern specification such as SPARSE or DICKE and returns a Qiskit circuit implementing the exact amplitude encoding.
If this is right
- Sparse, step, Walsh, Hamming and staircase patterns can be prepared with only linear gates in the number of qubits m.
- Square and Fourier patterns require quadratic gates in m.
- Dicke states are prepared with gates quadratic in both the number of excitations k and the register size.
- Users can build more complex states by composing basic patterns with weighted sums, disjoint partitions or tensor products.
- Gate counts for any supported pattern can be estimated before circuit synthesis using the predict_gates function.
Where Pith is reading between the lines
- Embedding PyEncode in larger quantum workflows could lower the encoding overhead for applications that naturally produce structured data such as signal processing or combinatorial problems.
- The composition primitives make it straightforward to construct hybrid states that combine several exact families without ancilla overhead in the partition case.
- The MPS loader provides a practical fallback when a vector does not match any of the ten exact families.
Load-bearing premise
The cited theoretical constructions for each of the ten pattern families have been translated correctly into bug-free Qiskit circuits whose gate counts remain valid after transpilation.
What would settle it
Call encode on a concrete instance such as SPARSE([(19, 1.0)]), N=64, simulate the resulting circuit on a quantum simulator, and verify that the output state has amplitude 1.0 exactly at index 19 and zero elsewhere.
Figures
read the original abstract
Quantum algorithms require encoding classical vectors as quantum states, a step known as amplitude encoding. General-purpose routines produce circuits with $\bigO{2^m}$ gates for vectors of length $N = 2^m$. However, vectors arising in scientific and engineering applications often exhibit mathematical structure that admits far more efficient encoding. Theoretical work over the last decade has established efficient circuits for several structured vector classes, but without open-source implementations. We present \textbf{PyEncode}, an open-source Python library that implements this body of theory in a unified framework. It covers ten exact pattern families: \emph{sparse, step, square, Walsh, Fourier, geometric, Hamming, staircase, Dicke}, and \emph{polynomial}. A function \texttt{encode} maps each pattern to a verified Qiskit circuit, with no vector materialization and no approximation; for example, \texttt{encode(SPARSE([(19, 1.0)]), N=64)} encodes the vector $\mathbf{e}_{19}$ of length $N = 64$. Sparse, step, Walsh, Hamming, and staircase patterns require $\bigO{m}$ gates; square and Fourier patterns require $\bigO{m^2}$; Dicke states $|D^m_k\rangle$ require $\bigO{k(m-k)}$; degree-$d$ polynomials require $\bigO{m^{d+1}}$. A companion \texttt{predict\_gates} function estimates transpiled gate counts without synthesis. Three composition primitives are supported: \texttt{SUM} for weighted superpositions, \texttt{PARTITION} for ancilla-free composition of disjoint-support patterns, and \texttt{TENSOR} for separable states over disjoint subregisters. For amplitude vectors outside these exact families, PyEncode also provides a matrix product state (MPS) loader, \texttt{encode\_mps}. The library is available at https://github.com/UW-ERSL/PyEncode.
Editorial analysis
A structured set of objections, weighed in public.
Referee Report
Summary. The manuscript presents PyEncode, an open-source Python library implementing exact Qiskit circuits for amplitude encoding of classical vectors belonging to ten structured pattern families (sparse, step, square, Walsh, Fourier, geometric, Hamming, staircase, Dicke, and polynomial). It claims specific asymptotic gate complexities without vector materialization or approximation, provides a predict_gates estimator, supports three composition primitives (SUM, PARTITION, TENSOR), and includes an MPS loader for unstructured cases.
Significance. If the implementations faithfully reproduce the cited theoretical constructions, PyEncode would offer a practical, unified open-source resource that lowers the barrier to using efficient structured encodings in quantum algorithms. The composition primitives and predict_gates function add engineering value beyond isolated implementations. The significance is reduced by the complete absence of any empirical gate-count tables, circuit examples, or verification results in the manuscript itself.
major comments (2)
- [Abstract] Abstract: the stated gate complexities (O(m) for sparse/step/Walsh/Hamming/staircase, O(m²) for square/Fourier, O(k(m-k)) for Dicke, O(m^{d+1}) for polynomials) are presented without any supporting table, derivation sketch, or explicit citation to the source theorem for each family, making independent assessment of the claims impossible from the manuscript alone.
- [Implementation] Implementation description: the central assertion that the generated circuits are 'verified' and achieve the predicted post-transpilation depths rests solely on the external GitHub repository; no summary of unit tests, no comparison against general-purpose encoders, and no example transpiled gate counts appear in the paper, which is load-bearing for a software contribution claiming exactness and efficiency.
minor comments (2)
- [Abstract] The abstract and introduction would benefit from a single sentence clarifying that all patterns are exact (non-approximating) and that the library never materializes the full amplitude vector in memory.
- Notation for pattern parameters (e.g., the meaning of m and k in Dicke states) should be defined once in a dedicated notation paragraph rather than only in the abstract.
Simulated Author's Rebuttal
We thank the referee for their constructive feedback and positive assessment of PyEncode's potential utility. We address each major comment below and will incorporate revisions to make the claims more self-contained.
read point-by-point responses
-
Referee: [Abstract] Abstract: the stated gate complexities (O(m) for sparse/step/Walsh/Hamming/staircase, O(m²) for square/Fourier, O(k(m-k)) for Dicke, O(m^{d+1}) for polynomials) are presented without any supporting table, derivation sketch, or explicit citation to the source theorem for each family, making independent assessment of the claims impossible from the manuscript alone.
Authors: We agree that the abstract would benefit from additional context to support independent assessment. In the revised manuscript we will insert a compact table (in Section 2 or as an appendix) that lists each of the ten pattern families, the stated asymptotic gate complexity, and an explicit citation to the source theoretical result for that family. This addition will allow readers to trace the claims directly without external lookup. revision: yes
-
Referee: [Implementation] Implementation description: the central assertion that the generated circuits are 'verified' and achieve the predicted post-transpilation depths rests solely on the external GitHub repository; no summary of unit tests, no comparison against general-purpose encoders, and no example transpiled gate counts appear in the paper, which is load-bearing for a software contribution claiming exactness and efficiency.
Authors: We acknowledge that the manuscript currently defers verification details to the repository. We will expand the Implementation section with a concise paragraph summarizing the unit-test suite (including exactness checks against the target state vector), a short comparison of post-transpilation gate counts versus Qiskit's standard amplitude encoder on representative vectors from each family, and one or two concrete examples of measured depths. These additions will render the verification evidence self-contained while retaining the repository link for full reproducibility. revision: yes
Circularity Check
No significant circularity in the derivation chain
full rationale
The paper presents PyEncode as an implementation of existing theoretical constructions for ten structured amplitude encoding patterns, citing prior work for the efficient circuits and gate complexities (O(m) for sparse/step/Walsh etc.). No equations, derivations, or predictions appear in the provided manuscript text that reduce by construction to self-definitions, fitted inputs, or self-citation chains. The predict_gates function is described as an estimator based on the implemented theory rather than a fit to the library's own outputs. Claims rest on external literature and the linked repository, which qualifies as independent support under the guidelines (no load-bearing self-citation of unverified uniqueness theorems or ansatzes smuggled in). This is a standard library paper with no internal circular steps.
Axiom & Free-Parameter Ledger
Lean theorems connected to this paper
-
IndisputableMonolith/Cost/FunctionalEquation.leanwashburn_uniqueness_aczel unclear?
unclearRelation between the paper passage and the cited Recognition theorem.
It covers ten exact pattern families: sparse, step, square, Walsh, Fourier, geometric, Hamming, staircase, Dicke, and polynomial... Sparse, step, Walsh, Hamming, and staircase patterns require O(m) gates
-
IndisputableMonolith/Foundation/ArithmeticFromLogic.leanembed_injective unclear?
unclearRelation between the paper passage and the cited Recognition theorem.
Walsh functions... correspondence between Walsh series and diagonal operator compilation
What do these tags mean?
- matches
- The paper's claim is directly supported by a theorem in the formal canon.
- supports
- The theorem supports part of the paper's argument, but the paper may add assumptions or extra steps.
- extends
- The paper goes beyond the formal theorem; the theorem is a base layer rather than the whole result.
- uses
- The paper appears to rely on the theorem as machinery.
- contradicts
- The paper's claim conflicts with a theorem or certificate in the canon.
- unclear
- Pith found a possible connection, but the passage is too broad, indirect, or ambiguous to say the theorem truly supports the claim.
Reference graph
Works this paper leans on
-
[1]
Quantum algorithm for linear systems of equa- tions.Physical Review Letters, 103(15):150502, 2009
Aram W Harrow, Avinatan Hassidim, and Seth Lloyd. Quantum algorithm for linear systems of equa- tions.Physical Review Letters, 103(15):150502, 2009
work page 2009
-
[2]
András Gilyén, Yuan Su, Guang Hao Low, and Isaac L Chuang. Quantum singular value trans- formation and beyond: exponential improvements for quantum matrix arithmetics. InProceedings of the 51st Annual ACM SIGACT Symposium on The- ory of Computing (STOC), pages 193–204, 2019. arXiv:1806.01838
-
[3]
Grand unification of quantum algo- rithms.PRX Quantum, 2(4):040203, 2021
John M Martyn, Zane M Rossi, Andrew K Tan, and Isaac L Chuang. Grand unification of quantum algo- rithms.PRX Quantum, 2(4):040203, 2021
work page 2021
-
[4]
Encoding patterns for quantum al- gorithms.IET Quantum Communication, 2(4):141– 152, 2021
Manuela Weigold, Johanna Barzen, Frank Leymann, and Marie Salm. Encoding patterns for quantum al- gorithms.IET Quantum Communication, 2(4):141– 152, 2021
work page 2021
-
[5]
Read the fine print.Nature Physics, 11(4):291–293, 2015
Scott Aaronson. Read the fine print.Nature Physics, 11(4):291–293, 2015
work page 2015
-
[6]
Andrew M Childs, Dmitri Maslov, Yunseong Nam, Neil J Ross, and Yuan Su. Toward the first quan- tum simulation with quantum speedup.Proceedings of the National Academy of Sciences, 115(38):9456– 9461, 2018
work page 2018
-
[7]
Ryan Babbush, Craig Gidney, Dominic W Berry, Nathan Wiebe, Jarrod McClean, Alexandru Paler, Austin Fowler, and Hartmut Neven. Encoding elec- tronic spectra in quantum circuits with linear T com- plexity.Physical Review X, 8(4):041015, 2018
work page 2018
-
[8]
Quantum speedup of Monte Carlo methods.Proceedings of the Royal Society A, 471(2181):20150301, 2015
Ashley Montanaro. Quantum speedup of Monte Carlo methods.Proceedings of the Royal Society A, 471(2181):20150301, 2015
work page 2015
-
[9]
Steven Herbert. The problem with grover-rudolph state preparation for quantum monte-carlo.Physical Review E, 103(6):063302, 2021
work page 2021
-
[10]
Vivek V Shende, Stephen S Bullock, and Igor L Markov. Synthesis of quantum-logic circuits.IEEE Transactions on Computer-Aided Design of Inte- grated Circuits and Systems, 25(6):1000–1010, 2006
work page 2006
-
[11]
Adivide-and-conquer algorithm for quantum state preparation.Scientific reports, 11(1):6329, 2021
Israel F Araujo, Daniel K Park, Francesco Petruc- cione, andAdeniltonJdaSilva. Adivide-and-conquer algorithm for quantum state preparation.Scientific reports, 11(1):6329, 2021
work page 2021
-
[12]
Dalzell, Alessandro Achille, Martin Suchara, and Frederic T
Kaiwen Gui, Alexander M. Dalzell, Alessandro Achille, Martin Suchara, and Frederic T. Chong. Spacetime-efficient low-depth quantum state prepa- ration with applications.Quantum, 8:1257, 2024
work page 2024
-
[13]
JonathanWelch, DanielGreenbaum, SarahMostame, and Alán Aspuru-Guzik. Efficient quantum circuits for diagonal unitaries without ancillas.New Journal of Physics, 16:033040, 2014
work page 2014
-
[14]
Quan- tum state preparation via piecewise QSVT.Quan- tum, 9:1786, 2025
Oliver O’Brien and Christoph Sünderhauf. Quan- tum state preparation via piecewise QSVT.Quan- tum, 9:1786, 2025
work page 2025
-
[15]
Quantum algorithms for approximate functionloading.Physical Review Research, 5:033114, 2023
Gabriel Marin-Sanchez, Javier Gonzalez-Conde, and Mikel Sanz. Quantum algorithms for approximate functionloading.Physical Review Research, 5:033114, 2023
work page 2023
-
[16]
Efficient quantum state preparation with Walsh series.Physi- cal Review A, 109(4):042401, 2024
Julien Zylberman and Fabrice Debbasch. Efficient quantum state preparation with Walsh series.Physi- cal Review A, 109(4):042401, 2024
work page 2024
-
[17]
Efficient Gaussian State Preparation in Quantum Circuits
Yichen Xie and Nadav Ben-Ami. Efficient Gaussian 15 state preparation in quantum circuits.arXiv preprint arXiv:2507.20317, 2025.https://arxiv.org/abs/ 2507.20317
work page internal anchor Pith review Pith/arXiv arXiv 2025
- [18]
-
[19]
Quantum state preparation using tensor networks.Quantum Science and Technology, 8(3):035027, 2023
Ar A Melnikov, Alena A Termanova, Sergey V Dol- gov, Florian Neukart, and MR Perelshtein. Quantum state preparation using tensor networks.Quantum Science and Technology, 8(3):035027, 2023
work page 2023
-
[20]
Sequential generation of entangled multiqubit states.Physical Review Letters, 95(11):110503, 2005
C Schön, E Solano, F Verstraete, J I Cirac, and M M Wolf. Sequential generation of entangled multiqubit states.Physical Review Letters, 95(11):110503, 2005
work page 2005
-
[21]
Shi-Ju Ran. Encoding of matrix product states into quantum circuits of one- and two-qubit gates.Phys- ical Review A, 101(3):032310, 2020
work page 2020
-
[22]
An efficient al- gorithm for sparse quantum state preparation
Niels Gleinig and Torsten Hoefler. An efficient al- gorithm for sparse quantum state preparation. In 2021 58th ACM/IEEE Design Automation Confer- ence (DAC), pages 433–438, 2021
work page 2021
-
[23]
An efficient quan- tum algorithm for preparation of uniform quantum superposition states: A
Alok Shukla and Prakash Vedula. An efficient quan- tum algorithm for preparation of uniform quantum superposition states: A. shukla, p. vedula.Quantum Information Processing, 23(2):38, 2024
work page 2024
-
[24]
A sparse matrix arithmetic based onH-matrices
Wolfgang Hackbusch. A sparse matrix arithmetic based onH-matrices. Part I: Introduction toH- matrices.Computing, 62(2):89–108, 1999
work page 1999
-
[25]
Thomas G. Draper. Addition on a quantum com- puter, 2000
work page 2000
-
[26]
Lov Grover and Terry Rudolph. Creating super- positions that correspond to efficiently integrable probability distributions.arXiv preprint quant- ph/0208112, 2002
-
[27]
Michael A. Nielsen and Isaac L. Chuang.Quantum Computation and Quantum Information. Cambridge University Press, 10th anniversary edition, 2010
work page 2010
-
[28]
Watts, Pablo Rodriguez-Grasa, and Mikel Sanz
Jorge Gonzalez-Conde, Thomas W. Watts, Pablo Rodriguez-Grasa, and Mikel Sanz. Efficient quantum amplitude encoding of polynomial functions.Quan- tum, 8:1297, 2024
work page 2024
-
[29]
Mudassir Moosa, Thomas W Watts, Yiyou Chen, Ab- hijat Sarma, and Peter L McMahon. Linear-depth quantum circuits for loading Fourier approximations of arbitrary functions.Quantum Science and Tech- nology, 9(1):015002, 2024
work page 2024
-
[30]
Determin- istic preparation of dicke states
Andreas Bärtschi and Stephan Eidenbenz. Determin- istic preparation of dicke states. InFundamentals of Computation Theory (FCT 2019), volume 11651 of Lecture Notes in Computer Science, pages 126–139. Springer, 2019
work page 2019
-
[31]
Daniel Cruz, Romain Fournier, Fabien Gremion, Alix Jeannerot, Kenichi Komagata, et al. Efficient quan- tum algorithms for ghz and w states.Advanced Quan- tum Technologies, 2(5-6):1900015, 2019
work page 2019
-
[32]
Jon Louis Bentley and James B. Saxe. Decomposable searching problems I: Static-to-dynamic transforma- tion.Journal of Algorithms, 1(4):301–358, 1980
work page 1980
-
[33]
Vartiainen, Ville Bergholm, and Martti M
Mikko Möttönen, Juha J. Vartiainen, Ville Bergholm, and Martti M. Salomaa. Transformation of quantum states using uniformly controlled rotations.Quantum Information and Computation, 5(6):467–473, 2005
work page 2005
-
[34]
Tensor-traindecomposition.SIAM Journal on Scientific Computing, 33(5):2295–2317, 2011
IvanV.Oseledets. Tensor-traindecomposition.SIAM Journal on Scientific Computing, 33(5):2295–2317, 2011
work page 2011
-
[35]
Quantum chemistry in the age of quantum computing.Chemical Reviews, 119(19):10856–10915, 2019
Yudong Cao, Jonathan Romero, Jonathan P Olson, Matthias Degroote, Peter D Johnson, Mária Kiefer- ová, Ian D Kivlichan, Tim Menke, Borja Peropadre, Nicolas P D Sawaya, et al. Quantum chemistry in the age of quantum computing.Chemical Reviews, 119(19):10856–10915, 2019
work page 2019
-
[36]
John Hubbard. Electron correlations in narrow en- ergy bands.Proceedings of the Royal Society of Lon- don A, 276(1365):238–257, 1963
work page 1963
-
[37]
Über das paulis- che äquivalenzverbot.Zeitschrift für Physik, 47:631– 651, 1928
Pascual Jordan and Eugene Wigner. Über das paulis- che äquivalenzverbot.Zeitschrift für Physik, 47:631– 651, 1928
work page 1928
-
[38]
Wellesley-Cambridge Press, 2nd edition, 2008
Gilbert Strang and George Fix.An Analysis of the Finite Element Method. Wellesley-Cambridge Press, 2nd edition, 2008
work page 2008
-
[39]
Egger, Yue Sun, Christa Zoufal, Raban Iten, Ning Shen, and Stefan Woerner
Nikitas Stamatopoulos, Daniel J. Egger, Yue Sun, Christa Zoufal, Raban Iten, Ning Shen, and Stefan Woerner. Option pricing using quantum computers. Quantum, 4:291, 2020. 16
work page 2020
discussion (0)
Sign in with ORCID, Apple, or X to comment. Anyone can read and Pith papers without signing in.