A composable functional framework for symbolic operator algebra, including fermionic and bosonic normal ordering, mixed-sector canonicalization, and fermion-to-qubit encodings.
Build, normalize, and encode operator expressions on Fock space using algebraic data types, pure functions, and zero dependencies.
Install
dotnet add package FockMap
Brand Assets
30-Second Example
open Encodings
// Encode the creation operator a†₂ on 4 modes using Jordan-Wigner
let pauli = jordanWignerTerms Raise 2u 4u
// → ½(ZZXI) − ½i(ZZYI)
// Same operator under Bravyi-Kitaev (O(log n) weight)
let pauliBK = bravyiKitaevTerms Raise 2u 4u
Why This Library?
| Feature | OpenFermion | Qiskit Nature | FockMap |
|---|---|---|---|
| Define a new encoding | ~200 lines | Not supported | 3–5 lines |
| Tree → encoding pipeline | ❌ | ❌ | ✅ |
| Type-safe operator algebra | ❌ | ❌ | ✅ |
| Pure functional, zero mutation | ❌ | ❌ | ✅ |
| Symbolic CAR + CCR normal ordering | ❌ | Partial | ✅ |
Available Encodings
| Encoding | Worst-Case Weight | Function |
|---|---|---|
| Jordan-Wigner | $O(n)$ | jordanWignerTerms |
| Bravyi-Kitaev | $O(\log_2 n)$ | bravyiKitaevTerms |
| Parity | $O(n)$ | parityTerms |
| Balanced Binary Tree | $O(\log_2 n)$ | balancedBinaryTreeTerms |
| Balanced Ternary Tree | $O(\log_3 n)$ | ternaryTreeTerms |
Cross-Platform
Runs on Windows, macOS, and Linux via .NET 10 (LTS). Written in F#, fully open-source under the F# Software Foundation and the .NET Foundation.
Learn More
- Start here: Library Cookbook — every type and function, step by step
- Molecules → qubits: From Molecules to Qubits — complete H₂ pipeline
- Theory first: Why Encodings?
- Hands-on first: Your First Encoding
- Library internals: Architecture Guide
- API Reference: All types and functions
Explore the Docs
From Molecules to Qubits
A step-by-step guide using H₂ as a worked example.
- Overview — The complete pipeline at a glance
- The Electronic Structure Problem — Born–Oppenheimer, basis sets, configurations
- The Notation Minefield — Chemist’s vs. physicist’s integrals
- Spatial to Spin-Orbital Integrals — Doubling the index space
- Building the H₂ Hamiltonian — The 15-term qubit Hamiltonian
- Checking Our Answer — Diagonalisation and cross-encoding comparison
- What Comes Next — VQE, QPE, and scaling
Theory
- Why Encodings? — The problem encodings solve
- Second Quantization — Fock space, creation/annihilation operators
- Pauli Algebra — Pauli matrices and strings
- Jordan-Wigner — The classic encoding
- Beyond Jordan-Wigner — BK, trees, and O(log n) scaling
- Bosonic Operators — CCR algebra and truncation strategies
- Mixed Systems — Canonical sector ordering and hybrid workflows
Interactive Labs
- First Encoding — Encode your first operator (5 min)
- H₂ Molecule — Full molecular Hamiltonian
- Compare Encodings — Side-by-side comparison
- Custom Encoding — Define your own scheme
- Custom Tree — Build tree-based encodings
- Scaling Analysis — Pauli weight scaling with system size
Guides
- Library Cookbook — Every type and function, step by step
- Architecture — Two-framework design
- Cross-Platform — .NET 10 and F# on all platforms