From 15e1ed1e9532452c81651aa25dfa78bd43b28043 Mon Sep 17 00:00:00 2001 From: Tanuj Khattar Date: Fri, 8 Apr 2022 23:49:41 +0530 Subject: [PATCH] Fix qcvv/xeb_theory.ipynb as part of docs cleanup for Cirq 1.0 (#5202) * Moved import to top * Fixed broken link to quantum ai website * Minor improvements in text formatting --- docs/qcvv/xeb_theory.ipynb | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/docs/qcvv/xeb_theory.ipynb b/docs/qcvv/xeb_theory.ipynb index cbca2ddc66b..f25894c043c 100644 --- a/docs/qcvv/xeb_theory.ipynb +++ b/docs/qcvv/xeb_theory.ipynb @@ -1,14 +1,5 @@ { "cells": [ - { - "cell_type": "markdown", - "metadata": { - "id": "SzKwuqYESWwm" - }, - "source": [ - "##### Copyright 2021 The Cirq Developers" - ] - }, { "cell_type": "code", "execution_count": null, @@ -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", @@ -39,7 +31,7 @@ "source": [ "\n", " \n", "
\n", - " \">View on QuantumAI\n", + " View on QuantumAI\n", " \n", " Run in Google Colab\n", @@ -66,6 +58,7 @@ "except ImportError:\n", " print(\"installing cirq...\")\n", " !pip install --quiet cirq\n", + " import cirq\n", " print(\"installed cirq.\")" ] }, @@ -90,7 +83,6 @@ "source": [ "# Standard imports\n", "import numpy as np\n", - "import cirq\n", "\n", "from cirq.contrib.svg import SVGCircuit" ] @@ -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." ] }, { @@ -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." ] }, { @@ -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",