Skip to content

Commit

Permalink
Docs nits (#3545)
Browse files Browse the repository at this point in the history
Docs nits: latex, nav formatting, header capitalizations.
  • Loading branch information
balopat committed Nov 30, 2020
1 parent a61e51b commit 556dcda
Show file tree
Hide file tree
Showing 8 changed files with 49 additions and 32 deletions.
2 changes: 1 addition & 1 deletion docs/_book.yaml
Expand Up @@ -117,7 +117,7 @@ upper_tabs:
- name: "Tutorials"
contents:
#### OVERVIEW ####
- title: "Cirq tutorials and examples"
- title: "Tutorials and examples"
path: /cirq/tutorials/index

#### BEGINNER ####
Expand Down
6 changes: 3 additions & 3 deletions docs/gates.ipynb
Expand Up @@ -254,11 +254,11 @@
"\n",
"**cirq.rz(rads)** A rotation about the Pauli 'Z' axis in terms of radians. This is equivalent to `exp(-i Z rads / 2) = cos(rads/2) I - i sin(rads/2) Z`\n",
"\n",
"**cirq.XPowGate(exponent=t)** Rotations about the Pauli ``X`` axis, equivalent to ``cirq.X**t``. See [XPowGate](https://cirq.readthedocs.io/en/latest/generated/cirq.XPowGate.html) for its unitary matrix. Note that this has a global phase of e^{i·π·t/2} versus the traditionally defined rotation matrix, which can be modified by the optional parameter `global_shift`.\n",
"**cirq.XPowGate(exponent=t)** Rotations about the Pauli ``X`` axis, equivalent to ``cirq.X**t``. See [XPowGate](https://cirq.readthedocs.io/en/latest/generated/cirq.XPowGate.html) for its unitary matrix. Note that this has a global phase of $e^{i·π·t/2}$ versus the traditionally defined rotation matrix, which can be modified by the optional parameter `global_shift`.\n",
"\n",
"**cirq.YPowGate(exponent=t)** Rotations about the Pauli ``Y`` axis, equivalent to ``cirq.Y**t``. See [YPowGate](https://cirq.readthedocs.io/en/latest/generated/cirq.YPowGate.html) for its unitary matrix. Note that this has a global phase of e^{i·π·t/2} versus the traditionally defined rotation matrix, which can be modified by the optional parameter `global_shift`.\n",
"**cirq.YPowGate(exponent=t)** Rotations about the Pauli ``Y`` axis, equivalent to ``cirq.Y**t``. See [YPowGate](https://cirq.readthedocs.io/en/latest/generated/cirq.YPowGate.html) for its unitary matrix. Note that this has a global phase of $e^{i·π·t/2}$ versus the traditionally defined rotation matrix, which can be modified by the optional parameter `global_shift`.\n",
"\n",
"**cirq.ZPowGate(exponent=t)** Rotations about the Pauli ``Z`` axis, equivalent to ``cirq.Z**t``. See [ZPowGate](https://cirq.readthedocs.io/en/latest/generated/cirq.ZPowGate.html) for its unitary matrix. Note that this has a global phase of e^{i·π·t/2} versus the traditionally defined rotation matrix, which can be modified by the optional parameter `global_shift`.\n",
"**cirq.ZPowGate(exponent=t)** Rotations about the Pauli ``Z`` axis, equivalent to ``cirq.Z**t``. See [ZPowGate](https://cirq.readthedocs.io/en/latest/generated/cirq.ZPowGate.html) for its unitary matrix. Note that this has a global phase of $e^{i·π·t/2}$ versus the traditionally defined rotation matrix, which can be modified by the optional parameter `global_shift`.\n",
"\n",
"**cirq.PhasedXPowGate**\n",
"This gate is a rotation about an axis in the XY plane of the Bloch sphere.\n",
Expand Down
2 changes: 1 addition & 1 deletion docs/install.md
@@ -1,4 +1,4 @@
# Installing Cirq
# Install

Choose your operating system:

Expand Down
11 changes: 9 additions & 2 deletions docs/start.md
Expand Up @@ -34,13 +34,20 @@ Example output:

# Learn more about quantum computing

In case you would like to learn more about Quantum Computing, check out our [education page](https://quantumai.google/education).
In case you would like to learn more about Quantum Computing, check out our [education page](/education).

# Hardware vs simulation

There are two main ways of running quantum algorithms using Cirq:
- [Simulation](simulation.ipynb) is available on any computer
- [Simulation](simulation.ipynb) is available on any computer.
- Quantum processors are provided by different Quantum Service Providers:
- [Google Quantum Computing Service](tutorials/google/start.ipynb)
- [Alpine Quantum Technologies](tutorials/aqt/getting_started.ipynb)
- [Pasqal](tutorials/pasqal/getting_started.ipynb)

# Next steps

- Learn about the [Basics](tutorials/basics.ipynb) of Cirq, like the Circuit, Qubit and Simulator classes and how to use them.
- Explore all the numerous [Tutorials and examples](tutorials).
- Check out the [API docs](/reference/python/cirq).
- Learn more about the Cirq concepts in-depth in our guides.
40 changes: 20 additions & 20 deletions docs/tutorials/_index.yaml
Expand Up @@ -18,17 +18,17 @@ landing_page:
- heading: Intermediate
description: Use Cirq for intermediate-level subroutines and algorithms.
items:
- heading: Quantum Variational Algorithm
- heading: Quantum variational algorithm
description: Use the variational quantum eigensolver to find the ground state of the Ising model.
path: /cirq/tutorials/variational_algorithm
icon:
name: menu_book
- heading: Approximate Optimization
- heading: Approximate optimization
description: Use a quantum computer to find approximately optimal cuts in a graph.
path: /cirq/tutorials/qaoa
icon:
name: menu_book
- heading: Quantum Walks
- heading: Quantum walks
description: Demonstration of classical and quantum random walks on a graph.
path: /cirq/tutorials/quantum_walks
icon:
Expand All @@ -38,17 +38,17 @@ landing_page:
- heading: Advanced
description: Utilize Cirq features to implement advanced quantum algorithms.
items:
- heading: Hidden Linear Function
- heading: Hidden linear function problem
description: Find a hidden vector with a constant depth quantum circuit.
path: /cirq/tutorials/hidden_linear_function
icon:
name: menu_book
- heading: Rabi Oscillation
- heading: Rabi oscillation experiment
description: Example of using sweeps and symbols to show rotation of a qubit by different angles.
path: /cirq/tutorials/rabi_oscillations
icon:
name: menu_book
- heading: Shor's Algorithm
- heading: Shor's algorithm
description: Factor numbers using a quantum computer.
path: /cirq/tutorials/shor
icon:
Expand All @@ -59,24 +59,24 @@ landing_page:

- heading: Beginner
items:
- heading: Hello Qubit
- heading: Hello qubit
description: Simple first program showing how to create a quantum circuit.
path: https://github.com/quantumlib/Cirq/blob/master/examples/hello_qubit.py
icon:
name: code

- heading: Deutsch's Algorithm
- heading: Deutsch's algorithm
description: Textbook example of the simplest quantum advantage.
path: https://github.com/quantumlib/Cirq/blob/master/examples/deutsch.py
icon:
name: code
- heading: Bernstein-Vazirani Algorithm
- heading: Bernstein-Vazirani algorithm
description: Textbook algorithm determining a global property of a function with surprisingly few calls to it.
path: https://github.com/quantumlib/Cirq/blob/master/examples/bernstein_vazirani.py
icon:
name: code

- heading: Bell Inequality
- heading: Bell inequality
description: Demonstration of a Bell inequality which shows impossibility of local hidden variable theories.
path: https://github.com/quantumlib/Cirq/blob/master/examples/bell_inequality.py
icon:
Expand All @@ -86,24 +86,24 @@ landing_page:
path: https://github.com/quantumlib/Cirq/blob/master/examples/bb84.py
icon:
name: code
- heading: Noisy Simulation
- heading: Noisy simulation
description: How to use a noisy simulator to execute quantum circuits.
path: https://github.com/quantumlib/Cirq/blob/master/examples/noisy_simulation_example.py
icon:
name: code

- heading: Qubit Placement
- heading: Qubit placement
description: How to find a line of adjacent qubits on a device.
path: https://github.com/quantumlib/Cirq/blob/master/examples/place_on_bristlecone.py
icon:
name: code
- heading: Quantum Teleportation
- heading: Quantum teleportation
description: A demonstration of using 2 classical bits to transport a quantum state from one
qubit to another.
path: https://github.com/quantumlib/Cirq/blob/master/examples/quantum_teleportation.py
icon:
name: code
- heading: Superdense Coding
- heading: Superdense coding
description: Transmit 2 classical bits using one quantum bit.
path: https://github.com/quantumlib/Cirq/blob/master/examples/superdense_coding.py
icon:
Expand All @@ -116,36 +116,36 @@ landing_page:
path: https://github.com/quantumlib/Cirq/blob/master/examples/basic_arithmetic.py
icon:
name: code
- heading: Grover's Algorithm
- heading: Grover's algorithm
description: Use a quantum computer to find a needle in a haystack.
path: https://github.com/quantumlib/Cirq/blob/master/examples/grover.py
icon:
name: code

- heading: Shor's Code
- heading: Shor's code
description: Quantum error correction with Shor's nine-qubit code.
path: https://github.com/quantumlib/Cirq/blob/master/examples/shors_code.py
icon:
name: code
- heading: Quantum Fourier Transform
- heading: Quantum Fourier transform
description: Change from the computational basis to the frequency basis and vice versa.
path: https://github.com/quantumlib/Cirq/blob/master/examples/quantum_fourier_transform.py
icon:
name: code
- heading: Phase Estimation
- heading: Phase estimation
description: Find the eigenvalues of a unitary operator.
path: https://github.com/quantumlib/Cirq/blob/master/examples/phase_estimator.py
icon:
name: code
- heading: Swap Networks
- heading: Swap networks
description: Algorithm for efficiently emulating full connectivity on a limited connectivity grid of qubits.
path: https://github.com/quantumlib/Cirq/blob/master/examples/swap_networks.py
icon:
name: code

- heading: Advanced
items:
- heading: Direct Fidelity
- heading: Direct fidelity estimation
description: Direct fidelity estimation to distinguish a desired state fromt he actual state using few Pauli measurements.
path: https://github.com/quantumlib/Cirq/blob/master/examples/direct_fidelity_estimation.py
icon:
Expand Down
4 changes: 2 additions & 2 deletions docs/tutorials/qaoa.ipynb
Expand Up @@ -286,9 +286,9 @@
"## 3. Calculating the expected value of the QAOA cost Hamiltonian\n",
"Now that we have created a parameterized QAOA circuit, we need a way to calculate expectation values of the cost Hamiltonian. For Max-Cut, the cost Hamiltonian is\n",
"\n",
"\\begin{equation}\n",
"$$\n",
" H_C = \\frac{1}{2} \\sum_{\\langle i, j\\rangle} w_{ij} (1 - Z_i Z_j )\n",
"\\end{equation}\n",
"$$\n",
"\n",
"where $\\langle i, j \\rangle$ denotes neighboring qubits, $w_{ij}$ is the weight of edge $ij$, and $Z$ is the usual Pauli-$Z$ matrix. The expectation value of this cost Hamiltonian is $\\langle \\alpha, \\beta | H_C | \\alpha, \\beta \\rangle$ where $|\\alpha, \\beta\\rangle$ is the quantum state prepared by our `qaoa_circuit`. This is the cost function we need to estimate.\n",
"\n",
Expand Down
6 changes: 3 additions & 3 deletions docs/tutorials/variational_algorithm.ipynb
Expand Up @@ -106,13 +106,13 @@
"\n",
"Consider the energy function\n",
"\n",
"$E(s_1,\\dots,s_n) = \\sum_{<i,j>} J_{i,j}s_i s_j + \\sum_i h_i s_i$\n",
"$E(s_1,\\dots,s_n) = \\sum_{\\langle i,j \\rangle} J_{i,j}s_i s_j + \\sum_i h_i s_i$\n",
"\n",
"where here each $s_i, J_{i,j}$, and $h_i$ are either +1 or -1. Here each index i is associated with a bit on a square lattice, and the $<i,j>$ notation means sums over neighboring bits on this lattice. The problem we would like to solve is, given $J_{i,j}$, and $h_i$, find an assignment of $s_i$ values that minimize $E$.\n",
"where here each $s_i, J_{i,j}$, and $h_i$ are either +1 or -1. Here each index i is associated with a bit on a square lattice, and the $\\langle i,j \\rangle$ notation means sums over neighboring bits on this lattice. The problem we would like to solve is, given $J_{i,j}$, and $h_i$, find an assignment of $s_i$ values that minimize $E$.\n",
"\n",
"How does a variational quantum algorithm work for this? One approach is to consider $n$ qubits and associate them with each of the bits in the classical problem. This maps the classical problem onto the quantum problem of minimizing the expectation value of the observable\n",
"\n",
"$H=\\sum_{<i,j>} J_{i,j} Z_i Z_j + \\sum_i h_iZ_i$\n",
"$H=\\sum_{\\langle i,j \\rangle} J_{i,j} Z_i Z_j + \\sum_i h_iZ_i$\n",
"\n",
"Then one defines a set of parameterized quantum circuits, i.e., a quantum circuit where the gates (or more general quantum operations) are parameterized by some values. This produces an ansatz state\n",
"\n",
Expand Down
10 changes: 10 additions & 0 deletions rtd_docs/conf.py
Expand Up @@ -40,6 +40,7 @@ def setup(app):
app.connect('autodoc-process-docstring', autodoc_process)
app.connect('autodoc-skip-member', autodoc_skip_member)
app.connect('source-read', source_read)
app.connect('missing-reference', on_missing_reference)


def convert_markdown_mathjax_for_rst(lines: List[str]) -> List[str]:
Expand Down Expand Up @@ -295,3 +296,12 @@ def source_read(app, docname, source):
# To allow for google.colab temporarily in notebooks
# TODO: after https://github.com/quantumlib/Cirq/issues/3368 turn this back off
nbsphinx_allow_errors = True

devsite_only_links = ["tutorials", "/education", "/reference/python/cirq"]


def on_missing_reference(app, env, node, contnode):
if node['reftarget'] in devsite_only_links:
return contnode
else:
return None

0 comments on commit 556dcda

Please sign in to comment.