-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Docs site rebase #3209
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
Docs site rebase #3209
Conversation
All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the ℹ️ Googlers: Go here for more info. |
* Added api docs gen (copy from TFQ). * updated site_path prefix. * removed pre-built. * rename. * move to dev_tools. * removed __future__ and formatting. * yet more formatting. * typo.
- Also adds `CircuitDiagramInfoArgs.format_complex` ``` 0: ───PauliString(+X)───PauliString(-X)───PauliString(+X)───PauliString(iX)─── │ │ 1: ───────────────────────────────────────┼─────────────────Y───────────────── │ 2: ───────────────────────────────────────Z─────────────────────────────────── ```
…3093) - This resulted in some circuits with random behavior giving long lists of identical samples when repeated - Change the general strategy used by the simulator to one of extracting a unitary prefix that can be cached, and then looking at the rest to decide whether sampling can be done efficiently or not
…tion (#3095) This was such a dumb mistake for me to make.
This copies changes from #2811 into the Jupyter notebook.
The "rekey" operation is useful for some circuit transformations we want to implement. Defining it on the MeasurementGate ensures that all the gate properties get copied properly when rekeying. Review: @balopat
…auliString) (#3125) - I compared against results from WolframAlpha to make sure the modified tests are now correct
* Add batch support to cirq Engine client - Adds a run_batch() call to engine that can handle lists of circuits and lists of programs. - Creates BatchProgram and BatchRunContext objects. - Pipes the objects through engine program and engine job.
- Also fix ZPowGate and PhasedXPowGate not supporting approximate equality - Also fix some tests using deprecated methods
This separates data collection and data analysis using idioms suggested by @mpharrigan (though note Matt that my definitions of `save` and `load` differ from the ones we've been using internally).
* Add docs for circuit batching - Add documentation under Google docs for batching circuits together using engine.run_batch() - Also updated best practices to use this functionality. Co-authored-by: Balint Pato <balopat@users.noreply.github.com>
- Engine now raises ValueError if you don't specify gate_set. - While technically backwards incompatible, I don't think anyone will have working code that doesn't specify a gate_set here.
This the first child-PR of #3126 . - Introduces new Pasqal qubit classes: `ThreeDQubit`and `TwoDQubit` (a subclass of `ThreeDQubit`) - These new classes are intended to replace the original `ThreeDGridQubit`, which will be deleted on the next PR (where other classes' dependencies will be resolved). - In comparison with `ThreeDGridQubit`, these new classes allow for arbitrary placement of qubits in 3D or 2D space, instead of restricting them to a grid. This more closely resembles the capabilities of Pasqal devices.
Adds rstcheck to the doc tests CI step. This is to avoid accidentally breaking pypi publishing with syntactically incorrect. See #3175 for when this happened.
As requested, I added a Jupyter notebook that showcases the DFE code. Note that the present version relies on under-review PR: #2918 I've never gone through a review for a notebook, so I am attaching a PDF of what it currently looks like. [direct_fidelity_estimation.pdf](https://github.com/quantumlib/Cirq/files/4517980/direct_fidelity_estimation.pdf)
This the third child-PR of #3126 , following #3141 . - The accepted gate set is updated to: - Accept only specific multi-qubit gates - Accept the Hadamard gate - The noise model is updated accordingly and is now device dependent, in preparation for the addition of new devices whose noise model will naturally differ from the standard - A specific converter for non-native gate decomposition is adapted from the `neutral_atoms` module
This is the fifth child-PR of #3126, following #3160. `PasqalVirtualDevice`, which enforces the constraints typically found in a physical device, is added to the module. These constraints were present in `PasqalDevice` before its generalisation in #3141 . They are now reincorporated here. This is the last code PR of the Pasqal updates, after which all that is left is to incorporate the documentation.
- Documents detailing the usage of Pasqal's devices and sampler - A "getting_started" tutorial in the form of a Jupyter notebook
[Quimb](https://quimb.readthedocs.io/en/latest/index.html) is a nice tensor network package. This set of utilities (in `contrib` because there are features missing) allows you to turn cirq Circuits into quimb tensor networks with some benefits.   The particular use cases I've explored explicitly is 1. For shallow, low degree circuits you can compute the value of low weight observables on a very high number of qubits (example provided in "Contract a Grid Circuit" notebook) 2. For low-qubit number, deep, noisy circuits it is faster than the cirq density matrix simulator  ## Features - Turn circuits into tensor networks representing state vector or unitary - Drop-in replacements for `cirq.final_state_vector` and `cirq.unitary` that use tensor contraction under the hood - Utilities for contracting circuits of the form <0 | U^dag A U |0> for PauliString `A`. - Some related functionality for building circuits on a grid and simplifying some of the operations with low weight observables - Circuit-like positioning of tensors in tensor drawings for density matrix networks ## Limitations - Code duplication between state vector and density transforms - Initial state must be |0> - No circuit-like positioning of tensors in state-vector networks - No expectation values with density matrices - Doesn't follow the simulator and sampler APIs
Fixes #3200. As we will deprecate Sphinx soon anyway, and I wanted to have this situation resolved asap, I decided to pin to 3.1.* version of sphinx instead of fighting the new warnings from 3.2.0.
Fixes #2806. This is covered by tests, but I ran these checks to be sure: ``` In [1]: import cirq, numpy as np In [2]: def mxx(t): ...: f = np.e**(1j*np.pi*t/2) ...: c = f * np.cos(np.pi*t/2) ...: s = -1j * f * np.sin(np.pi*t/2) ...: return np.array([[c, 0, 0, s], [0, c, s, 0], [0, s, c, 0], [s, 0, 0, c]]) ...: In [3]: def myy(t): ...: f = np.e**(1j*np.pi*t/2) ...: c = f * np.cos(np.pi*t/2) ...: s = -1j * f * np.sin(np.pi*t/2) ...: return np.array([[c, 0, 0, -s], [0, c, s, 0], [0, s, c, 0], [-s, 0, 0, c]]) ...: In [4]: np.allclose(cirq.unitary(cirq.XX**0.1), mxx(0.1)) Out[4]: True In [5]: np.allclose(cirq.unitary(cirq.YY**0.1), myy(0.1)) Out[5]: True ``` NB: Global phase factors complicate documentation. I think we should prefer SU(n) gates (over trying to force one eigenvalue onto the real axis).
### Related Issue Fixes #3183. ### Source of Error In the original code, we added \qw and \qwx too aggressively. Whenever there is a line in the original diagram, we will try to insert \qw or \qwx accordingly. This causes the program to try to add the angle bracket thing above and below the two cnots mentioned in the issue to be recognized as wires. ### Summary of Fix Add the pruning process for adding \qw and \qwx. Need none wire item to be on the same row or previous row needs to be connected to the current one. ### Output After Fix Rerunning code outputs the following. \Qcircuit @r=1em @C=0.75em { \\ & & & & & & \\ &\lstick{\text{0}}& \qw& \qw&\control \qw & \qw & \qw&\qw\\ &\lstick{\text{1}}& \qw& \qw& \qw\qwx&\control \qw & \qw&\qw\\ &\lstick{\text{2}}& \qw& \qw&\targ \qw\qwx& \qw\qwx& \qw&\qw\\ &\lstick{\text{3}}& \qw& \qw& \qw &\targ \qw\qwx& \qw&\qw\\ & & & & & & \\ \\ } ### Latex Compiled Output Following are the Latex compiled output for the above code and one extra to show we don't over connect using \qwx   ### Misc Seems to pass the qcircuit_test.py. But I fear that we might need other tests in the future? Please let me know if I did something wrong.
- sympy is soooooooooooo slow - Change parameter resolver to handle basic sympy cases - Speeds parameter resolution up by ~10x in common cases. Fixes #1899
- Cirq v1 protos are deprecated. - No one should have been actively using these functions for over a year.
This PR addresses a bug in Quil output. The current code doesn't distinguish between Cirq's `PowGate` exponents and the angle parameters for Quil gates, but they differ by a factor of pi. This is verified by comparing program unitaries before and after conversion to Quil (see below). Adds a test for this change that depends on pyQuil, so `pyquil` is added to `pip-list-dev-tools.txt`, but in the event that pyQuil is not available for import, the test is [skipped](https://docs.pytest.org/en/latest/skipping.html#skipping-on-a-missing-import-dependency). Additionally sneaks in a change to Quil output for `ISwapPowGate` -- uses the native `XY` Quil gate when the exponent of the `ISwapPowGate` does not equal 1. ```python In [1]: import numpy as np ...: from pyquil import Program ...: from pyquil.simulation.tools import program_unitary ...: ...: from cirq import Circuit, LineQubit, QuilOutput, rx ...: ...: q0 = LineQubit(0) ...: ...: # rx(pi/2) creates an XPowGate with exponent 0.5 (and global_shift -0.5) ...: circ = Circuit(rx(np.pi/2)(q0)) ...: print(circ) ...: ...: pyquil_program = Program(str(QuilOutput(circ, (q0,)))) ...: print(pyquil_program) ...: ...: pyquil_unitary = program_unitary(pyquil_program, n_qubits=1) ...: print(pyquil_unitary) ...: ...: cirq_unitary = circ.unitary() ...: print(cirq_unitary) ...: ...: np.allclose(pyquil_unitary, cirq_unitary) ``` on `master`: ``` 0: ───Rx(0.5π)─── RX(0.5) 0 [[0.96891242+0.j 0. -0.24740396j] [0. -0.24740396j 0.96891242+0.j ]] [[0.70710678+0.j 0. -0.70710678j] [0. -0.70710678j 0.70710678+0.j ]] Out[1]: False ``` this PR: ``` 0: ───Rx(0.5π)─── RX(pi/2) 0 [[0.70710678+0.j 0. -0.70710678j] [0. -0.70710678j 0.70710678+0.j ]] [[0.70710678+0.j 0. -0.70710678j] [0. -0.70710678j 0.70710678+0.j ]] Out[1]: True ``` Related to #1742, #2386, #2983
@dstrain115 @balopat Hello. This is a rebase from the |
A Googler has manually verified that the CLAs look good. (Googler, please make sure the reason for overriding the CLA status is clearly documented in these comments.) ℹ️ Googlers: Go here for more info. |
Automerge cancelled: Can only automerge into master. |
Thanks! |
Rebase
docs_site
branch frommaster
branch.