Skip to content

Commit 07f6cb4

Browse files
tanujkhattartonybruguier
authored andcommitted
Fix qcvv/xeb_theory.ipynb as part of docs cleanup for Cirq 1.0 (quantumlib#5202)
* Moved import to top * Fixed broken link to quantum ai website * Minor improvements in text formatting
1 parent 54749fa commit 07f6cb4

File tree

1 file changed

+8
-17
lines changed

1 file changed

+8
-17
lines changed

docs/qcvv/xeb_theory.ipynb

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,5 @@
11
{
22
"cells": [
3-
{
4-
"cell_type": "markdown",
5-
"metadata": {
6-
"id": "SzKwuqYESWwm"
7-
},
8-
"source": [
9-
"##### Copyright 2021 The Cirq Developers"
10-
]
11-
},
123
{
134
"cell_type": "code",
145
"execution_count": null,
@@ -18,7 +9,8 @@
189
},
1910
"outputs": [],
2011
"source": [
21-
"#@title Licensed under the Apache License, Version 2.0 (the \"License\");\n",
12+
"#@title Copyright 2021 The Cirq Developers\n",
13+
"# Licensed under the Apache License, Version 2.0 (the \"License\");\n",
2214
"# you may not use this file except in compliance with the License.\n",
2315
"# You may obtain a copy of the License at\n",
2416
"#\n",
@@ -39,7 +31,7 @@
3931
"source": [
4032
"<table class=\"tfo-notebook-buttons\" align=\"left\">\n",
4133
" <td>\n",
42-
" <a target=\"_blank\" href=\"https://quantumai.google/cirq/qcvv/xeb_theory>\"><img src=\"https://quantumai.google/site-assets/images/buttons/quantumai_logo_1x.png\" />View on QuantumAI</a>\n",
34+
" <a target=\"_blank\" href=\"https://quantumai.google/cirq/qcvv/xeb_theory\"><img src=\"https://quantumai.google/site-assets/images/buttons/quantumai_logo_1x.png\" />View on QuantumAI</a>\n",
4335
" </td>\n",
4436
" <td>\n",
4537
" <a target=\"_blank\" href=\"https://colab.research.google.com/github/quantumlib/Cirq/blob/master/docs/qcvv/xeb_theory.ipynb\"><img src=\"https://quantumai.google/site-assets/images/buttons/colab_logo_1x.png\" />Run in Google Colab</a>\n",
@@ -66,6 +58,7 @@
6658
"except ImportError:\n",
6759
" print(\"installing cirq...\")\n",
6860
" !pip install --quiet cirq\n",
61+
" import cirq\n",
6962
" print(\"installed cirq.\")"
7063
]
7164
},
@@ -90,7 +83,6 @@
9083
"source": [
9184
"# Standard imports\n",
9285
"import numpy as np\n",
93-
"import cirq\n",
9486
"\n",
9587
"from cirq.contrib.svg import SVGCircuit"
9688
]
@@ -125,9 +117,9 @@
125117
},
126118
"source": [
127119
"### Possible single-qubit rotations\n",
128-
"These 8*8 possible rotations are chosen randomly when constructing the circuit.\n",
120+
"Geometrically, we choose 8 axes in the XY plane to perform a quarter-turn (pi/2 rotation) around. This is followed by a rotation around the Z axis of 8 different magnitudes.\n",
129121
"\n",
130-
"Geometrically, we choose 8 axes in the XY plane to perform a quarter-turn (pi/2 rotation) around. This is followed by a rotation around the Z axis of 8 different magnitudes."
122+
"These 8*8 possible rotations are chosen randomly when constructing the circuit."
131123
]
132124
},
133125
{
@@ -166,7 +158,7 @@
166158
"source": [
167159
"### Random circuit\n",
168160
"\n",
169-
"We use `random_rotations_between_two_qubit_circuit` to generate a random two-qubit circuit. Note that we provide the possible single-qubit rotations from above and declare that our two-qubit operation is the $\\sqrt{i\\mathrm{SWAP}}$ gate."
161+
"We use `cirq.experiments.random_quantum_circuit_generation.random_rotations_between_two_qubit_circuit` to generate a random two-qubit circuit. Note that we provide the possible single-qubit rotations from above and declare that our two-qubit operation is the $\\sqrt{i\\mathrm{SWAP}}$ gate."
170162
]
171163
},
172164
{
@@ -291,8 +283,7 @@
291283
" trunc_circuit = circuit[:circuit_depth]\n",
292284
"\n",
293285
" # Pure-state simulation\n",
294-
" psi = pure_sim.simulate(trunc_circuit)\n",
295-
" psi = psi.final_state_vector\n",
286+
" psi = pure_sim.simulate(trunc_circuit).final_state_vector\n",
296287
" pure_probs = np.abs(psi)**2\n",
297288
"\n",
298289
" # Noisy execution\n",

0 commit comments

Comments
 (0)