Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix qcvv/xeb_theory.ipynb as part of docs cleanup for Cirq 1.0 #5202

Merged
merged 2 commits into from
Apr 8, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
{
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this renders strange in reviewnb.com (<span style...>). Could you confirm this is fine elsewhere?


Reply via ReviewNB

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it renders strange only in the diff between old and new in the revewnb notebook. See the attached screenshot for a standalone view.

I can confirm that it renders as expected in jupyter / colab.

"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