quantumlib/Qualtran
Qᴜᴀʟᴛʀᴀɴ is a Python library for expressing and analyzing Fault Tolerant Quantum algorithms.
7 Releases
Latest: 4mo ago
Qualtran v0.7v0.7.0Latest
📦 Rotation synthesis
- Key Features:
- 1. Implementation of four key synthesis protocols: diagonal (ancilla-free), mixed diagonal, fallback ("repeat-until-success"), and mixed fallback.
- 1. Arbitrary precision: the module is backed by `mpmath` and supports arbitrarily small target diamond norm distances. See the docs for notes on choosing the number of digits of precision.
- 1. The resulting circuits can be exported as Cirq circuits and Quirk links.
- Implemented by @NoureldinYosri in https://github.com/quantumlib/Qualtran/pull/1749 https://github.com/quantumlib/Qualtran/pull/1750 https://github.com/quantumlib/Qualtran/pull/1751.
📦 Classical data and measurement-based uncomputation
- Qualtran now supports classical data as part of the compute graph.
- Measurement operations take a `QBit` to a `CBit`.
- There are classical versions of each quantum data type, e.g. `CInt`, `CFxp`, etc. https://github.com/quantumlib/Qualtran/pull/1584 https://github.com/quantumlib/Qualtran/pull/1717
- Programs containing measurement and classical data can be simulated using the new superoperator tensor simulator. https://github.com/quantumlib/Qualtran/pull/1596
- A new "Phased Classical" simulation protocol supports simulation of circuits consisting of classical-reversible logic (`X`, `CNOT`, `Toffoli`) as well as diagonal gates (`T`, `Z`, `CZ`). Combined with the `MeasureX` gate, this simulator can be used to fuzz-test measurement-based uncomputation. https://github.com/quantumlib/Qualtran/pull/1590 https://github.com/quantumlib/Qualtran/pull/1682 https://github.com/quantumlib/Qualtran/pull/1698
💥 Breaking changes
- `BloqAsCirqGate` is now only a `cirq.Gate` and `CirqGateAsBloq` is now only a `Bloq` for conceptual consistency. https://github.com/quantumlib/Qualtran/pull/1603.
🐛 Quantum Standard Library Fixes
- We continue to aspire to have a tested, accurate standard library of quantum algorithms. The following changes were made to improve the correctness of quantum algorithms included in `qualtran.bloqs`.
- Fix bug in classical simulation of `Add` with mixed signed/unsigned integers by @mpharrigan in https://github.com/quantumlib/Qualtran/pull/1711
- Fix additional bug in `ECAdd` by @fpapa250 in https://github.com/quantumlib/Qualtran/pull/1666
- Consistent `Toffoli.controlled()` by @mpharrigan in https://github.com/quantumlib/Qualtran/pull/1771 https://github.com/quantumlib/Qualtran/pull/1712
- Fix `RowColumnOracle` Signature by @petim0 in https://github.com/quantumlib/Qualtran/pull/1780
- Fix `Identity`'s ctrl_adder by @petim0 in https://github.com/quantumlib/Qualtran/pull/1781
- `LinearCombinaison` adjoint is more general and checks are correct by @petim0 in https://github.com/quantumlib/Qualtran/pull/1784
- Override adjoint for `ControlledAddOrSubtract` by @anurudhp in https://github.com/quantumlib/Qualtran/pull/1735
- + 2 more
✨ New Bloqs in the Standard Library
- We continue to expand the available bloqs in the standard library of quantum algorithms and subroutines.
- [QGFPoly] Add `QGFPoly`, a new data type to represent polynomials over galois fields by @tanujkhattar in https://github.com/quantumlib/Qualtran/pull/1620
- [QGFPoly] Add `GF2PolyAddK`, `GFPolySplit` and `GFPolyJoin` bloqs by @tanujkhattar in https://github.com/quantumlib/Qualtran/pull/1622
- [QGFPoly] Add `GF2PolyAdd` bloq for quantum-quantum addition of polynomials over `GF(2^m)` by @tanujkhattar in https://github.com/quantumlib/Qualtran/pull/1624 https://github.com/quantumlib/Qualtran/pull/1681 https://github.com/quantumlib/Qualtran/pull/1705 https://github.com/quantumlib/Qualtran/pull/1727
- Add `GF2MulMBUC` Bloq by @tanujkhattar in https://github.com/quantumlib/Qualtran/pull/1718 https://github.com/quantumlib/Qualtran/pull/1726
- Implement Kikuchi graph oracles and block-encoding by @anurudhp in https://github.com/quantumlib/Qualtran/pull/1555
- Add bloq for the Guided Hamiltonian Problem by @anurudhp in https://github.com/quantumlib/Qualtran/pull/1695
- Add `Always` metabloq to simplify decompositions with compute-uncompute pairs by @anurudhp in https://github.com/quantumlib/Qualtran/pull/1605
- + 1 more
📦 Other improvements
- Support for Numpy 2 https://github.com/quantumlib/Qualtran/pull/1761
- New reference docs system https://github.com/quantumlib/Qualtran/pull/1684 and new tutorial notebooks https://github.com/quantumlib/Qualtran/pull/1694
✨ New Contributors
- @pqvr made their first contribution in https://github.com/quantumlib/Qualtran/pull/1643
- @ahkatlio made their first contribution in https://github.com/quantumlib/Qualtran/pull/1651
- @micpap25 made their first contribution in https://github.com/quantumlib/Qualtran/pull/1652
- @maxglick made their first contribution in https://github.com/quantumlib/Qualtran/pull/1739
- @amandashoe made their first contribution in https://github.com/quantumlib/Qualtran/pull/1753
- @petim0 made their first contribution in https://github.com/quantumlib/Qualtran/pull/1780
- Full Changelog: https://github.com/quantumlib/Qualtran/compare/v0.6.0...v0.7.0
Qualtran v0.6v0.6.0
📋 Backwards-incompatible changes
- `Bloq.pretty_name` has been removed as a base-class method. Override `__str__` and use `str()` to get a string representation of a bloq, by @dstrain115 in https://github.com/quantumlib/Qualtran/pull/1402
- The deprecated `qualtran.drawing.GraphvizCounts` class has been removed. Convenience drawing methods had already been switched to use the replacement, `GraphvizCallGraph`, by @dstrain115 in https://github.com/quantumlib/Qualtran/pull/1410
- The deprecated `Bloq._t_complexity_` override has been removed as a base-class method. Override `Bloq.my_static_costs` instead. The `QECGatesCost` estimator will still respect `_t_complexity_` methods on derived classes if set to `legacy=True` mode, by @mpharrigan in https://github.com/quantumlib/Qualtran/pull/1377
- `Controlled` meta-bloqs can only be used to control bloqs with all thru-registers. The meaning of a controlled allocation is ill-defined, by @mpharrigan in https://github.com/quantumlib/Qualtran/pull/1305
- The default fallback for `Bloq.get_ctrl_system` will use `ControlledViaAnd`, see the above section in these release notes.
- `And` is now an atomic, leaf bloq. The circuit decomposition in terms of T and measurement-based uncomputation is still available via `And.to_clifford_t_circuit()`, by @anurudhp in https://github.com/quantumlib/Qualtran/pull/1513
📦 Interoperability and devops
- [Bartiq] upgraded to version 0.6.0 by @mstechly in https://github.com/quantumlib/Qualtran/pull/1409
- [Cirq] dependency is no longer pinned to a particular version by @mpharrigan in https://github.com/quantumlib/Qualtran/pull/1460
- [Cirq, bugfix] Allow computing cost from decomposition of Cirq gates by @anurudhp in https://github.com/quantumlib/Qualtran/pull/1510
- [QREF] Add option to generate QREF from callgraphs by @mstechly in https://github.com/quantumlib/Qualtran/pull/1522
- [PennyLane] Qualtran bloqs to PennyLane by @austingmhuang in https://github.com/quantumlib/Qualtran/pull/1559
- [PyZX] Dependency added for future interoperability, by @anurudhp in https://github.com/quantumlib/Qualtran/pull/1562
✨ Bloq library additions
- Our library of quantum subroutines continues to grow, with substantial additions for doing arithmetic in various fields.
- create DirtyOutOfPlaceMontgomeryModMul by @NoureldinYosri in https://github.com/quantumlib/Qualtran/pull/1395
- Add Equals() bloq by @fpapa250 in https://github.com/quantumlib/Qualtran/pull/1411
- Add QGF data type for Galois Fields by @tanujkhattar in https://github.com/quantumlib/Qualtran/pull/1433
- Add `GF2Multiplication` bloq for multiplication over GF($2^m$) by @tanujkhattar in https://github.com/quantumlib/Qualtran/pull/1436
- Add `GF2Add` bloq for addition over GF($2^m$) by @tanujkhattar in https://github.com/quantumlib/Qualtran/pull/1438
- Add `GF2Square` bloq for squaring over GF($2^m$) by @tanujkhattar in https://github.com/quantumlib/Qualtran/pull/1441
- Add `GF2Inverse` bloq for computing inverse over GF($2^m$) by @tanujkhattar in https://github.com/quantumlib/Qualtran/pull/1442
- + 16 more
📦 Bloq library enhancements
- The existing library has been enhanced with more accurate resource estimation, bug fixes, and bespoke controlled versions of more bloqs.
- Add `my_static_costs` override for accurate `QubitCount`s for qrom bloqs by @tanujkhattar in https://github.com/quantumlib/Qualtran/pull/1414
- Add serialization for ECPoint arg type. by @fpapa250 in https://github.com/quantumlib/Qualtran/pull/1412
- Make intermediate additions unsigned in ModAdd by @fpapa250 in https://github.com/quantumlib/Qualtran/pull/1424
- Add classical action test for ModAdd by @NoureldinYosri in https://github.com/quantumlib/Qualtran/pull/1427
- fix call graph for `Equals` by @anurudhp in https://github.com/quantumlib/Qualtran/pull/1429
- sparse state prep: allow user to pick target bitsize if needed by @anurudhp in https://github.com/quantumlib/Qualtran/pull/1430
- Update THC Prepare to use QROAMClean by @fdmalone in https://github.com/quantumlib/Qualtran/pull/1378
- + 27 more
✨ New Contributors
- @shab5 made their first contribution in https://github.com/quantumlib/Qualtran/pull/1444
- @max-radin made their first contribution in https://github.com/quantumlib/Qualtran/pull/1521
- @mhucka made their first contribution in https://github.com/quantumlib/Qualtran/pull/1568
- @dandragona-dev made their first contribution in https://github.com/quantumlib/Qualtran/pull/1563
- @austingmhuang made their first contribution in https://github.com/quantumlib/Qualtran/pull/1559
- Full Changelog: https://github.com/quantumlib/Qualtran/compare/v0.5.0...v0.6.0
Qualtran v0.5v0.5.0
📦 Qualtran software paper
- Expressing and Analyzing Quantum Algorithms with Qualtran. [arXiv:2409.04643](https://arxiv.org/abs/2409.04643).
📦 Gate counting and leaf bloqs
- We've unified the gate counting framework under the `qualtran.resource_counting` framework.
- The `_t_complexity_` annotation is deprecated. Please continue to annotate callees with `build_call_graph` or use `my_static_costs` to provide a static override.
- The `cirq_interop.t_complexity` function no longer uses any custom logic. Rather, it goes via `qualtran.resource.estimation` tools; specifically the `QECGatesCost` cost key. There should be no observable change to the computed costs. https://github.com/quantumlib/Qualtran/pull/1313 https://github.com/quantumlib/Qualtran/pull/1359 https://github.com/quantumlib/Qualtran/pull/1323 https://github.com/quantumlib/Qualtran/pull/1333
- `Toffoli` is now an atomic, leaf bloq https://github.com/quantumlib/Qualtran/pull/1388
- `CSwap` is now an atomic leaf bloq https://github.com/quantumlib/Qualtran/pull/1393
- `And` will become an atomic leaf bloq https://github.com/quantumlib/Qualtran/pull/1347
- The `GraphvizCallGraph.from_bloq` helper method can draw call graphs with costs https://github.com/quantumlib/Qualtran/pull/1254
📦 Tensor simulation overhaul
- Overhaul implemented in https://github.com/quantumlib/Qualtran/pull/1070. Tensor simulation will always try to flatten as much as possible before starting the contraction. The semantics of `my_tensors` have changed. If you are overriding this method to support tensor simulation, consider relying directly on the decomposition or read the documentation for full details on how to implement the new method.
- Changes to `.flatten` in https://github.com/quantumlib/Qualtran/pull/1061. Flattening will no longer raise an error if a bloq doesn't have a decomposition. `.flatten()` with no arguments will flatten as much as possible.
📦 Physical cost models
- The `qualtran.surface_code` module has been refactored so both Beverland- and Gidney-derived models follow the same interface.
- Code changes in https://github.com/quantumlib/Qualtran/pull/1141 https://github.com/quantumlib/Qualtran/pull/1154 https://github.com/quantumlib/Qualtran/pull/1157 https://github.com/quantumlib/Qualtran/pull/1183 https://github.com/quantumlib/Qualtran/pull/1185
- `qualtran.resource_estimation.GateCounts` is used directly. `AlgorithmSummary` and `MagicCount` dataclasses have been removed as redundant.
📋 Other framework changes
- The `bit_tools` module has been removed and replaced with `QDType` features by @charlesyuan314 in https://github.com/quantumlib/Qualtran/pull/1041. Please migrate your code to use `QDType` methods to convert between bits. New, vectorized `from_bits` and `to_bits` by @anurudhp in https://github.com/quantumlib/Qualtran/pull/1199
- Greedy topological sort of the binst graph to minimize qubit allocations / deallocations by @tanujkhattar in https://github.com/quantumlib/Qualtran/pull/1099
- Cirq interop overhaul/bugfixes @tanujkhattar in https://github.com/quantumlib/Qualtran/pull/1100
- QFxp: use integer values for classical sim instead of `fxpmath.Fxp` by @anurudhp in https://github.com/quantumlib/Qualtran/pull/1204
- Change return type of build_call_graph to set | dict by @dstrain115 in https://github.com/quantumlib/Qualtran/pull/1356 https://github.com/quantumlib/Qualtran/pull/1392
- `pretty_name` is deprecated https://github.com/quantumlib/Qualtran/pull/1340. Use `__str__`.
- `Bloq.supports_decompose_bloq` has been removed in https://github.com/quantumlib/Qualtran/pull/1382. Use `try/except`.
- `BoundedQUInt` has been renamed to `BQUInt` by @fdmalone in https://github.com/quantumlib/Qualtran/pull/1363
- + 3 more
✨ New and updated bloqs
- Implement decomposition for `BitonicSort` by @anurudhp in https://github.com/quantumlib/Qualtran/pull/1089
- Add `AutoPartition` and `BloqBuilder.add_and_partition` to fit bloqs together whose registers don't quite match by @charlesyuan314 in https://github.com/quantumlib/Qualtran/pull/1086
- Implement classical action of Cast bloq by @NoureldinYosri in https://github.com/quantumlib/Qualtran/pull/1093
- Add `Unitary` and `TensorProduct` block encodings by @charlesyuan314 in https://github.com/quantumlib/Qualtran/pull/1094
- GlobalPhase: use `exponent`, and implement controlled (ZPowGate) by @anurudhp in https://github.com/quantumlib/Qualtran/pull/1117
- Create `ApplyLthBloq` as a simple SELECT oracle by @charlesyuan314 in https://github.com/quantumlib/Qualtran/pull/1107
- Add `Product` block encoding by @charlesyuan314 in https://github.com/quantumlib/Qualtran/pull/1106
- Add `Phase` block encoding by @charlesyuan314 in https://github.com/quantumlib/Qualtran/pull/1129
- + 57 more
📋 Full Changelog
- Can be found on GitHub: https://github.com/quantumlib/Qualtran/compare/v0.4.1...v0.5.0
Qualtran v0.4v0.4.0
📦 Highlights
- Support for arbitrary `CostKey`s: compute gate counts, qubit counts, or define your own cost
- Many more bloqs support symbolic parameters and cost estimates
- Bugfixes for using Qualtran on Windows
- Better control for how bloqs display themselves in diagrams
- Mypy type-checking is enabled and enforced library-wide.
- Full Changelog: https://github.com/quantumlib/Qualtran/compare/v0.3.0...v0.4.0
Qualtran v0.3.0v0.3.0
📦 Highlights
- Quantum data types. Registers now have types.
- T-complexity protocol improvements.
- More bloqs!
- Full Changelog: https://github.com/quantumlib/Qualtran/compare/v0.2.0...v0.3.0
Qualtran v0.2.0v0.2.0
📋 Changes
- Improved Cirq interoperability, and the absorption of the-package-formerly-known-as Cirq-FT into the Qualtran repository.
- More chemistry bloqs.
- The Adjoint protocol
Qualtran v0.1.0v0.1.0
This is the initial, experimental preview release of Qualtran
