pub fn simon<F>(
oracle: F,
n: usize,
max_shots: usize,
rng: &mut LcgRng,
) -> QuantumResult<SimonResult>Expand description
Run Simon’s algorithm to recover the hidden period of a two-to-one oracle.
oracle(x) returns f(x) for query index x ∈ [0, 2^n), where f obeys
the Simon promise f(x) = f(y) ⇔ y = x ⊕ s. The routine repeatedly runs the
quantum circuit (seeded by rng) until n − 1 linearly independent
constraints have been collected (or max_shots is exhausted), then solves
for s classically.
§Errors
QuantumError::InvalidQubitCountifnis0or> 15(the circuit uses2nqubits;2n ≤ 30).QuantumError::MeasurementFailedis propagated from the sampler.