Encodings Namespace
| Modules | Description |
|
Bosonic ladder-operator expressions and normal-ordering utilities. |
|
|
Bosonic-to-qubit encodings: Unary, Binary, and Gray code. |
|
Bravyi-Kitaev encoding for fermion-to-qubit mappings. The BK transform uses a Fenwick tree structure to achieve O(log n) Pauli weight per ladder operator, compared to O(n) for the Jordan-Wigner transform. This module delegates to MajoranaEncoding with Fenwick-tree index sets. Reference: Seeley, Richard, Love — "The Bravyi-Kitaev transformation for quantum computation of electronic structure" (arXiv:1208.5986) |
|
|
Renders Gate arrays into OpenQASM (2.0 and 3.0), Q#, and JSON circuit formats. |
|
|
Algebra interface for combining operator terms during normal ordering. |
|
|
Unified cost metrics for encoded Hamiltonians, including qubitization resource estimation. |
|
|
FCIDUMP file parser and coefficient factory builder. |
|
A purely functional Fenwick tree (binary indexed tree) parameterized by an associative combining operation. The tree stores partial aggregates over an array of n values, supporting: - point update : O(log n) - prefix query : O(log n) - range query : via prefix difference when the combine has an inverse The index sets used by the Bravyi-Kitaev encoding (update, parity, occupation, remainder) all fall out naturally from the Fenwick tree structure, making this a good foundation for the BK transform. |
|
|
Hamiltonian construction from one-body and two-body integrals. |
|
|
Fermionic ladder operators with index tracking and ordering predicates. |
|
|
Defines the fundamental Pauli algebra types: Phase and Pauli operators. |
|
|
Indexed operator types for tracking qubit/mode assignments. |
|
|
The Jordan-Wigner fermion-to-qubit encoding (1928). |
|
|
Normal ordering of fermionic operator products. |
|
Generic fermion-to-qubit encoding via Majorana decomposition.
Every encoding in this family maps a single fermionic ladder operator
to a pair of Majorana operators (c, d) built from three index sets:
U(j, n) — update set: qubits that flip when occupation of mode j changes
P(j) — parity set: qubits encoding the parity n₀ ⊕ … ⊕ n_{j−1}
Occ(j) — occupation set: qubits encoding whether mode j is occupied
The Majorana operators are:
c_j = X_{U(j)∪{j}} · Z_{P(j)}
d_j = Y_j · X_{U(j)} · Z_{(P(j)⊕Occ(j))∖{j}}
And the ladder operators follow:
a†_j = ½(c_j − i·d_j) a_j = ½(c_j + i·d_j)
Different choices of index-set functions yield different encodings:
Jordan-Wigner : U = ∅, P = {0…j−1}, Occ = {j}
Parity : U = {j+1…n−1}, P = {j−1}?, Occ = {j−1,j}?
Bravyi-Kitaev : U, P, Occ from Fenwick tree structure
|
|
|
Sector-aware symbolic utilities for mixed bosonic and fermionic systems. |
|
|
Pluggable optimisation framework for selecting the best encoding. |
|
|
Multi-qubit Pauli strings with phase tracking and symbolic multiplication. |
|
|
Swap-tracking selection sort for computing fermionic phase factors. |
|
|
Symbolic qubit tapering utilities for Pauli Hamiltonians. |
|
|
Core algebraic types for representing quantum operator expressions. |
|
General tree-based fermion-to-qubit encodings.
This module implements two approaches:
(1) Index-set approach (Havlíček et al. arXiv:1701.07072):
The generic tree → index-set construction below is CAR-valid ONLY for
rooted STAR trees (one central node adjacent to all others). An
independent census over all rooted labelled trees finds exactly n of the
n^(n−1) trees satisfy CAR for n=3..6 — precisely the rooted stars.
Fenwick, chain, and balanced binary/ternary trees FAIL in general, and
monotonicity of ancestor indices is neither necessary nor sufficient
(a star rooted at node 0 passes with ancestor < child; a Fenwick tree
fails with ancestor > child). This construction is a demonstration of the
EncodingScheme abstraction, NOT the library's production tree encoder.
(2) Path-based ternary-tree approach (Bonsai: arXiv:2212.09731,
Jiang et al.: arXiv:1910.10746):
Works for ANY ternary tree. Constructs Majorana strings directly
from root-to-leg paths. Each node has 3 descending links labeled
X, Y, Z. Each leg yields a Pauli string by collecting the labels
along its root-to-leg path. Paired legs give the two Majoranas
for each fermionic mode. This is what the exported tree encoders
(ternaryTreeTerms, balancedBinaryTreeTerms, vlasovTreeTerms) use.
Canonical encodings are provided directly and do NOT rely on the generic
index-set construction above:
- Jordan-Wigner: JordanWigner.fs (and jordanWignerScheme)
- Bravyi-Kitaev: BravyiKitaev.fs via a persistent Fenwick tree
- Balanced ternary tree: O(log₃ n) Pauli weight via the path-based method
|
|
|
Symbolic Trotter decomposition of Pauli Hamiltonians. |
|
|
General-purpose utility functions and type extensions used throughout the encoding library. |
|
|
Symbolic support for VQE measurement programs and QPE resource estimation. |