|
15 | 15 | The new function returns a tuple of four values, where the first three corresponds to the rotation |
16 | 16 | angles of the ZYZ decomposition of this operator, and the last one corresponds to the global phase. |
17 | 17 |
|
| 18 | +* :func:`~.specs` will now output symbolic resource information when it encounters a loop that uses dynamic control-flow |
| 19 | + that can't be resolved at compile time. |
| 20 | + In such cases the returned :class:`~.resource.CircuitSpecs` will contain :class:`~.resource.SymbolicSpecsResources` instances instead of the usual :class:`~.resource.SpecsResources` instances. |
| 21 | + |
| 22 | + ```python |
| 23 | + @qp.qjit(autograph=True) |
| 24 | + @qp.qnode(qp.device("lightning.qubit", wires=1)) |
| 25 | + def circuit(x): |
| 26 | + qp.Hadamard(0) |
| 27 | + qp.PauliX(0) |
| 28 | + for _ in range(x): |
| 29 | + qp.PauliX(0) |
| 30 | + return qp.expval(qp.PauliX(0)) |
| 31 | + |
| 32 | + specs_result = qp.specs(circuit, level=0)(5) |
| 33 | + ``` |
| 34 | + |
| 35 | + ```pycon |
| 36 | + >>> print(specs_result) |
| 37 | + Device: lightning.qubit |
| 38 | + Device wires: 1 |
| 39 | + Shots: Shots(total=None) |
| 40 | + Level: Before MLIR Passes |
| 41 | + <BLANKLINE> |
| 42 | + Symbolic Variables: a |
| 43 | + Wire allocations: 1 |
| 44 | + Total gates: a + 2 |
| 45 | + Gate counts: |
| 46 | + - Hadamard: 1 |
| 47 | + - PauliX: a + 1 |
| 48 | + Measurements: |
| 49 | + - expval(PauliX): 1 |
| 50 | + Depth: Not computed |
| 51 | + |
| 52 | + ``` |
| 53 | + |
| 54 | + These symbolic resources include expressions with variables which can substituted for concrete values to compute the associated resources for a circuit, via the ``subs`` method. |
| 55 | + |
| 56 | + ```pycon |
| 57 | + >>> res = specs_result.resources |
| 58 | + >>> print(res.subs(a=5)) |
| 59 | + Wire allocations: 1 |
| 60 | + Total gates: 7 |
| 61 | + Gate counts: |
| 62 | + - Hadamard: 1 |
| 63 | + - PauliX: 6 |
| 64 | + Measurements: |
| 65 | + - expval(PauliX): 1 |
| 66 | + Depth: Not computed |
| 67 | + |
| 68 | + ``` |
| 69 | + |
18 | 70 | * A new template for Fast Fermionic Fourier Transforms called :class:`~.FFFT` has been added. |
19 | 71 | This algorithm is based on [Ferris (2013)](https://arxiv.org/abs/1310.7605) and applies to |
20 | 72 | efficient simulation of quantum materials and chemistry systems. |
|
46 | 98 |
|
47 | 99 | Alongside the addition of :class:`~.FFFT`, a new operation called :class:`~.TwoWireFFT` |
48 | 100 | has been added to enable its implementation: the :class:`~.FFFT` operation is |
49 | | - decomposed recursively into :class:`~.FermionicSWAP` and :class:`~.TwoWireFFT` operations |
| 101 | + decomposed recursively into :class:`~.FermionicSWAP` and :class:`~.TwoWireFFT` operations |
50 | 102 | (two-site Fermionic Fourier transforms). |
51 | 103 |
|
52 | 104 | <h3>Improvements 🛠</h3> |
|
92 | 144 | ``` |
93 | 145 | [(#9368)](https://github.com/PennyLaneAI/pennylane/pull/9368) |
94 | 146 |
|
95 | | -* Updated `qp.registers` to accept empty registers (e.g., `qp.registers({"algo_wires": 5, "work_wires": 0})). |
| 147 | +* Updated `qp.registers` to accept empty registers (e.g., `qp.registers({"algo_wires": 5, "work_wires": 0})). |
96 | 148 | [(#9543)](https://github.com/PennyLaneAI/pennylane/pull/9543) |
97 | 149 |
|
98 | 150 | * Removed instances of using the deprecated way to set shots on a device `device(..., shots=...)`. |
|
150 | 202 | True |
151 | 203 |
|
152 | 204 | ``` |
153 | | - |
| 205 | + |
154 | 206 | * Created a new ``labs.templates.LeftClassicalComparator`` template for performing an inequality |
155 | 207 | test of a quantum register and an integer. |
156 | 208 | [(#9308)](https://github.com/PennyLaneAI/pennylane/pull/9308) |
|
175 | 227 | ) |
176 | 228 | return qp.sample(wires=3) |
177 | 229 | ``` |
178 | | - |
| 230 | + |
179 | 231 | ```pycon |
180 | 232 | >>> output = circuit(3, 2) |
181 | 233 | >>> print(bool(output)) # 3 >= 2 |
182 | 234 | True |
183 | | - |
| 235 | + |
184 | 236 | ``` |
185 | 237 |
|
186 | 238 | * Update phase gradient transforms to use ``BasisState`` instead of ``BasisEmbedding``. |
|
360 | 412 |
|
361 | 413 | <h3>Bug fixes 🐛</h3> |
362 | 414 |
|
| 415 | +* Fixed a bug in `change_op_basis` where `TypeError` raised within the body of callable inputs were |
| 416 | + accidentally being masked by internal try/except logic. |
| 417 | + [(#9552)](https://github.com/PennyLaneAI/pennylane/pull/9552) |
| 418 | + |
363 | 419 | * Fixed a bug in unary iteration in `Select` where work wires were not restored correctly |
364 | 420 | if the number of selected operators is notably smaller than the maximal capacity for the given |
365 | 421 | number of control wires. This bug only surfaced for `partial=False`. |
@@ -423,4 +479,5 @@ Andrija Paurevic, |
423 | 479 | Francesco Pernice Botta, |
424 | 480 | Jay Soni, |
425 | 481 | Paul Haochen Wang, |
426 | | -David Wierichs. |
| 482 | +David Wierichs, |
| 483 | +Jake Zaia. |
0 commit comments