-
Notifications
You must be signed in to change notification settings - Fork 116
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
Add OTOC documentation #190
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've noted the "non optional" comments, other comments should be taken under advisement
This is pretty slow, but I guess it comes with the territory. It's also rather unfortunate that we use "meaningful indexing" where you have to sortof note what the various indices mean instead of nice dataclasses, but I understand that's how the code is written and it's outside the scope of this example to change it.
"Quantum scrambling describes how interaction in a quantum system disperses local information into its many degrees of freedom. Analogous to classical chaos, scrambling manifests itself as a [butterfly effect](https://en.wikipedia.org/wiki/Butterfly_effect) wherein a local perturbation is rapidly amplified over time. The perturbation is modeled by a local operator $\\hat{O}$ (the *butterfly operator*) acting on a qubit (the *butterfly qubit*). Under a dynamical process $\\hat{U} = \\hat{U}(t)$, the butterfly operator evolves in the Heisenberg picture as\n", | ||
"\n", | ||
"$$\n", | ||
"\\hat{O} (t) = \\hat{U}^\\dagger \\hat{O} \\hat{U}\n", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
kindof strange that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No change to match with arxiv paper
docs/otoc/otoc_example.ipynb
Outdated
"\n", | ||
"Note that if operator entanglement is also present ($n_p \\gg 1$), $\\bar{C}(t)$ approaches $0$ for all circuits and their fluctuation vanishes as well.\n", | ||
"\n", | ||
"In what follows, we show how to build OTOC circuits, run them & compute $\\bar{C}$, then visualize results and detect operator spreading." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit why do you use "&" once but "and" in other places
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed & -> and
docs/otoc/otoc_example.ipynb
Outdated
"if use_noisy_simulator or processor_id == \"\":\n", | ||
" print(\"Using a noisy simulator.\")\n", | ||
" sampler = cg.PhasedFSimEngineSimulator.create_with_random_gaussian_sqrt_iswap(\n", | ||
" mean=cg.SQRT_ISWAP_PARAMETERS,\n", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no such thing SQRT_ISWAP_PARAMETERS. Do you mean SQRT_ISWAP_INV_PARAMETERS
(non-optional)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed. (1st push was before Cirq 0.11 update)
}, | ||
"outputs": [], | ||
"source": [ | ||
"if not use_noisy_simulator:\n", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or processor_id == ""
[or fix it so use_noisy_simulator
is True if processor_id == ""]. (non optional)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed so use_noisy_simulator
is True if processor_id == ""
docs/otoc/otoc_example.ipynb
Outdated
"print(\"Measurement qubit:\", qubits[0])\n", | ||
"print(\"Butterfly qubit:\", q_b)\n", | ||
"\n", | ||
"print(\"\\nExample OTOC circuit:\\n\", otoc_circuits.butterfly_Y[0], sep=\"\\n\")" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
on my jupyter, whenever one does print(circuit)
it wraps horribly and you can't tell what's going on but if you just have the last line of the cell be circuit
it uses a horizontal scrollbar and I can actually read it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed to just circuit
instead of print(circuit)
docs/otoc/otoc_example.ipynb
Outdated
"for i, circuits_trial in enumerate(circuit_list):\n", | ||
" for j, circuits_cycle in enumerate(circuits_trial):\n", | ||
" for k, circuit_otoc in enumerate(circuits_cycle):\n", | ||
" circuit_list[i][j][k] = cg.optimized_for_sycamore(circuit_otoc, optimizer_type=\"sqrt_iswap\")" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this takes longer than expected on my machine. maybe print('.', end='')
just so there's some indication of progress
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this actually takes quite a long time. maybe we can throw multiprocessing at it or have a real progress bar?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a progress bar. Compiling is kind of a hack around #189 - ideally I think the desired behavior is that each circuit already has the right gates and no compiling is necessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok thanks for the additional information
should we remove the example script in favor of this notebook? |
Thanks @mpharrigan! Ready for round 2.
Probably? There's nothing in the example script that isn't in the notebook. |
Thanks @rmlarose If you want to remove the example script, we can do that in a follow-up PR! |
* Add tutorial + index. * Add to toc. * Review comments.
Adds a tutorial based on this example which shows how to recreate Fig 1 from the publication.