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.
Teleport a chosen or random qubit state through a Bell pair and verify unit fidelity on every measurement outcome.
Officially provided by KetQat — method by Bennett et al. (1993), Bouwmeester et al. (1997) and others. KetQat prepares, verifies and maintains this product; it does not claim to have invented the method. Read the origin statement.
Runs the teleportation protocol of Bennett, Brassard, Crepeau, Jozsa, Peres and Wootters as an exact three-qubit statevector simulation on your machine. Alice holds the message qubit and one half of a Bell pair |Phi+>, Bob the other half. Alice applies CNOT and Hadamard and measures both qubits; Bob applies X and/or Z according to her two bits. The product projects out all four measurement outcomes analytically and reports, for each, its exact probability (1/4 regardless of the input), the correction Bob applies, the fidelity of his qubit with the input after the correction, and the fidelity he would have had without it. Shots then sample which outcome occurred, with a seed.
The input state is a point on the Bloch sphere you choose (theta, phi) or a Haar-random pure state drawn from the seed. Because every branch is computed exactly, the statement that the fidelity is 1 covers all four outcomes, not only the ones a sampler visited.
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[algorithms] @ 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].
import json
from ketqat_runner import catalog
record = catalog.run("[email protected]", seed=7, theta=1.0, phi=0.5, shots=1000)
result = record.result
print(json.dumps({
"status": record.status,
"min_fidelity": round(result["min_fidelity"], 9),
"average_fidelity_without_correction": round(result["average_fidelity_without_correction"], 9),
"outcome_probabilities": [round(branch["probability"], 9) for branch in result["branches"]],
"total_counts": sum(result["counts"].values()),
}))
{
"status": "succeeded",
"min_fidelity": 1,
"total_counts": 1000,
"outcome_probabilities": [
0.25,
0.25,
0.25,
0.25
],
"average_fidelity_without_correction": 0.5
}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 |
|---|---|---|---|---|
| theta | number | null | maximum: 3.141592653589793; minimum: 0 | Polar angle of the input state cos(theta/2)|0> + exp(i phi) sin(theta/2)|1>, in [0, pi]. null together with phi means a Haar-random state drawn from the seed. |
| phi | number | null | maximum: 6.283185307179586; minimum: 0 | Azimuthal angle in [0, 2 pi]. Give both theta and phi, or neither. |
| shots | integer | 1000 | maximum: 1000000; minimum: 1 | Number of sampled runs of the protocol; only which outcome occurred is sampled. |
| Name | Type | Description |
|---|---|---|
| branches | object[] | For each outcome m0 m1: its exact probability, Bob's correction, the fidelity with the input after correction and without it. |
| min_fidelity | number | Smallest fidelity over the four outcomes after correction (1 for a correct protocol). |
| average_fidelity_without_correction | number | Probability-weighted fidelity if Bob applied nothing (1/2 for any pure input). |
| input_state | object | The teleported state: source, theta, phi, Bloch vector and amplitudes. |
| counts | object | Seeded counts of the four outcomes, with observed_frequencies beside the expected 0.25. |
Seeded random input state (theta 2.574, phi 0.319): every one of the four outcomes has probability 0.25 and fidelity 1 after Bob's correction; without the correction the fidelities are 1, 0.261, 0.711 and 0.028, averaging exactly 0.5. Seeded counts 252/246/260/242 over 1000 shots.
Generated with
{"phi":null,"shots":1000,"theta":null}{
"shots": 1000,
"counts": {
"10": 260,
"11": 242,
"00": 252,
"01": 246
},
"branches": [
{
"outcome": "00",
"fidelity": 1,
"correction": "none",
"probability": 0.25,
"fidelity_without_correction": 1
},
{
"outcome": "01",
"fidelity": 1,
"correction": "X",
"probability": 0.25,
"fidelity_without_correction": 0.260815699353
},
{
"outcome": "10",
"fidelity": 1,
"correction": "Z",
"probability": 0.25,
"fidelity_without_correction": 0.710702009622
},
{
"outcome": "11",
"fidelity": 1,
"correction": "X then Z",
"probability": 0.25,
"fidelity_without_correction": 0.028482291026
}
],
"protocol": "Alice: CNOT(message -> her Bell half), H(message), measure both; Bob: X if Alice's bit is 1, then Z if the message bit is 1",
"bell_pair": "|Phi+> = (|00> + |11>)/sqrt(2)",
"execution": "exact three-qubit statevector simulation; shots sample only which measurement outcome occurred",
"input_state": {
"phi": 0.319163492968,
"theta": 2.573690971434,
"source": "random (Haar-distributed pure state drawn from the seed)",
"amplitudes": [
[
0.280150459155,
0
],
[
0.911476614305,
0.301207738629
]
],
"bloch_vector": [
0.510701184013,
0.168766972556,
-0.843031440471
]
},
"qubit_order": "qubit 0 message, qubit 1 Alice's half, qubit 2 Bob's half (little-endian)",
"max_fidelity": 1,
"min_fidelity": 1,
"outcome_labels": "m0 m1: m0 is the message qubit's bit after the Hadamard (controls Z), m1 is Alice's half of the pair (controls X)",
"observed_frequencies": {
"10": 0.26,
"11": 0.242,
"00": 0.252,
"01": 0.246
},
"expected_outcome_probability": 0.25,
"average_fidelity_without_correction": 0.5
}unit fidelity
For 200 Haar-random states and the six axis states, every one of the four outcomes has fidelity 1 with the input to 1e-12 after correction, and probability 1/4 to 1e-12; the product reports the same for seeded and chosen inputs.
python/tests/test_catalog_products.py::test_teleportation_fidelity_is_one_for_every_outcome
correction necessity
Without Bob's corrections the probability-weighted fidelity equals (1 + x^2 + y^2 + z^2)/4 = 1/2 for every pure input, and for |0> the outcomes that call for X give fidelity exactly 0 -- analytic values the simulation is compared against.
python/tests/test_catalog_products.py::test_teleportation_without_corrections_averages_one_half
outcome statistics
With 4000 seeded shots each of the four outcome counts lies within five binomial standard deviations of 1000, and the counts sum to the shot total.
python/tests/test_catalog_products.py::test_teleportation_outcomes_are_uniform_within_five_sigma
example execution
The example code is executed verbatim in a clean virtual environment with only the algorithms extra installed.
1.0.01 Nov 2026currentShown on this page
Needs SDK 0.3.0 or later with extras: algorithms.
KetQat implementation of published methods
Quantum teleportation was invented by Bennett, Brassard, Crepeau, Jozsa, Peres and Wootters (1993) and first demonstrated experimentally by Bouwmeester et al. (1997). KetQat wrote this NumPy statevector implementation (teleportation.py), its exact per-branch analysis, the 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:34 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.