Documentation
¶
Overview ¶
Package counting implements Quantum Approximate Counting.
The algorithm combines Grover's search operator with Quantum Phase Estimation to estimate the number of solutions M in a search space of size N = 2^n. The Grover iterate Q has eigenvalues e^{±2iθ} where sin²(θ) = M/N, so QPE on Q yields θ from which M is recovered.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// NumQubits is the number of search space qubits.
NumQubits int
// Oracle marks the target states.
Oracle grover.Oracle
// NumPhaseBits is the number of precision bits for phase estimation.
NumPhaseBits int
// Shots is the number of measurement shots. Default: 1024.
Shots int
}
Config specifies the Quantum Approximate Counting parameters.
type Result ¶
type Result struct {
// Circuit is the full quantum circuit used.
Circuit *ir.Circuit
// Count is the estimated number of solutions.
Count float64
// Phase is the raw phase θ extracted from QPE.
Phase float64
// Counts is the measurement histogram.
Counts map[string]int
}
Result holds the counting output.
Click to show internal directories.
Click to hide internal directories.