|
| 1 | +{ |
| 2 | + "cells": [ |
| 3 | + { |
| 4 | + "cell_type": "markdown", |
| 5 | + "metadata": { |
| 6 | + "id": "gXXhctqjgXO7" |
| 7 | + }, |
| 8 | + "source": [ |
| 9 | + "##### Copyright 2022 The Cirq Developers" |
| 10 | + ] |
| 11 | + }, |
| 12 | + { |
| 13 | + "cell_type": "code", |
| 14 | + "execution_count": null, |
| 15 | + "metadata": { |
| 16 | + "cellView": "form", |
| 17 | + "id": "z2RJVa8qgXou" |
| 18 | + }, |
| 19 | + "outputs": [], |
| 20 | + "source": [ |
| 21 | + "#@title Licensed under the Apache License, Version 2.0 (the \"License\");\n", |
| 22 | + "# you may not use this file except in compliance with the License.\n", |
| 23 | + "# You may obtain a copy of the License at\n", |
| 24 | + "#\n", |
| 25 | + "# https://www.apache.org/licenses/LICENSE-2.0\n", |
| 26 | + "#\n", |
| 27 | + "# Unless required by applicable law or agreed to in writing, software\n", |
| 28 | + "# distributed under the License is distributed on an \"AS IS\" BASIS,\n", |
| 29 | + "# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n", |
| 30 | + "# See the License for the specific language governing permissions and\n", |
| 31 | + "# limitations under the License." |
| 32 | + ] |
| 33 | + }, |
| 34 | + { |
| 35 | + "cell_type": "markdown", |
| 36 | + "metadata": { |
| 37 | + "id": "EQvWLKKRgZR9" |
| 38 | + }, |
| 39 | + "source": [ |
| 40 | + "# Hello Qubit" |
| 41 | + ] |
| 42 | + }, |
| 43 | + { |
| 44 | + "cell_type": "markdown", |
| 45 | + "metadata": { |
| 46 | + "id": "EvZ_JecKga2p" |
| 47 | + }, |
| 48 | + "source": [ |
| 49 | + "<table class=\"tfo-notebook-buttons\" align=\"left\">\n", |
| 50 | + " <td>\n", |
| 51 | + " <a target=\"_blank\" href=\"https://quantumai.google/cirq/start\"><img src=\"https://quantumai.google/site-assets/images/buttons/quantumai_logo_1x.png\" />View on QuantumAI</a>\n", |
| 52 | + " </td>\n", |
| 53 | + " <td>\n", |
| 54 | + " <a target=\"_blank\" href=\"https://colab.research.google.com/github/quantumlib/Cirq/blob/master/docs/start.ipynb\"><img src=\"https://quantumai.google/site-assets/images/buttons/colab_logo_1x.png\" />Run in Google Colab</a>\n", |
| 55 | + " </td>\n", |
| 56 | + " <td>\n", |
| 57 | + " <a target=\"_blank\" href=\"https://github.com/quantumlib/Cirq/blob/master/docs/start.ipynb\"><img src=\"https://quantumai.google/site-assets/images/buttons/github_logo_1x.png\" />View source on GitHub</a>\n", |
| 58 | + " </td>\n", |
| 59 | + " <td>\n", |
| 60 | + " <a href=\"https://storage.googleapis.com/tensorflow_docs/Cirq/docs/start.ipynb\"><img src=\"https://quantumai.google/site-assets/images/buttons/download_icon_1x.png\" />Download notebook</a>\n", |
| 61 | + " </td>\n", |
| 62 | + "</table>" |
| 63 | + ] |
| 64 | + }, |
| 65 | + { |
| 66 | + "cell_type": "code", |
| 67 | + "execution_count": null, |
| 68 | + "metadata": { |
| 69 | + "id": "bd9529db1c0b" |
| 70 | + }, |
| 71 | + "outputs": [], |
| 72 | + "source": [ |
| 73 | + "try:\n", |
| 74 | + " import cirq\n", |
| 75 | + "except ImportError:\n", |
| 76 | + " print(\"installing cirq...\")\n", |
| 77 | + " !pip install --quiet cirq\n", |
| 78 | + " import cirq\n", |
| 79 | + " print(\"installed cirq.\")" |
| 80 | + ] |
| 81 | + }, |
| 82 | + { |
| 83 | + "cell_type": "code", |
| 84 | + "execution_count": null, |
| 85 | + "metadata": { |
| 86 | + "id": "n4GQUN8MS7vt" |
| 87 | + }, |
| 88 | + "outputs": [], |
| 89 | + "source": [ |
| 90 | + "# Pick a qubit.\n", |
| 91 | + "qubit = cirq.GridQubit(0, 0)\n", |
| 92 | + "\n", |
| 93 | + "# Create a circuit\n", |
| 94 | + "circuit = cirq.Circuit(\n", |
| 95 | + " cirq.X(qubit)**0.5, # Square root of NOT.\n", |
| 96 | + " cirq.measure(qubit, key='m') # Measurement.\n", |
| 97 | + ")\n", |
| 98 | + "print(\"Circuit:\")\n", |
| 99 | + "print(circuit)\n", |
| 100 | + "\n", |
| 101 | + "# Simulate the circuit several times.\n", |
| 102 | + "simulator = cirq.Simulator()\n", |
| 103 | + "result = simulator.run(circuit, repetitions=20)\n", |
| 104 | + "print(\"Results:\")\n", |
| 105 | + "print(result)" |
| 106 | + ] |
| 107 | + }, |
| 108 | + { |
| 109 | + "cell_type": "markdown", |
| 110 | + "metadata": { |
| 111 | + "id": "shNBShuQTFuu" |
| 112 | + }, |
| 113 | + "source": [ |
| 114 | + "# Congratulations\n", |
| 115 | + "You've just run your first Cirq program. If you would like to learn more about Quantum Computing, check out our [education page](/education). You can find more in depth tutorials [here](tutorials). The Full API reference for Cirq can be found [here]((/reference/python/cirq). If you are looking for vendor specific information that can be found on our vendor sub-pages:\n", |
| 116 | + "\n", |
| 117 | + "\n", |
| 118 | + " [Google Quantum Computing Service](tutorials/google/start.ipynb)\n", |
| 119 | + " \n", |
| 120 | + " [Alpine Quantum Technologies](tutorials/aqt/getting_started.ipynb)\n", |
| 121 | + " \n", |
| 122 | + " [Pasqal](tutorials/pasqal/getting_started.ipynb)\n", |
| 123 | + " \n", |
| 124 | + " [IonQ](tutorials/ionq/getting_started.ipynb)\n", |
| 125 | + " \n", |
| 126 | + " [Azure](tutorials/azure-quantum/getting_started_honeywell.ipynb)\n", |
| 127 | + " \n", |
| 128 | + " [Rigetti](tutorials/rigetti/getting_started.ipynb)" |
| 129 | + ] |
| 130 | + } |
| 131 | + ], |
| 132 | + "metadata": { |
| 133 | + "colab": { |
| 134 | + "name": "start.ipynb", |
| 135 | + "toc_visible": true |
| 136 | + }, |
| 137 | + "kernelspec": { |
| 138 | + "display_name": "Python 3", |
| 139 | + "name": "python3" |
| 140 | + } |
| 141 | + }, |
| 142 | + "nbformat": 4, |
| 143 | + "nbformat_minor": 0 |
| 144 | +} |
0 commit comments