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_name
has 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.GraphvizCounts
class 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_costs
instead. TheQECGatesCost
estimator will still respect_t_complexity_
methods on derived classes if set tolegacy=True
mode, by @mpharrigan in #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 #1305- The default fallback for
Bloq.get_ctrl_system
will useControlledViaAnd
, 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 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
GF2Multiplication
bloq for multiplication over GF($2^m$ ) by @tanujkhattar in #1436 - Add
GF2Add
bloq for addition over GF($2^m$ ) by @tanujkhattar in #1438 - Add
GF2Square
bloq for squaring over GF($2^m$ ) by @tanujkhattar in #1441 - Add
GF2Inverse
bloq for computing inverse over GF($2^m$ ) by @tanujkhattar in #1442 - Add
GF2AddK
for in place addition of a constant over GF($2^m$ ) by @tanujkhattar in #1447 -
PlusEqualProduct
version ofGFMultiplication
for GF($2^m$ ) by @tanujkhattar in #1457 - Optimized implementation of
GF2Inverse
by @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
SparseMatrixHermitian
block-encoding by @anurudhp in #1479 - Add Decomposition of ECWindowAddR by @fpapa250 in #1477
- Deprecate
MultiControlPauli
by @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_costs
override for accurateQubitCount
s 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
Equals
by @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 in #1497
- Self adjoint for
MCX
andMCZ
by @anurudhp in #1502 - notebooks for
ZPowConstViaPhaseGradient
andRzViaPhaseGradient
by @anurudhp in #1507 - First pass at fixing chemistry costs to use QECGatesCost by @fdmalone in #1505
- Be a bit careful about complexity of the sparse Hamiltonian by @fdmalone in #1512
- restrict classical action of certain arithmetic bloqs by @NoureldinYosri in #1518
- Fix
CSwap
bloq in mod division by @anurudhp in #1528 - Fix memory overflow in sparse matrix stress test by @anurudhp in #1529
- Update gf2.MultiplyPolyByConstantMod to support QGF dtype by @NoureldinYosri in #1533
- make QGF with irreducible_poly=None compatible with QGF with the correct poly by @NoureldinYosri in #1540
- Add a modulus parameter to QMontgomeryUInt by @NoureldinYosri in #1543
- Override ctrl system for Toffoli by @anurudhp in #1552
- BugFix in adjoint of
SynthesizeLRCircuit
by @tanujkhattar in #1553 - Allow wire_symbol() to handle multiple named selection registers. by @dandragona-dev in #1563
- Fix test_qft_text_book following #1455 by @mpharrigan in #1574
- Add Add.controlled() -> CAdd by @mpharrigan in #1576
- Fix bugs in ECAdd bloq by @fpapa250 in #1489
- Support spare Prepare with log_block_size=0 by @mpharrigan in #1578
- Fix expression for prepare.num_lt by @mpharrigan in #1577
- Add ctrl system for
LCUBlockEncoding
by @anurudhp in #1593 - Add ctrl system for
LinearCombination
by @anurudhp in #1595
New Contributors
- @shab5 made their first contribution in #1444
- @max-radin made their first contribution in #1521
- @mhucka made their first contribution in #1568
- @dandragona-dev made their first contribution in #1563
- @austingmhuang made their first contribution in #1559
Full Changelog: v0.5.0...v0.6.0