-
Notifications
You must be signed in to change notification settings - Fork 125
Add Circuit Generation Notebook for Discrete Time Crystal Experiments #251
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
Changes from 18 commits
f93cd08
08ef8a7
e5d91c7
bd8cf76
edee86b
924ec20
20304c1
4074275
5897f26
2873a73
9234092
0c27222
67d9b31
e38c475
066d5dc
2f45ee7
c59a240
6eca0a5
fdf7c0e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,160 @@ | ||
| { | ||
| "cells": [ | ||
| { | ||
| "cell_type": "code", | ||
| "execution_count": null, | ||
| "metadata": { | ||
| "id": "10a61b4d73a5" | ||
| }, | ||
| "outputs": [], | ||
| "source": [ | ||
| "# Copyright 2022 Google\n", | ||
| "#\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", | ||
| "# https://www.apache.org/licenses/LICENSE-2.0\n", | ||
| "#\n", | ||
| "# Unless required by applicable law or agreed to in writing, software\n", | ||
| "# distributed under the License is distributed on an \"AS IS\" BASIS,\n", | ||
| "# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n", | ||
| "# See the License for the specific language governing permissions and\n", | ||
| "# limitations under the License." | ||
| ] | ||
| }, | ||
| { | ||
| "cell_type": "markdown", | ||
| "metadata": { | ||
| "id": "7763e5d20492" | ||
| }, | ||
| "source": [ | ||
| "# Time Crystal Circuit Generation\n", | ||
| "This notebook covers how Many Body Local Discrete Time Crystal circuit lists are created, from the paper: Observation of Time-Crystalline Eigenstate Order on a Quantum Processor ([Nature](https://www.nature.com/articles/s41586-021-04257-w)). \n", | ||
| "\n", | ||
| "Quantum computers and gate-based quantum circuits turn out to be well suited for crafting systems that exhibit time-crystalline behavior. Behavior is crystalline with respect to time if it has some consistent and stable pattern over time. This system's pattern must be resilient against perturbation in the same way that a space-crystalline object, like a diamond, maintains it's structure (is still a diamond) if moved or heated. \n", | ||
| "\n", | ||
| "The quantum computer supplies a system of many qubits, locally connected to each other in a chain. A many-body local system like this is critical for the existence of a time crystal. Without an MBL system, it is expected that the system's state would decay into a maximum entropy state that is incompatible with the goal of stable and consistent time structure. \n", | ||
augustehirth marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| "\n", | ||
| "The time-crystalline behavior that the DTC circuits demonstrate is perhaps the simplest kind of time-structured behavior, oscillation. Each circuit is built with some number of identical $U$-cycles. Time is represented by a circuit list where each circuit is ordered with increasingly many $U$-cycles; each cycle is considered a discrete time step. The eventual effect of these $U$-cycles is consistent oscillations of each qubits' polarizations. The experiments performed demonstrate that this time-crystalline oscillation behavior is stable in spite of different initial states and introduced random potentials. " | ||
| ] | ||
| }, | ||
| { | ||
| "cell_type": "markdown", | ||
| "metadata": { | ||
| "id": "f53722cb0850" | ||
| }, | ||
| "source": [ | ||
| "## Setup" | ||
| ] | ||
| }, | ||
| { | ||
| "cell_type": "code", | ||
| "execution_count": null, | ||
| "metadata": { | ||
| "id": "0e4595827ec0" | ||
| }, | ||
| "outputs": [], | ||
| "source": [ | ||
| "!pip install cirq --quiet\n", | ||
| "try:\n", | ||
| " import recirq\n", | ||
| "except ImportError:\n", | ||
| " !pip install --quiet git+https://github.com/quantumlib/ReCirq" | ||
| ] | ||
| }, | ||
| { | ||
| "cell_type": "code", | ||
| "execution_count": null, | ||
| "metadata": { | ||
| "id": "e5e4f66e8e67" | ||
| }, | ||
| "outputs": [], | ||
| "source": [ | ||
| "import cirq\n", | ||
| "import recirq.time_crystals as time_crystals" | ||
| ] | ||
| }, | ||
| { | ||
| "cell_type": "markdown", | ||
| "metadata": { | ||
| "id": "a12b700f009e" | ||
| }, | ||
| "source": [ | ||
| "## Circuit Construction\n", | ||
| "Each DTC circuit is created with symbolic parameters. Parameter values are supplied near run/simulation time with a `cirq.ParamResolver`, which means the circuit list needs to be generated only once for potentially many different experimental parameter configurations. \n", | ||
| "\n", | ||
| "The code below uses an IPython-specific utility to inspect the code of the key function that creates the symbolic circuit list, `recirq.time_crystals.symbolic_dtc_circuit_list()`. " | ||
| ] | ||
| }, | ||
| { | ||
| "cell_type": "code", | ||
| "execution_count": null, | ||
| "metadata": { | ||
| "id": "c0f1c1475908" | ||
| }, | ||
| "outputs": [], | ||
| "source": [ | ||
| "import inspect\n", | ||
| "from IPython.display import Code\n", | ||
| "\n", | ||
| "Code(inspect.getsource(time_crystals.symbolic_dtc_circuit_list), language=\"python\")" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This seems weird to me that we are printing out the code as an output of the colab. I'll leave the decision up to you if you stil think this way is clearer, but I would consider linking to the source code with text such as "The code, which can be viewed here (link) is surprisingly succinct." There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My intent with printing the code was to provide a detailed example of how the circuits are constructed. Perhaps a couple step-by-step examples of each moment for a circuit of a few qubits would be a better example. I'll try this and see how it looks. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it's kinda neat 🤷 |
||
| ] | ||
| }, | ||
| { | ||
| "cell_type": "markdown", | ||
| "metadata": { | ||
| "id": "e13de6da1fc6" | ||
| }, | ||
| "source": [ | ||
| "The construction of each circuit is surprisingly succinct. \n", | ||
| "\n", | ||
| "The circuit expects the quantum computer to be in the all-zeros state, and starts with a sequence of `cirq.Y` gates conditioned on the provided `initial state` parameter, after initializing the necessary symbolic variables. \n", | ||
| "\n", | ||
| "Each $U$-cycle consists of three moments. First, a moment of `cirq.PhasedXZGate`s, with one for each qubit. Each `cirq.PhasedXZGate` takes the control parameter `g` as its X-exponent, and the random potentials necessary for many-body localization provided by `local_fields` for its Y-exponent.\n", | ||
| "\n", | ||
| "The second and third moments together both cause the oscillation behavior and compensate for the first disorder moment. The qubits are connected in a chain, and each qubit pair connection in that chain is coupled with a `cirq.PhasedFSimGate` that uses the parameters `[theta, zetas, chi, gamma, phi]`. To keep gates from overlapping on the same qubit, this chain of gates is split into the second and third moments, such that no two gates share a qubit within each moment. \n", | ||
| "\n", | ||
| "Finally, `symbolic_dtc_circuit_list()` builds and returns a list of circuits with $0,1,2,..., cycles$ many $U$-cycles in them. " | ||
| ] | ||
| }, | ||
| { | ||
| "cell_type": "code", | ||
| "execution_count": null, | ||
| "metadata": { | ||
| "id": "8397a5eab5f7" | ||
| }, | ||
| "outputs": [], | ||
| "source": [ | ||
| "qubits = [cirq.GridQubit(0, i) for i in range(4)]\n", | ||
| "circuit_list = time_crystals.symbolic_dtc_circuit_list(qubits, 2)\n", | ||
| "for circuit in circuit_list:\n", | ||
| " print(\"\\ncircuit of length \" + str(len(circuit)) + \"\\n\")\n", | ||
| " print(circuit)" | ||
| ] | ||
| }, | ||
| { | ||
| "cell_type": "markdown", | ||
| "metadata": { | ||
| "id": "3ba0e882df83" | ||
| }, | ||
| "source": [ | ||
| "After the initial line of `cirq.Y` gates, each consecutive circuit in the list has an additional cycle of `cirq.PhasedXZGate`s, followed by the chain of `cirq.PhasedFSimGate`s on alternating qubit pairs. Each cycle of three moments becomes one time step in the later analysis of stable oscillations over time. \n", | ||
| "\n", | ||
| "The next step is to perform experiments to collect evidence of the time-crystalline behavior of the quantum state's polarizations. See the [Time Crystal Data Collection](time_crystal_data_collection) notebook for the experiments, and the [Time Crystal Data Analysis](time_crystal_data_analysis) notebook for the graphed data and results. " | ||
| ] | ||
| } | ||
| ], | ||
| "metadata": { | ||
| "colab": { | ||
| "name": "time_crystal_circuit_generation.ipynb", | ||
| "toc_visible": true | ||
| }, | ||
| "kernelspec": { | ||
| "display_name": "Python 3", | ||
| "name": "python3" | ||
| } | ||
| }, | ||
| "nbformat": 4, | ||
| "nbformat_minor": 0 | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.