Core Concepts¶
This section introduces the fundamental building blocks of sparse-state quantum simulation in PySparQ. Understanding these concepts is a prerequisite for using the Register Level Programming paradigm.
Core Abstractions¶
PySparQ is built on three core abstractions:
System — a single computational basis state, containing one complex amplitude
amplitudeand the values of all registersregistersSparseState — a sparse quantum state managing a
std::vector<System>, storing only basis states with non-zero amplitudesRegisters — named quantum variables with typed storage, using
uint64_tas the storage unit, allowing multi-register encodings of the form|a⟩|b⟩|c⟩
Core Data Relationships¶
The default constructor of
SparseStatecreates a|0...0⟩initial state (internally containing a singleSystemwhose register values are all 0 and whose amplitude is 1)The register-value combination of each
Systeminstance must be unique within aSparseState— if a duplicate appears, quantum interference has occurred, and the two amplitudes should be added and de-duplicatedThe operational level of quantum programming rises from qubits up to quantum registers; almost all operations take registers as their unit
Unlike traditional full state-vector simulators, which store \(2^n\) amplitudes, PySparQ stores only the non-zero basis states, so quantum algorithms with a finite number of superposed states can be simulated with polynomial resources.