Skip to content

Classiq 1.36.0

Latest

Choose a tag to compare

@skis31 skis31 released this 17 Nov 12:09
· 72 commits to main since this release

Enhancements

  • Synthesis: The ripple-carry adder implementations of canonical_add_constant now keep the constant classical, so an n-qubit target needs n - 3 auxiliary qubits instead of up to n + 1. With fewer available, synthesis can now use the Häner-Roetteler-Svore adder (arXiv:1611.07995), and otherwise the QFT adder.
  • Language:
    • Added the khattar_gidney_linear_depth_mcx(ctrl, target), khattar_gidney_log_depth_mcx(ctrl, target), and khattar_gidney_hybrid_mcx(num_auxiliaries, ctrl, target) functions, which implement the multi-controlled X constructions of Khattar and Gidney (Quantum 9, 1752 (2025)), integrated into mcx in version 1.35. For n ≥ 3 controls, each allocates its own auxiliary qubits and releases them clean: the linear-depth variant uses one for O(n) Toffoli gates in O(n) layers, the log-depth variant uses two to cut the depth to O(log n) layers, and the hybrid variant uses at most num_auxiliaries to minimize its layers.
    • Added the add_constant_hrs(left, right) function, which applies the Häner-Roetteler-Svore adder (arXiv:1611.07995) on its own.
    • Added the r1tof(ctrl1, ctrl2, target) function, a relative-phase Toffoli that flips target like CCX using 3 CX gates instead of 6. Its result matches CCX up to a phase that depends on the basis state, so it can replace CCX wherever a compute and its uncompute cancel that phase. Unlike CCX, its two controls are not interchangeable.

Bug Fixes

  • Synthesis:
    • Fixed wrong gate angles in the circuit of a model that applies ^ to a function parameter or a loop variable. Expressions of this kind with &, |, <<, >>, or ~ no longer raise an error.
    • Fixed an error, such as "Quantum bit is not subscriptable", raised for a model in which sibling blocks declare local variables with the same name and different types, including inside invert, power, and within_apply.

Interface Changes

  • canonical_add_constant and add_constant_qft: Changed the left argument from an integer to a list of bits, ordered from least to most significant. For example, canonical_add_constant([False, True, True], x) adds 6 to x.
  • add_constant_ripple_carry_cdkm: Renamed to add_constant_ripple_carry. Removed the aux argument from it and from add_constant_ripple_carry_shallow, and changed their left argument to a list of bits.
  • Synthesis: Preferences.standalone now defaults to True, so the compiled Qmod of a synthesized quantum program includes the definitions of all the core-library functions it uses. To keep the previous behavior, set standalone=False.