v1.2.0
Cirq v1.2.0 release
Summary
This Cirq release focuses on making it easier to express and do resource estimations for Fault Tolerant Quantum Algorithms, with a number of high level improvement summarized as follows:
Improvements to Cirq-Core
- Cirq protocols (eg:
cirq.unitary
) and simulators (eg:cirq.Simulator
) now support gates that allocate new qubits as part of their decomposition cirq.QubitManager
is a new top-level abstraction that defines the interface for a qubit allocator/deallocator which can be used to manage ancilla qubits at the time of circuit construction.cirq.decompose
infrastructure is updated s.t. new composite gates can override the_decompose_with_context_
method to gain access to acirq.DecompositionContext
that contains options such as acirq.QubitManager
to help with allocating ancilla qubits at the time of circuit construction.
Cirq-FT: A new sub-package for Fault-Tolerant algorithms
Cirq-FT is a new sub-package for rapid prototyping and resource estimation of fault tolerant algorithms that extends Cirq. Some notable features include
- A concept of qubit
Register
/Registers
that make it easier for composite gates to express their signature in terms of named groups of logical qubits. - A
cirq_ft.GateWithRegisters
base class, which acts as a SHIM on top of the flat qubits API ofcirq.Gate
class and helps users define their composite gates using qubit registers. - New protocols, like
cirq_ft.TComplexity
, for macroscopic resource estimation. - New compilation transformers for mapping ancilla allocation / deallocation requests in a compute graph (eg: cirq circuit) to physical qubits, supporting both clean and dirty allocations.
- A well-annotated and well-tested library of hierarchical gate decompositions which implements all the circuit primitives from Encoding Electronic Spectra in Quantum Circuits with Linear T Complexity. Table IV containing resource estimates of circuits with ~10^10 T-gates can be reproduced in under a minute demonstrating the scalability of the framework.
Other notable changes
- Dropped support for Python 3.7 and Python 3.8 and added support for Python 3.11
- Performance improvements for parameter resolution and a new
__cirq_debug__
flag that provides an option to disable validations at the time of circuit construction.
What's Changed
- Bump cirq version to 1.2.0 by @tanujkhattar in #5969
- Make AsyncioExecutor a shared resource across EngineClients by @wcourtney in #5976
- Add single-qubit detuning parameters to CouplerPulse by @wcourtney in #5971
- Bump json5 and tsconfig-paths in /cirq-web/cirq_ts by @dependabot in #5975
- Fix bug in documentation of phase_flip and bit_flip methods by @tanujkhattar in #5977
- Fix link to noise models by @nickdgardner in #5990
- Add M and R aliases for cirq.measure and cirq.reset by @maffoo in #5993
- Bump http-cache-semantics from 4.1.0 to 4.1.1 in /cirq-web/cirq_ts by @dependabot in #5997
- Removing unnecessary return statement in cirq-core/cirq/circuits/moment.py by @joesho112358 in #6004
- Reducing some code by cleaning up some logic by @joesho112358 in #6003
- Retry bad_gateway in cirq-ionq by @Cynocracy in #6006
- Add
__cirq_debug__
flag and conditionally disable qid validations in gates and operations by @tanujkhattar in #6000 - Fix an error in qvm_stabilizer_example.ipynb by @yinghui-hu in #6010
- Pin Node version by @vtomole in #6014
- IonQ: Handle 409 errors that are injected by Cloudflare by @Cynocracy in #5292
- Bump ipython from 7.31.1 to 8.10.0 in /dev_tools/requirements/deps by @dependabot in #6015
- Correct invalid URLs found in notebook files by @pavoljuhas in #6022
- Adding dimension property to comparison of XPowGate and ZPowGate by @joesho112358 in #6005
- Speed up parameter resolution by checking if val is parameterized and caching the boolean by @tanujkhattar in #6023
- MatrixGate names don't survive serialization by @markedmiston in #6026
- Bump node-fetch and puppeteer in /cirq-web/cirq_ts by @dependabot in #5998
- Simplify dev_tools.notebooks.utils.rewrite_notebook by @pavoljuhas in #6030
- Fixed type annotations in _BaseLineQid and _BaseGridQid by @sarahsor in #6043
- Remove outdated workaround for a bug in black formatter by @pavoljuhas in #6045
- Update and correct pow function for PauliSum by @TarunSinghania in #6019
- Ensure compatible version of numpy in isolated_notebook_test.py by @pavoljuhas in #6038
- pytest - keep "slow" tests deselected after
-k EXPRESSION
by @pavoljuhas in #6034 - Prevent notebook tests from changing the pytest Python environment by @pavoljuhas in #6032
- Install recent version of ply in interop.ipynb by @pavoljuhas in #6033
- Fix failing CI after Pandas 2.0 update by @tanujkhattar in #6051
- Change dtype repr for Numpy 1.24 by @bnavigator in #5991
- Refactor and speed up
cirq.transformers.stratify
by @perlinm in #6013 - Update cirq.contrib.svg to escape < and > characters by @tanujkhattar in #6055
- Escape both
<>
characters in SVG test labels by @pavoljuhas in #6056 - Add weekly CI workflow to test all notebooks by @xXnathankerrXx in #6046
- Use hash of all requirements files in cache keys for ci by @maffoo in #6061
- Update to mypy 1.2 by @maffoo in #6059
- Verify error reporting from the CI-weekly run by @pavoljuhas in #6060
- Use PEP-673 Self type annotations by @maffoo in #6057
- Bump webpack from 5.40.0 to 5.76.0 in /cirq-web/cirq_ts by @dependabot in #6035
- add phase_by method to ZZPowGate by @richrines1 in #6062
- Restore weekly cadence for the CI-weekly workflow by @pavoljuhas in #6066
- Adds User-Agent header to requests by @splch in #6065
- Document json_namespace usage by @95-martin-orion in #6069
- Removing Obsolete json files by @dstrain115 in #6071
- Fix matplotlib deprecation warning by @dstrain115 in #6072
- Access
_row
and_col
attributes directly inGridQubit
instead of using properties by @maffoo in #6075 - Add ZipLongest to cirq_google by @dstrain115 in #6074
- Fix Default InsertStrategy in Circuits Notebook by @xXnathankerrXx in #6079
- Add
Moment.from_ops
to more efficiently construct moments by @maffoo in #6078 - Apply suggestions from CommonTypos checker by @pavoljuhas in #6082
- Fix cirqdev gitter URL by @pavoljuhas in #6084
- Keep up with quimb-1.5.0 by @pavoljuhas in #6087
- Remove deprecated argument of pyplot.stem by @pavoljuhas in #6086
- Fix image links by @yinghui-hu in #6085
- Override gate.controlled() for GlobalPhaseGate to return a ZPowGate by @tanujkhattar in #6073
- Unblock test that requires sympy-1.12 by @pavoljuhas in #6096
- Fix typos in notebooks.md and a plenty of relative links by @pavoljuhas in #6089
- GridDevice serialization refactor by @verult in #6094
- Add metadata to sweeps by @dstrain115 in #6099
- Accept all_qubits in GridDevice._from_device_information() to allow isolated qubits by @verult in #6103
- Bump requests from 2.24.0 to 2.31.0 in /dev_tools/pr_monitor by @dependabot in #6104
- Loosen
networkx
requirements by @vtomole in #6105 - Make
Collector
andPauliSumCollector
work withAbstractCircuit
by @maffoo in #6109 - Add Parameter to cirq_google by @dstrain115 in #6102
- Update cirq.decompose protocol to perform a DFS instead of a BFS on the decomposed OP-TREE by @tanujkhattar in #6116
- Ensure that cirq.decompose traverses the yielded OP-TREE in dfs ordering by @tanujkhattar in #6117
- Add support for allocating qubits in decompose to cirq.unitary by @NoureldinYosri in #6112
- Add
_decompose_with_context_
protocol to enable passing qubit manager within decompose by @tanujkhattar in #6118 - Quantum Shannon Decomposition by @uzzzzzzz in #6020
- Add modulo to equal_up_to_global_phase by @siddharth-mehta in #6058
- Add new subpackage cirq-ft by @pavoljuhas in #6121
- Update Density Matrix and State Vector Simulators to work when an operation allocates new qubits as part of its decomposition by @senecameeks in #6108
- Inconsistent ordering of tags by @skushnir123 in #6123
- Remove foxtail references by @carthick in #6126
- Changed simulators fallback to
decompose_once
and removed ancilla support fromDensityMatrixSimulator
by @tanujkhattar in #6127 - Pin cirq_rigetti pyquil dependency to pyquil-3.* by @pavoljuhas in #6129
- Fail early in
_strat_has_stabilizer_effect_from_unitary
by @tanujkhattar in #6131 - Replace functions deprecated in NumPy 1.25 by @pavoljuhas in #6133
- Improvement in performance of resolve_parameters by @skushnir123 in #6128
- Make
cirq.FREDKIN
gate self-inverse by @tanujkhattar in #6135 - Allow measure_single_paulistring to have negative coefficient by @skushnir123 in #6143
- Launch Cirq-FT: Cirq for Fault Tolerant Algorithms sub-package by @tanujkhattar in #6138
- Add units to device parameter by @dstrain115 in #6140
- Try to fix _bz2 issue. by @dstrain115 in #6151
- CI - update GitHub actions by @pavoljuhas in #6153
- BugFix in
cirq.map_operations
by @tanujkhattar in #6155 - Add Device Parameter metadata serialization to cirq_google by @dstrain115 in #6113
- Remove numpy<1.24 restriction from requirements.txt by @tanujkhattar in #6149
- Remove overwrite_existing fields in CreateQuantumProgramRequest and CreateQuantumJobRequest by @verult in #6160
- Delete redundant setup.cfg files by @pavoljuhas in #6122
- Set cachetools min version to 5.3 by @verult in #6161
- Fix LaTeX formatting for arbitrary-angle MS gate by @jli0108 in #6166
- CI - run pylint checks with dependencies installed by @pavoljuhas in #6163
- Add example colabs by @95-martin-orion in #6169
- Skip utility sims by @95-martin-orion in #6170
- Add support for > 32 qudits to cirq.sample_state_vector. Fix for #6031 by @NoureldinYosri in #6090
- Bump minimum python version to 3.9 by @skushnir123 in #6167
- Remove invalid extra commas from json data by @pavoljuhas in #6176
- Decompose protocol must create a context when given None and SimpleQubitManager must add a prefix to its qubits by @NoureldinYosri in #6172
- Handle qudits in the
__str__
of StateVectorTrialResult by @vtomole in #6180 - Create a unitary to pauli string transformer by @NoureldinYosri in #6100
- Remove references to cirq_qubitization in cirq_ft by @mpharrigan in #6183
- Retire unused Dockerfile by @pavoljuhas in #6184
- added ci-daily by @jackreeceejini in #6177
- Clean up after compatibility with numpy-1.24 by @pavoljuhas in #6187
- Remove unused warnings filter for pytest by @pavoljuhas in #6186
- Fix failing tests for Python 3.11 by @navaro1 in #6181
- Handle shape mismatch for cirq.dirac_notation by @jeeva2812 in #6179
- Update dockerfiles by @jackreeceejini in #6188
- Delete dependencies pinning done over 2 years ago by @pavoljuhas in #6189
- Speed up execution time of
merge_single_qubit_moments_to_phxz
transformer by avoiding redundant calls to unitary protocol by @tanujkhattar in #6174 - Remove dependency on the flynt tool by @pavoljuhas in #6164
- Create consistency check for unitary with ancilla by @NoureldinYosri in #6196
- Implemented 8n T complexity decomposition of LessThanEqual gate by @NoureldinYosri in #6156
- Create cirq_google.InternalGate by @NoureldinYosri in #6194
- Use f-strings instead of percent operator or str.format() by @pavoljuhas in #6198
- Fix flaky test to make Windows CI runs consistent by @tanujkhattar in #6202
- Ignore string updates for consider-using-f-string by @pavoljuhas in #6203
- Add Python 3.11 tests to CI by @tanujkhattar in #6191
- Make Cirq-FT registers multi-dimensional by @tanujkhattar in #6200
- Simplify
StatePreparationAliasSampling
tests by relying on Cirq simulators to simulate operations allocating ancillas by @tanujkhattar in #6204 - Remove flynt dependency by @tanujkhattar in #6205
New Contributors
- @nickdgardner made their first contribution in #5990
- @joesho112358 made their first contribution in #6004
- @yinghui-hu made their first contribution in #6010
- @markedmiston made their first contribution in #6026
- @sarahsor made their first contribution in #6043
- @TarunSinghania made their first contribution in #6019
- @bnavigator made their first contribution in #5991
- @xXnathankerrXx made their first contribution in #6046
- @richrines1 made their first contribution in #6062
- @uzzzzzzz made their first contribution in #6020
- @siddharth-mehta made their first contribution in #6058
- @senecameeks made their first contribution in #6108
- @skushnir123 made their first contribution in #6123
- @carthick made their first contribution in #6126
- @jli0108 made their first contribution in #6166
- @jackreeceejini made their first contribution in #6177
- @navaro1 made their first contribution in #6181
- @jeeva2812 made their first contribution in #6179
Full Changelog: v1.1.0...v1.2.0
A Huge Thank You
Thank you to all our contributors for this release:
Ben Greiner, Cheng Xing, Doug Strain, Joe Schulte, Jon Donovan, Mark Edmiston, Matthew Harrigan, Matthew Neeley, Michael A. Perlin, Noureldin, Ogah Jackreece Ejini, Orion Martin, Pavol Juhas, Piotr Lewandowski, S Jeeva, Seneca Meeks, Siddharth Mehta, Spence Churchill, Tanuj Khattar, Tarun Singhania, Uzair Faruqui, Victory Omole, William Courtney, carthick, jli0108, nickdgardner, richrines1, sarahsor, skushnir123, xXnathankerrXx, yinghui-hu