Skip to content

Commit

Permalink
Fix qcvv/xeb_theory.ipynb as part of docs cleanup for Cirq 1.0 (quant…
Browse files Browse the repository at this point in the history
…umlib#5202)

* Moved import to top
* Fixed broken link to quantum ai website
* Minor improvements in text formatting
  • Loading branch information
tanujkhattar authored and rht committed May 1, 2023
1 parent 43bdabd commit 02a1086
Showing 1 changed file with 8 additions and 17 deletions.
25 changes: 8 additions & 17 deletions docs/qcvv/xeb_theory.ipynb
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {
"id": "SzKwuqYESWwm"
},
"source": [
"##### Copyright 2021 The Cirq Developers"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand All @@ -18,7 +9,8 @@
},
"outputs": [],
"source": [
"#@title Licensed under the Apache License, Version 2.0 (the \"License\");\n",
"#@title Copyright 2021 The Cirq Developers\n",
"# Licensed under the Apache License, Version 2.0 (the \"License\");\n",
"# you may not use this file except in compliance with the License.\n",
"# You may obtain a copy of the License at\n",
"#\n",
Expand All @@ -39,7 +31,7 @@
"source": [
"<table class=\"tfo-notebook-buttons\" align=\"left\">\n",
" <td>\n",
" <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",
" <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",
" </td>\n",
" <td>\n",
" <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",
Expand All @@ -66,6 +58,7 @@
"except ImportError:\n",
" print(\"installing cirq...\")\n",
" !pip install --quiet cirq\n",
" import cirq\n",
" print(\"installed cirq.\")"
]
},
Expand All @@ -90,7 +83,6 @@
"source": [
"# Standard imports\n",
"import numpy as np\n",
"import cirq\n",
"\n",
"from cirq.contrib.svg import SVGCircuit"
]
Expand Down Expand Up @@ -125,9 +117,9 @@
},
"source": [
"### Possible single-qubit rotations\n",
"These 8*8 possible rotations are chosen randomly when constructing the circuit.\n",
"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",
"\n",
"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."
"These 8*8 possible rotations are chosen randomly when constructing the circuit."
]
},
{
Expand Down Expand Up @@ -166,7 +158,7 @@
"source": [
"### Random circuit\n",
"\n",
"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."
"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."
]
},
{
Expand Down Expand Up @@ -291,8 +283,7 @@
" trunc_circuit = circuit[:circuit_depth]\n",
"\n",
" # Pure-state simulation\n",
" psi = pure_sim.simulate(trunc_circuit)\n",
" psi = psi.final_state_vector\n",
" psi = pure_sim.simulate(trunc_circuit).final_state_vector\n",
" pure_probs = np.abs(psi)**2\n",
"\n",
" # Noisy execution\n",
Expand Down

0 comments on commit 02a1086

Please sign in to comment.