algos
This module contains Qiskit implementations of example algorithms to analyse the effects of isotropic errors.
isotropic.algos
grover
get_grover_answer(result)
Extract the measurement counts from the result of a Grover circuit execution.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
result
|
PrimitiveResult
|
The result object returned by executing the Grover circuit. |
required |
Returns:
Type | Description |
---|---|
tuple[dict, str]
|
A tuple containing the counts dictionary and the most probable search item. |
Source code in src/isotropic/algos/grover.py
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
|
get_grover_circuit(num_qubits, U_w, iterations)
Create a Grover circuit with the given number of qubits, oracle, and iterations.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
num_qubits
|
int
|
The number of qubits used to encode the states. |
required |
U_w
|
Operator
|
The oracle that marks the solution states. |
required |
iterations
|
int
|
The number of Grover iterations to perform. |
required |
Returns:
Type | Description |
---|---|
QuantumCircuit
|
The constructed Grover quantum circuit. |
Source code in src/isotropic/algos/grover.py
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
|
optimal_num_iterations(num_solutions, num_qubits)
Return the optimal number of iterations, if the number of solutions is known.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
num_solutions
|
int
|
The number of solutions. |
required |
num_qubits
|
int
|
The number of qubits used to encode the states. |
required |
Returns:
Type | Description |
---|---|
int
|
The optimal number of iterations for Grover's algorithm to succeed. |
Source code in src/isotropic/algos/grover.py
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
|