|
1 | 1 | {
|
2 | 2 | "cells": [
|
3 |
| - { |
4 |
| - "cell_type": "markdown", |
5 |
| - "metadata": { |
6 |
| - "id": "SzKwuqYESWwm" |
7 |
| - }, |
8 |
| - "source": [ |
9 |
| - "##### Copyright 2021 The Cirq Developers" |
10 |
| - ] |
11 |
| - }, |
12 | 3 | {
|
13 | 4 | "cell_type": "code",
|
14 | 5 | "execution_count": null,
|
|
18 | 9 | },
|
19 | 10 | "outputs": [],
|
20 | 11 | "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", |
22 | 14 | "# you may not use this file except in compliance with the License.\n",
|
23 | 15 | "# You may obtain a copy of the License at\n",
|
24 | 16 | "#\n",
|
|
39 | 31 | "source": [
|
40 | 32 | "<table class=\"tfo-notebook-buttons\" align=\"left\">\n",
|
41 | 33 | " <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", |
43 | 35 | " </td>\n",
|
44 | 36 | " <td>\n",
|
45 | 37 | " <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 | 58 | "except ImportError:\n",
|
67 | 59 | " print(\"installing cirq...\")\n",
|
68 | 60 | " !pip install --quiet cirq\n",
|
| 61 | + " import cirq\n", |
69 | 62 | " print(\"installed cirq.\")"
|
70 | 63 | ]
|
71 | 64 | },
|
|
90 | 83 | "source": [
|
91 | 84 | "# Standard imports\n",
|
92 | 85 | "import numpy as np\n",
|
93 |
| - "import cirq\n", |
94 | 86 | "\n",
|
95 | 87 | "from cirq.contrib.svg import SVGCircuit"
|
96 | 88 | ]
|
|
125 | 117 | },
|
126 | 118 | "source": [
|
127 | 119 | "### 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", |
129 | 121 | "\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." |
131 | 123 | ]
|
132 | 124 | },
|
133 | 125 | {
|
|
166 | 158 | "source": [
|
167 | 159 | "### Random circuit\n",
|
168 | 160 | "\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." |
170 | 162 | ]
|
171 | 163 | },
|
172 | 164 | {
|
|
291 | 283 | " trunc_circuit = circuit[:circuit_depth]\n",
|
292 | 284 | "\n",
|
293 | 285 | " # 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", |
296 | 287 | " pure_probs = np.abs(psi)**2\n",
|
297 | 288 | "\n",
|
298 | 289 | " # Noisy execution\n",
|
|
0 commit comments