Releases: quantumlib/Qualtran
Qualtran v0.6
We're proud to announce the latest minor release of Qualtran. This release brings infrastructure improvements for writing controlled bloqs, lays the groundwork for more interoperability with other tools, and contains major additions and improvements to our library of bloqs.
Easier and optimized controlled bloqs
ControlledViaAnd was included in the previous release of Qualtran. For multi-qubit control specs, it will compute the conditional once and use single-bit controls in subbloqs. The older Controlled metabloq uses a "total control" decomposition where each subbloq is controlled according to the requested control spec (no matter how complicated it is).
In this release, the default Bloq.get_ctrl_system will use a ladder of And to reduce multiple controls to a single control bit for complex control specs. This is a more optimized default. Bloq authors will always be free to override Bloq.get_ctrl_system for complete flexibility. With this change, more cases can be adequately handled by the automatic default.
This overhaul was contributed by @anurudhp in #1373 #1456 #1451 #1481 #1490, and #1491.
Backwards-incompatible changes
We always strive to avoid any breaking changes in expressing or analyzing quantum algorithms using the public classes, methods, and functions in the qualtran namespace (outside of qualtran.bloqs). However, prior to a 1.0 release, we may make breaking changes that would otherwise accumulate too much tech debt. This release contains some minor incompatible changes, detailed (with alternatives) below.
Note that the qualtran.bloqs library of subroutines will be under active development for the foreseeable future, and we will make incompatible changes to the quantum algorithms for correctness and accuracy following quantum algorithms research results.
Bloq.pretty_namehas been removed as a base-class method. Override__str__and usestr()to get a string representation of a bloq, by @dstrain115 in #1402- The deprecated
qualtran.drawing.GraphvizCountsclass has been removed. Convenience drawing methods had already been switched to use the replacement,GraphvizCallGraph, by @dstrain115 in #1410 - The deprecated
Bloq._t_complexity_override has been removed as a base-class method. OverrideBloq.my_static_costsinstead. TheQECGatesCostestimator will still respect_t_complexity_methods on derived classes if set tolegacy=Truemode, by @mpharrigan in #1377 Controlledmeta-bloqs can only be used to control bloqs with all thru-registers. The meaning of a controlled allocation is ill-defined, by @mpharrigan in #1305- The default fallback for
Bloq.get_ctrl_systemwill useControlledViaAnd, see the above section in these release notes. Andis now an atomic, leaf bloq. The circuit decomposition in terms of T and measurement-based uncomputation is still available viaAnd.to_clifford_t_circuit(), by @anurudhp in #1513
Interoperability and devops
This release includes dependency adjustments to support interoperability with other quantum tools. This release adds a new dependency PennyLane, but full interoperability requires pennylane>=0.41, which is not yet released at the time of writing. A runtime check is performed, so if you manually update your environment with pennylane>=0.41, the full functionality will be enabled. This logic was included in Qualtran v0.6.1. The prior tag v0.6.0 depended on a pre-release that is not available from PyPI, so qualtran==0.6.0 is not available on PyPI.
- [Bartiq] upgraded to version 0.6.0 by @mstechly in #1409
- [Cirq] dependency is no longer pinned to a particular version by @mpharrigan in #1460
- [Cirq, bugfix] Allow computing cost from decomposition of Cirq gates by @anurudhp in #1510
- [QREF] Add option to generate QREF from callgraphs by @mstechly in #1522
- [PennyLane] Qualtran bloqs to PennyLane by @austingmhuang in #1559
- [PyZX] Dependency added for future interoperability, by @anurudhp in #1562
Additionally, our repository has been spruced up with a new README, citation information, and dev tools by @mhucka in #1568 #1569 #1571 #1573 #1572 #1597 #1575 #1580, #1598, and #1601
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 #1395
- Add Equals() bloq by @fpapa250 in #1411
- Add QGF data type for Galois Fields by @tanujkhattar in #1433
- Add
GF2Multiplicationbloq for multiplication over GF($2^m$ ) by @tanujkhattar in #1436 - Add
GF2Addbloq for addition over GF($2^m$ ) by @tanujkhattar in #1438 - Add
GF2Squarebloq for squaring over GF($2^m$ ) by @tanujkhattar in #1441 - Add
GF2Inversebloq for computing inverse over GF($2^m$ ) by @tanujkhattar in #1442 - Add
GF2AddKfor in place addition of a constant over GF($2^m$ ) by @tanujkhattar in #1447 -
PlusEqualProductversion ofGFMultiplicationfor GF($2^m$ ) by @tanujkhattar in #1457 - Optimized implementation of
GF2Inverseby @tanujkhattar in #1459 - Implement CtrlScaleModAdd and CModAddK bloqs for Modular Exponentiation by @fpapa250 in #1432
- Add RSA Phase Estimate Bloq and Move ModExp to rsa/ subdirectory by @fpapa250 in #1428
- Create linear half comparison bloqs by @NoureldinYosri in #1408
- Add ECAdd() Bloq by @fpapa250 in #1425
- Create KaliskiModInverse by @NoureldinYosri in #1464
- Add
SparseMatrixHermitianblock-encoding by @anurudhp in #1479 - Add Decomposition of ECWindowAddR by @fpapa250 in #1477
- Deprecate
MultiControlPauliby @anurudhp in #1492 - Add list primitives from Quartic speedups paper by @anurudhp in #1503
- Implement Kikuchi guiding state preparation by @anurudhp in #1504
- Add bloq for constant polynomial multiplication modulo in GF(2) by @NoureldinYosri in #1516
- Add bloq for Binary Polynomial Multiplication by @NoureldinYosri in #1554
- Single-qubit and Controlled Z rotations by @mpharrigan in #1455
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_costsoverride for accurateQubitCounts for qrom bloqs by @tanujkhattar in #1414 - Add serialization for ECPoint arg type. by @fpapa250 in #1412
- Make intermediate additions unsigned in ModAdd by @fpapa250 in #1424
- Add classical action test for ModAdd by @NoureldinYosri in #1427
- fix call graph for
Equalsby @anurudhp in #1429 - sparse state prep: allow user to pick target bitsize if needed by @anurudhp in #1430
- Update THC Prepare to use QROAMClean by @fdmalone in #1378
- Bugfix in Partition to support QGF type registers by @tanujkhattar in #1448
- Override KaliskiModInverse.adjoint by @NoureldinYosri in #1483
- Modify KaliskiModInverse to support zero by @NoureldinYosri in #1486
- Replace ModInv shim with KaliskiModInverse in ECAdd bloq by @fpapa250 in #1485
- Upgrade
AddK- use dtype and simplify controls by @anurudhp in #1493 - Fix bug in KaliskiStep3 and add tests for all steps by @NoureldinYosri in #1496
- Fix symbolic call graphs for factoring phase estimates by @fpapa250 ...
Qualtran v0.5
This preview release of Qualtran contains many improvements and new bloqs.
This is the last planned release before the 1.0 release of Qualtran. 1.0 will bring stronger stability guarantees to the core Qualtran framework: namely everything in the qualtran namespace outside of qualtran.bloqs. The library of bloqs will continue to be extended and edited for greater breadth and accuracy. This development release contains some backwards-incompatible changes to prepare for 1.0. Read on for more information
Bartiq and QREF integration
This release includes interoperability with Bartiq via the QREF format implemented by @mstechly in #1194. Interoperability between quantum algorithms tooling is crucial to accelerate progress in the field.
Qualtran software paper
We've authored a manuscript describing the design of Qualtran, some important algorithmic primitives contained in qualtran.bloqs, and case studies on problems of interest. If you use Qualtran in your own work, please cite:
Expressing and Analyzing Quantum Algorithms with Qualtran. arXiv: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 withbuild_call_graphor usemy_static_coststo provide a static override. - The
cirq_interop.t_complexityfunction no longer uses any custom logic. Rather, it goes viaqualtran.resource.estimationtools; specifically theQECGatesCostcost key. There should be no observable change to the computed costs. #1313 #1359 #1323 #1333 Toffoliis now an atomic, leaf bloq #1388CSwapis now an atomic leaf bloq #1393Andwill become an atomic leaf bloq #1347- The
GraphvizCallGraph.from_bloqhelper method can draw call graphs with costs #1254
Tensor simulation overhaul
The tensor simulation protocol was changed to support efficient simulation of a larger class of circuits, including shallow-but-wide circuits. Qualtran can simulate a 2x32-qubit adder using only 6 qubit's worth of RAM for a specific input/output ket following the changes.
- Overhaul implemented in #1070. Tensor simulation will always try to flatten as much as possible before starting the contraction. The semantics of
my_tensorshave 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
.flattenin #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 #1141 #1154 #1157 #1183 #1185
qualtran.resource_estimation.GateCountsis used directly.AlgorithmSummaryandMagicCountdataclasses have been removed as redundant.
Other framework changes
- The
bit_toolsmodule has been removed and replaced withQDTypefeatures by @charlesyuan314 in #1041. Please migrate your code to useQDTypemethods to convert between bits. New, vectorizedfrom_bitsandto_bitsby @anurudhp in #1199 - Greedy topological sort of the binst graph to minimize qubit allocations / deallocations by @tanujkhattar in #1099
- Cirq interop overhaul/bugfixes @tanujkhattar in #1100
- QFxp: use integer values for classical sim instead of
fxpmath.Fxpby @anurudhp in #1204 - Change return type of build_call_graph to set | dict by @dstrain115 in #1356 #1392
pretty_nameis deprecated #1340. Use__str__.Bloq.supports_decompose_bloqhas been removed in #1382. Usetry/except.BoundedQUInthas been renamed toBQUIntby @fdmalone in #1363- Better support for symbolics in
Signatureby @anurudhp in #1353 and @mpharrigan in #1301 - param
ctrl_specofget_ctrl_systemwill always be non-None by @anurudhp in #1209 - Zero-bitsize connections are explicitly not allowed by @mpharrigan in #1105
New and updated bloqs
- Implement decomposition for
BitonicSortby @anurudhp in #1089 - Add
AutoPartitionandBloqBuilder.add_and_partitionto fit bloqs together whose registers don't quite match by @charlesyuan314 in #1086 - Implement classical action of Cast bloq by @NoureldinYosri in #1093
- Add
UnitaryandTensorProductblock encodings by @charlesyuan314 in #1094 - GlobalPhase: use
exponent, and implement controlled (ZPowGate) by @anurudhp in #1117 - Create
ApplyLthBloqas a simple SELECT oracle by @charlesyuan314 in #1107 - Add
Productblock encoding by @charlesyuan314 in #1106 - Add
Phaseblock encoding by @charlesyuan314 in #1129 - Add
LinearCombinationblock encoding by @charlesyuan314 in #1133 - Permutation Bloq by @anurudhp in #1110
- Sparse state preparation via alias sampling by @anurudhp in #1067
- Implement
Negate(two's complement) by @anurudhp in #1144 - Add
Xorbloq by @charlesyuan314 in #1149 - Add
InvertRealNumberbloq by @charlesyuan314 in #1151 - Add
BitwiseNotby @anurudhp in #1161 - Add
SubtractFromto subtract from a register in place by @charlesyuan314 in #1158 - Switch
SubtractFromto useBitwiseNotby @charlesyuan314 in #1164 - Create
SparseMatrixblock encoding by @charlesyuan314 in #1143 - Optimize gate count of Subtract to n-1 Toffolis by @NoureldinYosri in #1057
- CHadamard by @mpharrigan in #1114
- CYGate by @mpharrigan in #1115
- CZ by @mpharrigan in #1116
- Disallow zero sized registers in QROMs and PRGAViaPhaseGradient by @tanujkhattar in #1160
- Add
ExplicitEntryOracleto block encode a matrix by @charlesyuan314 in #1166 ControlledAddOrSubtractBloq by @anurudhp in #1145- Update classical action of addition gates and fix classical action bug in Join by @NoureldinYosri in #1174
- Implement generic
MultiControlledBloqusing single-controlled subbloq + And ladder. by @anurudhp in #1155 ControlledViaAndtests and bloq examples by @anurudhp in #1182- Add
SignExtendfor two's complement sign extension by @anurudhp in #1162 - Add
SymmetricBandedmatrix block encoding by @charlesyuan314 in #1177 - Add
ArcSinbloq by @charlesyuan314 in #1188 - Add symbolic call graph for
SparseMatrixby @charlesyuan314 in #1193 - Revamp
ChebyshevPolynomialby @charlesyuan314 in #1213 - Bitwise bloqs are self adjoint by @anurudhp in #1220
- Update QROAM in chemistry prepare bloqs to use clean ancilla by @fdmalone in #1226
- Add
ScaledChebyshevPolynomialbloq by @charlesyuan314 in #1231 - Add an optimizer for
LinearCombinations by @charlesyuan314 in #1232 - Add FFT QSP by @Epsilon1024 in #1078
- RzViaPhaseG...
Qualtran v0.4
We're pleased to announce the latest beta release of Qualtran: v0.4.0. This release includes many improvements and fixes throughout the library, but some highlights include:
Highlights
- Support for arbitrary
CostKeys: 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: v0.3.0...v0.4.0
Qualtran v0.3.0
This is an incremental beta release of Qualtran.
Highlights
- Quantum data types. Registers now have types.
- T-complexity protocol improvements.
- More bloqs!
Full Changelog: v0.2.0...v0.3.0
Qualtran v0.2.0
This is an incremental beta release of Qualtran.
Highlights include:
- Improved Cirq interoperability, and the absorption of the-package-formerly-known-as Cirq-FT into the Qualtran repository.
- More chemistry bloqs.
- The Adjoint protocol
Full Changelog: v0.1.0...v0.2.0
Qualtran v0.1.0
This is the initial, experimental preview release of Qualtran