Skip to content

Commit f235560

Browse files
authored
Fix some spelling (amazon-braket#101)
* fix spelling in .py files * fix spelling in README * spelling in advanced algos * spelling in features * spelling in getting started * spelling weight * spelling visited * circuit spelling
1 parent 93946dd commit f235560

File tree

20 files changed

+42
-42
lines changed

20 files changed

+42
-42
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ This folder contains examples that illustrate the usage of individual features o
132132

133133
* [**Getting Devices and Checking Device Properties**](examples/braket_features/Getting_Devices_and_Checking_Device_Properties.ipynb)
134134

135-
This example shows how to interact with the Amazon Braket GetDevice API to retrieve Amazon Braket devices (such as simulators and QPUs) programatically, and how to gain access to their properties.
135+
This example shows how to interact with the Amazon Braket GetDevice API to retrieve Amazon Braket devices (such as simulators and QPUs) programmatically, and how to gain access to their properties.
136136

137137
* [**Using the tensor network simulator TN1**](examples/braket_features/Using_the_tensor_network_simulator_TN1.ipynb)
138138

@@ -170,7 +170,7 @@ To install the dependencies required for running the notebook examples in this r
170170
conda env create -n <your_env_name> -f environment.yml
171171
```
172172

173-
Activate the conda enviroment using:
173+
Activate the conda environment using:
174174
```bash
175175
conda activate <your_env_name>
176176
```

examples/advanced_circuits_algorithms/Grover/Grover.ipynb

+4-4
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@
244244
"@circuit.subroutine(register=True)\n",
245245
"def ccz(targets=[0, 1, 2]):\n",
246246
" \"\"\"\n",
247-
" implementation ot three-qubit gate CCZ\n",
247+
" implementation of three-qubit gate CCZ\n",
248248
" \"\"\"\n",
249249
" # define three-qubit CCZ gate\n",
250250
" ccz_gate = np.array([[1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0],\n",
@@ -326,7 +326,7 @@
326326
" \"\"\"\n",
327327
" function to put together individual modules of Grover algorithm\n",
328328
" \"\"\"\n",
329-
" # initalize\n",
329+
" # initialize\n",
330330
" grover_circ = initialize()\n",
331331
" # oracle and amplify\n",
332332
" for ii in range(n_reps):\n",
@@ -388,10 +388,10 @@
388388
" # get output probabilities\n",
389389
" probs_values = result.values[0]\n",
390390
"\n",
391-
" # get measurment results\n",
391+
" # get measurement results\n",
392392
" measurement_counts = result.measurement_counts\n",
393393
"\n",
394-
" # print measurment results\n",
394+
" # print measurement results\n",
395395
" print('measurement_counts:', measurement_counts)\n",
396396
"\n",
397397
" # bitstrings\n",

examples/advanced_circuits_algorithms/QAA/QAA_tutorial.ipynb

+3-3
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@
310310
"source": [
311311
"In ```utils_qaa.py``` we provide a set of simple helper functions to implement the quantum circuit for the QAA algorithm. \n",
312312
"Specifically, we demonstrate how such modular building blocks can be registered as subroutines, using ```@circuit.subroutine(register=True)```. \n",
313-
"Here we first highlight the implementaion of the reflections $-\\mathcal{R}_{B}$ and $-\\mathcal{R}_{0}$ as discussed previously. The functions defined as follows comprise the ```utiles_qaa.py``` module."
313+
"Here we first highlight the implementation of the reflections $-\\mathcal{R}_{B}$ and $-\\mathcal{R}_{0}$ as discussed previously. The functions defined as follows comprise the ```utiles_qaa.py``` module."
314314
]
315315
},
316316
{
@@ -793,7 +793,7 @@
793793
"Using amplitudes also presents a learning opportunity:\n",
794794
"If we use $N-1$ ancilla qubits to implement the reflection $\\mathcal{R}_{0}$ (by fixing ```use_explicit_unitary = False```), then measurement outcomes are bitstrings of size $N+N-1=2N-1$ (as we measure the original qubits on which the circuit acts, as well as the ancilla qubits).\n",
795795
"\n",
796-
"Since the ancilla qubits are initalized in $|0, 0, ...\\rangle$ and are uncomputed back to their initial state in the last step of the algorithm, we can find the amplitude of a given bitstring on the register qubits by padding that target bitstring (for example, $11$ in our example) with the right number ($N-1$) of zeros. \n",
796+
"Since the ancilla qubits are initialized in $|0, 0, ...\\rangle$ and are uncomputed back to their initial state in the last step of the algorithm, we can find the amplitude of a given bitstring on the register qubits by padding that target bitstring (for example, $11$ in our example) with the right number ($N-1$) of zeros. \n",
797797
"\n",
798798
"Using a classical simulator backend, we can attach the corresponding amplitude as a `ResultType` to the circuit, as shown in the following code. "
799799
]
@@ -952,4 +952,4 @@
952952
},
953953
"nbformat": 4,
954954
"nbformat_minor": 4
955-
}
955+
}

examples/advanced_circuits_algorithms/QAA/utils_circuit.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
def get_unitary(self):
66
"""
7-
Funtion to get the unitary matrix corresponding to an entire circuit.
7+
Function to get the unitary matrix corresponding to an entire circuit.
88
Acts on self and returns the corresponding unitary
99
"""
1010
num_qubits = int(

examples/advanced_circuits_algorithms/QFT/QFT.ipynb

+1-1
Original file line numberDiff line numberDiff line change
@@ -983,7 +983,7 @@
983983
"cell_type": "markdown",
984984
"metadata": {},
985985
"source": [
986-
"## COMPARISON OF IMPLEMENATIONS"
986+
"## COMPARISON OF IMPLEMENTATIONS"
987987
]
988988
},
989989
{

examples/advanced_circuits_algorithms/QPE/QPE.ipynb

+2-2
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@
329329
"cell_type": "markdown",
330330
"metadata": {},
331331
"source": [
332-
"As shown in the folllowing code, the two registers can be distributed anywhere across the circuit, with arbitrary indices for the precision and the query registers. "
332+
"As shown in the following code, the two registers can be distributed anywhere across the circuit, with arbitrary indices for the precision and the query registers. "
333333
]
334334
},
335335
{
@@ -1280,7 +1280,7 @@
12801280
"def substring(key, precision_qubits):\n",
12811281
" \"\"\"\n",
12821282
" Helper function to get substring from keys for dedicated string positions as given by precision_qubits.\n",
1283-
" This function is necessary to allow for arbitary qubit mappings in the precision and query registers\n",
1283+
" This function is necessary to allow for arbitrary qubit mappings in the precision and query registers\n",
12841284
" (that is, so that the register qubits need not be contiguous.)\n",
12851285
"\n",
12861286
" Args:\n",

examples/advanced_circuits_algorithms/QPE/utils_qpe.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ def qpe(precision_qubits, query_qubits, unitary, control_unitary=True):
100100
def substring(key, precision_qubits):
101101
"""
102102
Helper function to get substring from keys for dedicated string positions as given by precision_qubits.
103-
This function is necessary to allow for arbitary qubit mappings in the precision and query registers
103+
This function is necessary to allow for arbitrary qubit mappings in the precision and query registers
104104
(i.e., so that the register qubits need not be contiguous.)
105105
106106
Args:
@@ -229,7 +229,7 @@ def run_qpe(
229229
number_precision_qubits = len(precision_qubits)
230230
num_qubits = len(precision_qubits) + len(query_qubits)
231231

232-
# Define the circuit. Start by copying the query_circuit, then add ther QPE:
232+
# Define the circuit. Start by copying the query_circuit, then add the QPE:
233233
circ = query_circuit
234234
circ.qpe(precision_qubits, query_qubits, unitary)
235235

examples/advanced_circuits_algorithms/Randomness/Randomness_Generation.ipynb

+1-1
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@
273273
"\n",
274274
"## Extractor construction <a name=\"extractor_construction\"></a>\n",
275275
"\n",
276-
"In this paragraph, we provide an explicit construction of a quantum-proof two-source extractor that efficiently provides non-zero output $M$ for a wide range of sizes of the inputs $X_1$ and $X_2$. Namely, we employ a Toeplitz matrices based construction orginally discussed in [2]:\n",
276+
"In this paragraph, we provide an explicit construction of a quantum-proof two-source extractor that efficiently provides non-zero output $M$ for a wide range of sizes of the inputs $X_1$ and $X_2$. Namely, we employ a Toeplitz matrices based construction originally discussed in [2]:\n",
277277
"\n",
278278
"For the security parameter $\\epsilon\\in(0,1]$ and inputs $X_1,X_2$ of size $n$ and $n-1$, respectively, the function $\\text{Ext}:\\{0,1\\}^n\\times\\{0,1\\}^{n-1}\\to\\{0,1\\}^m$ defined below is a quantum-proof two-source randomness extractor with output size\n",
279279
"\n",

examples/advanced_circuits_algorithms/Simons_Algorithm/Simons_Algorithm.ipynb

+4-4
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@
132132
"source": [
133133
"## Quantum Algorithm for Simon's Problem<a name=\"quantumalgorithm\"></a>\n",
134134
"\n",
135-
"Simon's algorithm is a scheme for solving the problem above using exponentially fewer queries to the funciton $f$. In order for Simon's algorithm to work, one needs to be able to implement the unknown function $f$ using quantum logic. That is, given an input *quantum state* $|x\\rangle$, one needs a *unitary* $U_f$ satisfying\n",
135+
"Simon's algorithm is a scheme for solving the problem above using exponentially fewer queries to the function $f$. In order for Simon's algorithm to work, one needs to be able to implement the unknown function $f$ using quantum logic. That is, given an input *quantum state* $|x\\rangle$, one needs a *unitary* $U_f$ satisfying\n",
136136
"$$U_f|x\\rangle |0\\rangle = |x\\rangle |f(x)\\rangle.$$\n",
137137
"This unitary is an *oracle* for $f$, and the goal is to query it as few times as possible to learn the secret string $s$.\n",
138138
"\n",
@@ -182,7 +182,7 @@
182182
"From the measurement results $\\{z_1, \\dots, z_k\\}$, we can form a system of equations:\n",
183183
"$$ \\begin{aligned}z_{1}\\cdot s&=0\\mod{2}\\\\z_{2}\\cdot s&=0\\mod{2}\\\\&\\,\\,\\vdots \\\\z_{k}\\cdot s&=0\\mod{2}\\end{aligned}$$ \n",
184184
"\n",
185-
"There are $k$ equations and $n$ unknowns (the elements of $s$). If we run the quantum part enough times so that we find $n$ **independent** equations, then we can solve these equations (using, e.g., Gaussian elimination) to recover the secret string $s$. This is precisely the classical post-processing requried: solve the system of equations found above to recover the string $s$. We refer the interested reader to the [Appendix](#Classical-post-processing) for details."
185+
"There are $k$ equations and $n$ unknowns (the elements of $s$). If we run the quantum part enough times so that we find $n$ **independent** equations, then we can solve these equations (using, e.g., Gaussian elimination) to recover the secret string $s$. This is precisely the classical post-processing required: solve the system of equations found above to recover the string $s$. We refer the interested reader to the [Appendix](#Classical-post-processing) for details."
186186
]
187187
},
188188
{
@@ -594,9 +594,9 @@
594594
"#### Quantum Implementation of $U_f$\n",
595595
"We now define the unitary using the `@circuit.subroutine` functionality of the Amazon Braket SDK. The following code was imported from the `simons_utils.py` module, and is shown below for reference. \n",
596596
"\n",
597-
"In the quantum setting, we first copy the input register into some ancilliary qubits:\n",
597+
"In the quantum setting, we first copy the input register into some ancillary qubits:\n",
598598
"$$ |x\\rangle|0\\rangle\\mapsto |x\\rangle|x\\rangle.$$\n",
599-
"We then perform the quantum analog of $\\mathrm{XOR}$, which means we apply an $X$ gate to the $k^\\text{th}$ qubit whenever the $k^\\text{th}$ bit of $s$ is $1$. However, we only apply this $X$ gate when the flag qubit is also $|1\\rangle$. Thus, our $X$ gate becomes a $\\mathrm{CNOT}$ gate beween the flag qubit on the input register, and the $k^\\text{th}$ qubit on the output."
599+
"We then perform the quantum analog of $\\mathrm{XOR}$, which means we apply an $X$ gate to the $k^\\text{th}$ qubit whenever the $k^\\text{th}$ bit of $s$ is $1$. However, we only apply this $X$ gate when the flag qubit is also $|1\\rangle$. Thus, our $X$ gate becomes a $\\mathrm{CNOT}$ gate between the flag qubit on the input register, and the $k^\\text{th}$ qubit on the output."
600600
]
601601
},
602602
{

examples/braket_features/Simulating_Noise_On_Amazon_Braket.ipynb

+5-5
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,8 @@
126126
"\n",
127127
"# visualize the results\n",
128128
"result = task.result()\n",
129-
"measurment = result.measurement_counts\n",
130-
"print('measurement results:', measurment)"
129+
"measurement = result.measurement_counts\n",
130+
"print('measurement results:', measurement)"
131131
],
132132
"outputs": [
133133
{
@@ -181,8 +181,8 @@
181181
"\n",
182182
"# visualize the results\n",
183183
"result = task.result()\n",
184-
"measurment = result.measurement_counts\n",
185-
"print('measurement results:', measurment)"
184+
"measurement = result.measurement_counts\n",
185+
"print('measurement results:', measurement)"
186186
],
187187
"outputs": [
188188
{
@@ -319,7 +319,7 @@
319319
"cell_type": "code",
320320
"execution_count": 8,
321321
"source": [
322-
"# creat an arbitrary 2-qubit Kraus matrix\n",
322+
"# create an arbitrary 2-qubit Kraus matrix\n",
323323
"E0 = unitary_group.rvs(4) * np.sqrt(0.2) \n",
324324
"E1 = unitary_group.rvs(4) * np.sqrt(0.8)\n",
325325
"K = [E0, E1] \n",

examples/braket_features/Verbatim_Compilation.ipynb

+1-1
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@
418418
"cell_type": "markdown",
419419
"metadata": {},
420420
"source": [
421-
"After selecting the qubits and validating their gate fidelities, you can now construct a cirucit and run it. "
421+
"After selecting the qubits and validating their gate fidelities, you can now construct a circuit and run it. "
422422
]
423423
},
424424
{

examples/getting_started/3_Deep_dive_into_the_anatomy_of_quantum_circuits.ipynb

+1-1
Original file line numberDiff line numberDiff line change
@@ -930,7 +930,7 @@
930930
{
931931
"cell_type": "markdown",
932932
"source": [
933-
"So far, we have only taken measurements in the computational basis. However, it is also possible to measure in other bases, as well as estimate important statistics like expectation value and variance. We do this by adding `ResultType`s to our circuit; in the folowing example, we will make measurements in the basis of the observable $X_{0}Y_{1}$ (this is the tensor product $X(0) \\otimes Y(1)$):"
933+
"So far, we have only taken measurements in the computational basis. However, it is also possible to measure in other bases, as well as estimate important statistics like expectation value and variance. We do this by adding `ResultType`s to our circuit; in the following example, we will make measurements in the basis of the observable $X_{0}Y_{1}$ (this is the tensor product $X(0) \\otimes Y(1)$):"
934934
],
935935
"metadata": {}
936936
},

examples/getting_started/4_Superdense_coding.ipynb

+2-2
Original file line numberDiff line numberDiff line change
@@ -144,10 +144,10 @@
144144
" # get output probabilities\n",
145145
" probs_values = result.values[0]\n",
146146
"\n",
147-
" # get measurment results\n",
147+
" # get measurement results\n",
148148
" measurement_counts = result.measurement_counts\n",
149149
"\n",
150-
" # print measurment results\n",
150+
" # print measurement results\n",
151151
" print('measurement_counts:', measurement_counts)\n",
152152
"\n",
153153
" # bitstrings\n",

examples/hybrid_jobs/3_Bring_your_own_container/algorithm_script.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def main():
3030
print("Done.")
3131

3232
###################### QML ######################
33-
# Initialze and train the quantum model
33+
# Initialize and train the quantum model
3434
print("=" * 25 + " Training " + "=" * 25)
3535
qml_model = CCQC(nwires=9)
3636
opt = qml.AdamOptimizer(stepsize=0.1)

examples/hybrid_quantum_algorithms/QAOA/QAOA_braket.ipynb

+2-2
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@
362362
"# positions for all nodes\n",
363363
"pos = nx.spring_layout(G)\n",
364364
"\n",
365-
"# choose random weigths\n",
365+
"# choose random weights\n",
366366
"for (u, v) in G.edges():\n",
367367
" G.edges[u,v]['weight'] = random.uniform(0, 1)\n",
368368
"\n",
@@ -1069,7 +1069,7 @@
10691069
}
10701070
],
10711071
"source": [
1072-
"# example Ising matrix with edges between qubit 0 and qubit 1 (weigth=1) and qubit 1 and qubit 2 (weigth=3) \n",
1072+
"# example Ising matrix with edges between qubit 0 and qubit 1 (weight=1) and qubit 1 and qubit 2 (weight=3) \n",
10731073
"ising = np.array([[0, 1, 0], [0, 0, 3], [0, 0, 0]])\n",
10741074
"print('Ising matrix:\\n', ising)\n",
10751075
"\n",

examples/hybrid_quantum_algorithms/QAOA/utils_classical.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def build_classical_ising(J, N):
3737
def get_classical_energy_min(J, solution):
3838
"""
3939
function to return min energy for given classical solution of
40-
Ising Hamiltonian with two-body terms for weigthed graph
40+
Ising Hamiltonian with two-body terms for weighted graph
4141
NO SINGLE BIT TERMS, NO CONSTANT OFFSET
4242
"""
4343

examples/hybrid_quantum_algorithms/VQE_Chemistry/VQE_chemistry_braket.ipynb

+1-1
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,7 @@
522522
" Parameters:\n",
523523
" a_theta [float]: VQE parameter to be optimized\n",
524524
" Returns:\n",
525-
" ansatz_ckt [braket.Cicruit]: Ansatz circuit\n",
525+
" ansatz_ckt [braket.Circuit]: Ansatz circuit\n",
526526
" \"\"\"\n",
527527
" # Initialize HF state |0011>\n",
528528
" ansatz_ckt = Circuit().x(2).x(3)\n",

examples/quantum_annealing/Dwave_TravelingSalesmanProblem/Dwave_TravelingSalesmanProblem.ipynb

+4-4
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@
405405
}
406406
],
407407
"source": [
408-
"# show graph with weigths\n",
408+
"# show graph with weights\n",
409409
"plt.axis('off'); \n",
410410
"nx.draw_networkx(G, pos, with_labels=True);\n",
411411
"nx.draw_networkx_edge_labels(G, pos, edge_labels=weights);"
@@ -718,7 +718,7 @@
718718
}
719719
],
720720
"source": [
721-
"# show original graph with weigths\n",
721+
"# show original graph with weights\n",
722722
"plt.axis('off'); \n",
723723
"nx.draw_networkx(G, pos, with_labels=True, font_color='w');\n",
724724
"nx.draw_networkx_edge_labels(G, pos, edge_labels=weights);"
@@ -1037,7 +1037,7 @@
10371037
"edges = G.edges()\n",
10381038
"weights = nx.get_edge_attributes(G,'weight');\n",
10391039
"\n",
1040-
"# show graph with weigths\n",
1040+
"# show graph with weights\n",
10411041
"plt.figure(figsize=(10,10))\n",
10421042
"plt.axis('off'); \n",
10431043
"nx.draw_networkx(G, pos, with_labels=True);\n",
@@ -1571,7 +1571,7 @@
15711571
" The QUBO with ground states corresponding to a minimum travelling\n",
15721572
" salesperson route. The QUBO variables are labelled `(c, t)` where `c`\n",
15731573
" is a node in `G` and `t` is the time index. For instance, if `('a', 0)`\n",
1574-
" is 1 in the ground state, that means the node 'a' is visted first.\n",
1574+
" is 1 in the ground state, that means the node 'a' is visited first.\n",
15751575
"\n",
15761576
" \"\"\"\n",
15771577
" N = G.number_of_nodes()\n",

examples/quantum_annealing/Dwave_TravelingSalesmanProblem/utils_tsp.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@ def get_distance(route, data):
2222
return_distance = data[route[0]][route[-1]]
2323
# print('Distance between start and end:', return_distance)
2424

25-
# get distance for full cyle
25+
# get distance for full cycle
2626
distance_with_return = total_dist + return_distance
2727
print("Total distance (including return):", distance_with_return)
2828

2929
return total_dist, distance_with_return
3030

3131

3232
# helper function for solving TSP with D-Wave adapted from Ocean
33-
# including some heuristical filling if not all contraints have been met
33+
# including some heuristical filling if not all constraints have been met
3434
def traveling_salesperson(
3535
G, sampler=None, lagrange=None, weight="weight", start=None, **sampler_args
3636
):

test/notebook_tests/test_notebooks.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ def _rename_bucket(notebook_path, s3_bucket):
7878

7979

8080
def _check_exclusive_device_availability(notebook_path, region):
81-
for device, availabilty in _EXCLUSIVE_DEVICE_REGIONS.items():
82-
if region not in availabilty:
81+
for device, availability in _EXCLUSIVE_DEVICE_REGIONS.items():
82+
if region not in availability:
8383
with open(notebook_path) as file:
8484
for line in file:
8585
if device in line:

0 commit comments

Comments
 (0)