Quantum Algorithms · Search
Grover search (statevector)
Simulate Grover's search on up to 20 qubits and get the exact success probability plus seeded measurement counts.
Simulate textbook quantum phase estimation for a given eigenphase and read off the estimate, its probability and seeded counts.
Officially provided by KetQat — method by Kitaev (1995), Cleve et al. (1998) and others. KetQat prepares, verifies and maintains this product; it does not claim to have invented the method. Read the origin statement.
Runs textbook quantum phase estimation as a statevector simulation of the gate sequence: Hadamards on the counting register, the controlled-U^(2^j) phase kickback against an eigenstate with eigenphase phi, and an inverse quantum Fourier transform. The output distribution is the Born rule applied to the final state, not a formula for what it should be.
Use it to see how the number of counting qubits sets the resolution, to check that a dyadic phase is recovered with certainty, and to inspect the spread of outcomes for a phase the register cannot represent exactly. Pure Python: no optional dependencies.
Installs the KetQat SDK from commit 2cedabbd814f, the exact version whose product definition this page shows. The SDK is not on PyPI yet, so pip install ketqat alone will not work.
pip install "ketqat @ git+https://github.com/ketqat/ketqat-sdk@2cedabbd814fd199b1989c8ceb1e9efa1744c2c0#subdirectory=python"Save it as example.py and run python example.py. Or use the CLI: ketqat catalog run [email protected] --param phase=PHASE.
import json
from ketqat_runner import catalog
record = catalog.run("[email protected]", seed=11, phase=0.3125, counting_qubits=4, shots=500)
result = record.result
print(json.dumps({
"status": record.status,
"measured_integer": result["measured_integer"],
"estimated_phase": result["estimated_phase"],
"success_probability": round(result["success_probability"], 9),
"counts": result["counts"],
}))
{
"counts": {
"0101": 500
},
"status": "succeeded",
"estimated_phase": 0.3125,
"measured_integer": 5,
"success_probability": 1
}Verified with
ketqat report RUN_ID sends an opt-in usage report: product, version, succeeded/failed, time and SDK version only. It shows you the exact payload first and needs an API token from Settings. Nothing is sent unless you run it.
| Name | Type | Default | Allowed values | Description |
|---|---|---|---|---|
| phase | number | required | maximum: 1; minimum: 0 | Eigenphase phi in [0, 1); the eigenvalue is exp(2 pi i phi). |
| counting_qubits | integer | 8 | maximum: 16; minimum: 1 | Size n of the counting register; the resolution is 2^-n. |
| shots | integer | 1000 | maximum: 1000000; minimum: 1 | Measurement samples drawn from the exact distribution. |
| Name | Type | Description |
|---|---|---|
| estimated_phase | number | m / 2^n for the most probable outcome m. |
| success_probability | number | Exact probability of that most probable outcome. |
| phase_error | number | Distance on the circle between the estimate and the true phase. |
| top_outcomes | object[] | The eight most probable outcomes with their exact probabilities. |
| counts | object | Seeded measurement counts by bitstring. |
Phase 0.3 is not representable with 6 counting qubits: the most probable estimate is 0.296875 (integer 19) with probability 0.8752; the remaining probability spreads over neighbouring outcomes.
Generated with
{"phase":0.3,"shots":1000,"counting_qubits":6}{
"true_phase": 0.3,
"phase_error": 0.003124999999999989,
"top_outcomes": [
{
"phase": 0.296875,
"integer": 19,
"bitstring": "010011",
"probability": 0.875168316795848
},
{
"phase": 0.3125,
"integer": 20,
"bitstring": "010100",
"probability": 0.05472438734954395
},
{
"phase": 0.28125,
"integer": 18,
"bitstring": "010010",
"probability": 0.02433758569494445
},
{
"phase": 0.328125,
"integer": 21,
"bitstring": "010101",
"probability": 0.01083236012661924
},
{
"phase": 0.265625,
"integer": 17,
"bitstring": "010001",
"probability": 0.007260745509113149
},
{
"phase": 0.34375,
"integer": 22,
"bitstring": "010110",
"probability": 0.004493223739427852
},
{
"phase": 0.25,
"integer": 16,
"bitstring": "010000",
"probability": 0.003446771870081909
},
{
"phase": 0.359375,
"integer": 23,
"bitstring": "010111",
"probability": 0.002452523992906569
}
],
"counting_qubits": 6,
"estimated_phase": 0.296875,
"measured_integer": 19,
"success_probability": 0.875168316795848,
"most_frequent_integer": 19,
"phase_is_representable": false
}exact dyadic
A phase k/2^n is estimated as exactly k with probability 1 for every k at n = 1..8.
python/tests/test_catalog_products.py::test_phase_estimation_is_exact_for_dyadic_phases
analytic distribution
For non-dyadic phases the full simulated distribution matches the analytic Fejer-kernel form P(m) = sin^2(pi 2^n d) / (4^n sin^2(pi d)), d = phi - m/2^n, to 1e-12.
python/tests/test_catalog_products.py::test_phase_estimation_matches_the_fejer_kernel
example execution
The example code is executed verbatim in a clean virtual environment with the base install only.
1.0.029 Oct 2026currentShown on this page
Needs SDK 0.3.0 or later.
KetQat implementation of published methods
Phase estimation is due to Kitaev (1995) and was given its standard circuit form by Cleve, Ekert, Macchiavello and Mosca (1998). KetQat wrote the pure-Python statevector simulation in this SDK (phase_estimation.py and fourier.py), its validation tests and this catalog entry. KetQat did not invent the method.
Apache-2.0 — see Licensing.
People credited for this product. KetQat publishes and maintains it; contributors are credited for their work and are not sellers.
No usage reports yet
Distinct signed-in accounts that chose to send at least one usage report (ketqat report) for this product in the last 90 days. KetQat staff, test and bot accounts are excluded. Reports are opt-in, so this is not a count of all users.
Computed 10 Nov 2026, 17:24 UTC.
Not yet rated
Be the first to rate this product after you run it.
Mean of visible reviews. Hidden reviews and reviews by KetQat staff, test and bot accounts are excluded. Pro status gives no extra weight.
Sign in to review this product. One review per person; you can edit it later.
No reviews yet.