|
1 | 1 | # QDK Changelog |
2 | 2 |
|
| 3 | +## v1.26.0 |
| 4 | + |
| 5 | +Below are some of the highlights for the 1.26 release of the QDK. |
| 6 | + |
| 7 | +### Conditional branches in circuit diagrams |
| 8 | + |
| 9 | +With this release, branches based on measurement results (e.g., `if (M(q) == One) { ... }`) are now shown in circuit diagrams as classically controlled operations, with a label indicating the measurement result that triggers the branch. This makes it easier to understand the structure of algorithms that involve mid-circuit measurements and classical control flow. |
| 10 | + |
| 11 | +Note that the expression in the condition may result from complex processing on multiple measurement results, and the circuit will trace and correctly show the results involved in the condition, for example: |
| 12 | + |
| 13 | +```qsharp |
| 14 | +import Std.Math.PI; |
| 15 | +operation Main() : Result { |
| 16 | + use q = Qubit(); |
| 17 | + use reg = Qubit[2]; |
| 18 | +
|
| 19 | + ApplyToEach(H, reg); |
| 20 | + let num = MeasureInteger(reg); |
| 21 | +
|
| 22 | + if num == 3 { |
| 23 | + Y(q); |
| 24 | + } else { |
| 25 | + Rx(PI() / 4.0, q); |
| 26 | + } |
| 27 | +
|
| 28 | + MResetZ(q) |
| 29 | +} |
| 30 | +``` |
| 31 | + |
| 32 | +<img width="800" alt="image" src="https://github.com/user-attachments/assets/d9301b78-08ba-4ce8-a842-57c6261e895f" /> |
| 33 | + |
| 34 | +As with other circuit operations or gates, clicking on the box for a conditional branch will navigate to the corresponding source code location. |
| 35 | + |
| 36 | +### Quantum state visualizer in the circuit editor |
| 37 | + |
| 38 | +The [Quantum Circuit Editor](https://learn.microsoft.com/en-us/azure/quantum/qdk-circuit-editor) now includes a state visualizer panel that shows the resulting quantum state from running the circuit, with live updates as the circuit is edited. It visualizes the probability density and phase for each basis state. The panel may be collapsed or expanded by clicking on the vertical divider. |
| 39 | + |
| 40 | +<img width="824" alt="image" src="https://github.com/user-attachments/assets/83f5c6f1-7c7e-4631-9201-f9ea7f75e227" /> |
| 41 | + |
| 42 | +### Python improvements for language interop |
| 43 | + |
| 44 | +You can now import OpenQASM code and use it directly as a Q# operation via `import_openqasm`: |
| 45 | + |
| 46 | +```python |
| 47 | +from qdk.openqasm import import_openqasm |
| 48 | +from qdk import qsharp |
| 49 | + |
| 50 | +import_openqasm(""" |
| 51 | + include "stdgates.inc"; |
| 52 | + qubit[2] qs; |
| 53 | + h qs[0]; |
| 54 | + cx qs[0], qs[1]; |
| 55 | +""", name="Entangle") |
| 56 | + |
| 57 | +qsharp.eval("{ use qs = Qubit[2]; Entangle(qs); MResetEachZ(qs) }") |
| 58 | +# [One, One] |
| 59 | +``` |
| 60 | + |
| 61 | +The QDK now also supports passing Q# callables across the Python boundary, enabling advanced coding patterns for composable code. Continuing from the sample above, we can define a Q# operation that takes another operation as an argument, and pass the code we imported from OpenQASM: |
| 62 | + |
| 63 | +```python |
| 64 | +qsharp.eval(""" |
| 65 | +operation TestAntiCorrelation(entangler : Qubit[] => Unit) : Result[] { |
| 66 | + use qs = Qubit[2]; |
| 67 | + X(qs[1]); |
| 68 | + entangler(qs); |
| 69 | + MResetEachZ(qs) |
| 70 | +} |
| 71 | +""") |
| 72 | + |
| 73 | +from qsharp.code import Entangle, TestAntiCorrelation |
| 74 | + |
| 75 | +TestAntiCorrelation(Entangle) |
| 76 | +# [Zero, One] |
| 77 | +``` |
| 78 | + |
| 79 | +### Support for doc comments on struct fields |
| 80 | + |
| 81 | +Doc comments on struct fields are now shown in the hover text for the field in VS Code. See the description in the PR at [#2891](https://github.com/microsoft/qdk/pull/2891) for details. |
| 82 | + |
| 83 | +### New Table Lookup sample |
| 84 | + |
| 85 | +We added a [Hypercube Lookup](https://github.com/microsoft/qdk/pull/2910/changes) sample demonstrating usage of the recently added [table lookup library](https://github.com/microsoft/qdk/tree/main/library/table_lookup). See the extensive comments in the sample's [Main.qs](https://github.com/microsoft/qdk/blob/main/samples/algorithms/HypercubeLookup/src/Main.qs) file for details. |
| 86 | + |
| 87 | +## Other notable changes |
| 88 | + |
| 89 | +- Use 'build' package to build wheels by @idavis in [#2822]<https://github.com/microsoft/qdk/pull/2822> |
| 90 | +- Introduce a new lint: avoid block namespace by @filipw in [#2862]<https://github.com/microsoft/qdk/pull/2862> |
| 91 | +- Fix copilot histogram display by @billti in [#2886]<https://github.com/microsoft/qdk/pull/2886> |
| 92 | +- Show doc comments on hover of struct fields by @swernli in [#2891]<https://github.com/microsoft/qdk/pull/2891> |
| 93 | +- Creating an explicit namespace with the same name as a callable breaks Python interop by @swernli in [#2896]<https://github.com/microsoft/qdk/pull/2896> |
| 94 | +- Unresolved names in call expression avoid ambiguous type error by @swernli in [#2892]<https://github.com/microsoft/qdk/pull/2892> |
| 95 | +- Fix issue with shadowing in `qsharp.code` by @swernli in [#2908]<https://github.com/microsoft/qdk/pull/2908> |
| 96 | +- CSS updates by @billti in [#2899]<https://github.com/microsoft/qdk/pull/2899> |
| 97 | +- Fix `**kwargs` typehints by @orpuente-MS in [#2884]<https://github.com/microsoft/qdk/pull/2884> |
| 98 | +- Combine kernels for op application by @billti in [#2898]<https://github.com/microsoft/qdk/pull/2898> |
| 99 | +- Better feedback on incorrect syntax for qubit allocation by @swernli in [#2897]<https://github.com/microsoft/qdk/pull/2897> |
| 100 | +- Table lookup sample by @DmitryVasilevsky in [#2910]<https://github.com/microsoft/qdk/pull/2910> |
| 101 | +- Add QIR noise intrinsic by @orpuente-MS in [#2915]<https://github.com/microsoft/qdk/pull/2915> |
| 102 | +- Pointing to windows-2025 image on SDLSources stage by @igormasson in [#2918]<https://github.com/microsoft/qdk/pull/2918> |
| 103 | +- Ket Labels on Results from Azure by @ScottCarda-MS in [#2917]<https://github.com/microsoft/qdk/pull/2917> |
| 104 | +- Deprecate `borrow` keyword with Lint and Code-Action by @ScottCarda-MS in [#2929]<https://github.com/microsoft/qdk/pull/2929> |
| 105 | +- [VSCode] Update to latest Quantum DP and CP api-version by @xinyi-joffre in [#2922]<https://github.com/microsoft/qdk/pull/2922> |
| 106 | +- Atom visualizer improvements by @billti in [#2935]<https://github.com/microsoft/qdk/pull/2935> |
| 107 | +- Add `load_csv_dir` method to `NoiseConfig` class by @orpuente-MS in [#2928]<https://github.com/microsoft/qdk/pull/2928> |
| 108 | +- Added CY gate to GPU, CPU and Clifford simulators by @DmitryVasilevsky in [#2927]<https://github.com/microsoft/qdk/pull/2927> |
| 109 | +- Circuit Editor State Visualization Panel by @ScottCarda-MS in [#2870]<https://github.com/microsoft/qdk/pull/2870> |
| 110 | +- Allow Passing of Q# callables and closures in Python by @swernli in [#2940]<https://github.com/microsoft/qdk/pull/2940> |
| 111 | +- Use tagged aggregates in QIR by @swernli in [#2964]<https://github.com/microsoft/qdk/pull/2964> |
| 112 | +- Change `import_openqasm` to hoist qubits into the arguments of the generated Q# operation by @swernli in [#2920]<https://github.com/microsoft/qdk/pull/2920> |
| 113 | +- Sign vsix before publishing by @idavis in [#2967]<https://github.com/microsoft/qdk/pull/2967> |
| 114 | +- Get VSCode Extension, Manifest, and Signature files for Publishing by @idavis in [#2969]<https://github.com/microsoft/qdk/pull/2969> |
| 115 | +- Reset gate and MZ in addition to MResetZ in GPU simulator by @DmitryVasilevsky in [#2939]<https://github.com/microsoft/qdk/pull/2939> |
| 116 | +- Remove container creation when retrieving linked storage account from the service by @rigidit in [#2968]<https://github.com/microsoft/qdk/pull/2968> |
| 117 | +- Update azure-quantum Python dependency by @swernli in [#2976]<https://github.com/microsoft/qdk/pull/2976> |
| 118 | +- [Circuit Diagrams] 1 - RIR debug metadata by @minestarks in [#2942]<https://github.com/microsoft/qdk/pull/2942> |
| 119 | +- [Circuit Diagrams] 2 - ASCII art changes to render conditionals and complex groups by @minestarks in [#2944]<https://github.com/microsoft/qdk/pull/2944> |
| 120 | +- [Circuit Diagrams] 3 - SVG rendering changes for classically controlled circuits by @minestarks in [#2945]<https://github.com/microsoft/qdk/pull/2945> |
| 121 | +- [Circuit diagrams] 4 - Show conditionals in circuits based on RIR debug metadata by @minestarks in [#2943]<https://github.com/microsoft/qdk/pull/2943> |
| 122 | +- Fix zoom behavior in circuit diagrams by @minestarks in [#2979]<https://github.com/microsoft/qdk/pull/2979> |
| 123 | + |
| 124 | +## New Contributors |
| 125 | + |
| 126 | +- @igormasson made their first contribution in https://github.com/microsoft/qdk/pull/2918 |
| 127 | +- @rigidit made their first contribution in https://github.com/microsoft/qdk/pull/2968 |
| 128 | + |
| 129 | +**Full Changelog**: <https://github.com/microsoft/qdk/compare/v1.25.1...v1.26.0> |
| 130 | + |
3 | 131 | ## v1.25.1 |
4 | 132 |
|
5 | 133 | Below are some of the highlights for the 1.25 release of the QDK. |
|
0 commit comments