diff --git a/doc/releases/changelog-dev.md b/doc/releases/changelog-dev.md index 77b27fc09f0..563e74dd02a 100644 --- a/doc/releases/changelog-dev.md +++ b/doc/releases/changelog-dev.md @@ -4,74 +4,117 @@

New features since last release

-* Added a qml.capture module that will contain PennyLane's own capturing mechanism for hybrid - quantum-classical programs. - [(#5509)](https://github.com/PennyLaneAI/pennylane/pull/5509) +

Estimate errors in a quantum circuit 🧮

-* The `FABLE` template is added for efficient block encoding of matrices. Users can now call FABLE to efficiently construct circuits according to a user-set approximation level. -[(#5107)](https://github.com/PennyLaneAI/pennylane/pull/5107) +* Added `error` method to `QuantumPhaseEstimation` template. + [(#5278)](https://github.com/PennyLaneAI/pennylane/pull/5278) -* The `QubitDevice` class and children classes support the `dynamic_one_shot` transform provided that they support `MidMeasureMP` operations natively. - [(#5317)](https://github.com/PennyLaneAI/pennylane/pull/5317) +* Added new `SpectralNormError` class to the new error tracking functionality. + [(#5154)](https://github.com/PennyLaneAI/pennylane/pull/5154) -* `qml.ops.Sum` now supports storing grouping information. Grouping type and method can be - specified during construction using the `grouping_type` and `method` keyword arguments of - `qml.dot`, `qml.sum`, or `qml.ops.Sum`. The grouping indices are stored in `Sum.grouping_indices`. - [(#5179)](https://github.com/PennyLaneAI/pennylane/pull/5179) +* The `qml.TrotterProduct` operator now supports error estimation functionality. + [(#5384)](https://github.com/PennyLaneAI/pennylane/pull/5384) + + ```pycon + >>> hamiltonian = qml.dot([1.0, 0.5, -0.25], [qml.X(0), qml.Y(0), qml.Z(0)]) + >>> op = qml.TrotterProduct(hamiltonian, time=0.01, order=2) + >>> op.error(method="one-norm") + SpectralNormError(8.039062500000003e-06) + >>> + >>> op.error(method="commutator") + SpectralNormError(6.166666666666668e-06) + ``` + +* `qml.specs` and `qml.Tracker` now return information about algorithmic errors for the qnode as well. + [(#5464)](https://github.com/PennyLaneAI/pennylane/pull/5464) + [(#5465)](https://github.com/PennyLaneAI/pennylane/pull/5465) + + +

Access an extended arsenal of quantum algorithms 🏹

+ +* The `FABLE` template is added for efficient block encoding of matrices. Users can now call FABLE to efficiently construct circuits according to a user-set approximation level. + [(#5107)](https://github.com/PennyLaneAI/pennylane/pull/5107) + +* Create the `qml.Reflection` operator, useful for amplitude amplification and its variants. + [(#5159)](https://github.com/PennyLaneAI/pennylane/pull/5159) ```python - import pennylane as qml + @qml.prod + def generator(wires): + qml.Hadamard(wires=wires) - a = qml.X(0) - b = qml.prod(qml.X(0), qml.X(1)) - c = qml.Z(0) - obs = [a, b, c] - coeffs = [1.0, 2.0, 3.0] + U = generator(wires=0) + + dev = qml.device('default.qubit') + @qml.qnode(dev) + def circuit(): + + # Initialize to the state |1> + qml.PauliX(wires=0) + + # Apply the reflection + qml.Reflection(U) + + return qml.state() - op = qml.dot(coeffs, obs, grouping_type="qwc") ``` + ```pycon - >>> op.grouping_indices - ((2,), (0, 1)) + >>> circuit() + tensor([1.+6.123234e-17j, 0.-6.123234e-17j], requires_grad=True) ``` - - Additionally, grouping type and method can be set or changed after construction using - `Sum.compute_grouping()`: + +* The `qml.AmplitudeAmplification` operator is introduced, which is a high-level interface for amplitude amplification and its variants. + [(#5160)](https://github.com/PennyLaneAI/pennylane/pull/5160) ```python - import pennylane as qml + @qml.prod + def generator(wires): + for wire in wires: + qml.Hadamard(wires=wire) - a = qml.X(0) - b = qml.prod(qml.X(0), qml.X(1)) - c = qml.Z(0) - obs = [a, b, c] - coeffs = [1.0, 2.0, 3.0] + U = generator(wires=range(3)) + O = qml.FlipSign(2, wires=range(3)) + + dev = qml.device("default.qubit") + + @qml.qnode(dev) + def circuit(): + + generator(wires=range(3)) + qml.AmplitudeAmplification(U, O, iters=5, fixed_point=True, work_wire=3) + + return qml.probs(wires=range(3)) - op = qml.dot(coeffs, obs) ``` + ```pycon - >>> op.grouping_indices is None - True - >>> op.compute_grouping(grouping_type="qwc") - >>> op.grouping_indices - ((2,), (0, 1)) + >>> print(np.round(circuit(), 3)) + [0.013, 0.013, 0.91, 0.013, 0.013, 0.013, 0.013, 0.013] + ``` - Note that the grouping indices refer to the lists returned by `Sum.terms()`, not `Sum.operands`. +

Make use of more methods to map from molecules 🗺️

-* Added new `SpectralNormError` class to the new error tracking functionality. - [(#5154)](https://github.com/PennyLaneAI/pennylane/pull/5154) +* Added new function `qml.bravyi_kitaev` to map fermionic Hamiltonians to qubit Hamiltonians. + [(#5390)](https://github.com/PennyLaneAI/pennylane/pull/5390) -* Added `error` method to `QuantumPhaseEstimation` template. - [(#5278)](https://github.com/PennyLaneAI/pennylane/pull/5278) + ```python + import pennylane as qml + fermi_ham = qml.fermi.from_string('0+ 1-') -* The `dynamic_one_shot` transform is introduced enabling dynamic circuit execution on circuits with shots and devices that support `MidMeasureMP` operations natively. - [(#5266)](https://github.com/PennyLaneAI/pennylane/pull/5266) + qubit_ham = qml.bravyi_kitaev(fermi_ham, n=6) + ``` -* Added new function `qml.operation.convert_to_legacy_H` to convert `Sum`, `SProd`, and `Prod` to `Hamiltonian` instances. - [(#5309)](https://github.com/PennyLaneAI/pennylane/pull/5309) + ```pycon + >>> print(qubit_ham) + -0.25j * Y(0.0) + (-0.25+0j) * X(0) @ Z(1.0) + (0.25+0j) * X(0.0) + 0.25j * Y(0) @ Z(1.0) + ``` + +* The `qml.qchem.hf_state` function is upgraded to be compatible with the parity and Bravyi-Kitaev bases. + [(#5472)](https://github.com/PennyLaneAI/pennylane/pull/5472) -

Dynamical Lie Algebra functionality

+

Calculate dynamical Lie algebras 👾

* A new `qml.lie_closure` function to compute the Lie closure of a list of operators. [(#5161)](https://github.com/PennyLaneAI/pennylane/pull/5161) @@ -123,128 +166,97 @@ For example, we can compute the adjoint representation of the transverse field Ising model DLA. + ```pycon >>> dla = [X(0) @ X(1), Z(0), Z(1), Y(0) @ X(1), X(0) @ Y(1), Y(0) @ Y(1)] >>> structure_const = qml.structure_constants(dla) >>> structure_constp.shape (6, 6, 6) + ``` -

Improvements 🛠

+

Simulate mixed-state qutrit systems 3️⃣

-* Gradient transforms may now be applied to batched/broadcasted QNodes, as long as the - broadcasting is in non-trainable parameters. - [(#5452)](https://github.com/PennyLaneAI/pennylane/pull/5452) - -* Improve the performance of computing the matrix of `qml.QFT` - [(#5351)](https://github.com/PennyLaneAI/pennylane/pull/5351) - -* The `qml.is_commuting` function now accepts `Sum`, `SProd`, and `Prod` instances. - [(#5351)](https://github.com/PennyLaneAI/pennylane/pull/5351) +* Functions `measure_with_samples` and `sample_state` have been added to the new `qutrit_mixed` module found in + `qml.devices`. These functions are used to sample device-compatible states, returning either the final measured state or value of an observable. + [(#5082)](https://github.com/PennyLaneAI/pennylane/pull/5082) -* Operators can now be left multiplied `x * op` by numpy arrays. - [(#5361)](https://github.com/PennyLaneAI/pennylane/pull/5361) +* Fixed differentiability for Hamiltonian measurements in new `qutrit_mixed` module. + [(#5186)](https://github.com/PennyLaneAI/pennylane/pull/5186) -* Create the `qml.Reflection` operator, useful for amplitude amplification and its variants. - [(#5159)](https://github.com/PennyLaneAI/pennylane/pull/5159) +* Added `simulate` function to the new `qutrit_mixed` module in `qml.devices`. This allows for simulation of a + noisy qutrit circuit with measurement and sampling. + [(#5213)](https://github.com/PennyLaneAI/pennylane/pull/5213) - ```python - @qml.prod - def generator(wires): - qml.Hadamard(wires=wires) + * Created the `DefaultQutritMixed` class, which inherits from `qml.devices.Device`, with an implementation + for `preprocess`. + [(#5451)](https://github.com/PennyLaneAI/pennylane/pull/5451) - U = generator(wires=0) +

Work easily and efficiently with operators 🔧

- dev = qml.device('default.qubit') - @qml.qnode(dev) - def circuit(): +

Improvements 🛠

- # Initialize to the state |1> - qml.PauliX(wires=0) +

Community contributions 🥳

- # Apply the reflection - qml.Reflection(U) +* Implemented the method `process_counts` in `ExpectationMP`, `VarianceMP`, `CountsMP`, and `SampleMP` + [(#5256)](https://github.com/PennyLaneAI/pennylane/pull/5256) + [(#5395)](https://github.com/PennyLaneAI/pennylane/pull/5395) - return qml.state() +* Add type hints for unimplemented methods of the abstract class `Operator`. + [(#5490)](https://github.com/PennyLaneAI/pennylane/pull/5490) - ``` +* Implement `Shots.bins()` method. + [(#5476)](https://github.com/PennyLaneAI/pennylane/pull/5476) - ```pycon - >>> circuit() - tensor([1.+6.123234e-17j, 0.-6.123234e-17j], requires_grad=True) - ``` +

Updated operators

-* The `qml.AmplitudeAmplification` operator is introduced, which is a high-level interface for amplitude amplification and its variants. - [(#5160)](https://github.com/PennyLaneAI/pennylane/pull/5160) +* `qml.ops.Sum` now supports storing grouping information. Grouping type and method can be + specified during construction using the `grouping_type` and `method` keyword arguments of + `qml.dot`, `qml.sum`, or `qml.ops.Sum`. The grouping indices are stored in `Sum.grouping_indices`. + [(#5179)](https://github.com/PennyLaneAI/pennylane/pull/5179) ```python - @qml.prod - def generator(wires): - for wire in wires: - qml.Hadamard(wires=wire) - - U = generator(wires=range(3)) - O = qml.FlipSign(2, wires=range(3)) - - dev = qml.device("default.qubit") - - @qml.qnode(dev) - def circuit(): - - generator(wires=range(3)) - qml.AmplitudeAmplification(U, O, iters=5, fixed_point=True, work_wire=3) + import pennylane as qml - return qml.probs(wires=range(3)) + a = qml.X(0) + b = qml.prod(qml.X(0), qml.X(1)) + c = qml.Z(0) + obs = [a, b, c] + coeffs = [1.0, 2.0, 3.0] + op = qml.dot(coeffs, obs, grouping_type="qwc") ``` ```pycon - >>> print(np.round(circuit(), 3)) - [0.013, 0.013, 0.91, 0.013, 0.013, 0.013, 0.013, 0.013] - + >>> op.grouping_indices + ((2,), (0, 1)) ``` - -* Added new function `qml.bravyi_kitaev` to map fermionic Hamiltonians to qubit Hamiltonians. - [(#5390)](https://github.com/PennyLaneAI/pennylane/pull/5390) + Additionally, grouping type and method can be set or changed after construction using + `Sum.compute_grouping()`: ```python import pennylane as qml - fermi_ham = qml.fermi.from_string('0+ 1-') - qubit_ham = qml.bravyi_kitaev(fermi_ham, n=6) - ``` + a = qml.X(0) + b = qml.prod(qml.X(0), qml.X(1)) + c = qml.Z(0) + obs = [a, b, c] + coeffs = [1.0, 2.0, 3.0] - ```pycon - >>> print(qubit_ham) - -0.25j * Y(0.0) + (-0.25+0j) * X(0) @ Z(1.0) + (0.25+0j) * X(0.0) + 0.25j * Y(0) @ Z(1.0) + op = qml.dot(coeffs, obs) ``` - -* A new class `qml.ops.LinearCombination` is introduced. In essence, this class is an updated equivalent of `qml.ops.Hamiltonian` - but for usage with new operator arithmetic. - [(#5216)](https://github.com/PennyLaneAI/pennylane/pull/5216) - -* The `qml.TrotterProduct` operator now supports error estimation functionality. - [(#5384)](https://github.com/PennyLaneAI/pennylane/pull/5384) ```pycon - >>> hamiltonian = qml.dot([1.0, 0.5, -0.25], [qml.X(0), qml.Y(0), qml.Z(0)]) - >>> op = qml.TrotterProduct(hamiltonian, time=0.01, order=2) - >>> op.error(method="one-norm") - SpectralNormError(8.039062500000003e-06) - >>> - >>> op.error(method="commutator") - SpectralNormError(6.166666666666668e-06) + >>> op.grouping_indices is None + True + >>> op.compute_grouping(grouping_type="qwc") + >>> op.grouping_indices + ((2,), (0, 1)) ``` -

Improvements 🛠

-* `qml.ops.Conditional` now stores the `data`, `num_params`, and `ndim_param` attributes of - the operator it wraps. - [(#5473)](https://github.com/PennyLaneAI/pennylane/pull/5473) - -* `qml.transforms.broadcast_expand` now supports shot vectors when returning `qml.sample()`. - [(#5473)](https://github.com/PennyLaneAI/pennylane/pull/5473) + Note that the grouping indices refer to the lists returned by `Sum.terms()`, not `Sum.operands`. -* `LightningVJPs` is now compatible with Lightning devices using the new device API. - [(#5469)](https://github.com/PennyLaneAI/pennylane/pull/5469) +* Added new function `qml.operation.convert_to_legacy_H` to convert `Sum`, `SProd`, and `Prod` to `Hamiltonian` instances. + [(#5309)](https://github.com/PennyLaneAI/pennylane/pull/5309) * The `qml.is_commuting` function now accepts `Sum`, `SProd`, and `Prod` instances. [(#5351)](https://github.com/PennyLaneAI/pennylane/pull/5351) @@ -252,8 +264,9 @@ * Operators can now be left multiplied `x * op` by numpy arrays. [(#5361)](https://github.com/PennyLaneAI/pennylane/pull/5361) -* The `molecular_hamiltonian` function calls `PySCF` directly when `method='pyscf'` is selected. - [(#5118)](https://github.com/PennyLaneAI/pennylane/pull/5118) +* A new class `qml.ops.LinearCombination` is introduced. In essence, this class is an updated equivalent of `qml.ops.Hamiltonian` + but for usage with new operator arithmetic. + [(#5216)](https://github.com/PennyLaneAI/pennylane/pull/5216) * The generators in the source code return operators consistent with the global setting for `qml.operator.active_new_opmath()` wherever possible. `Sum`, `SProd` and `Prod` instances @@ -264,9 +277,6 @@ [(#5411)](https://github.com/PennyLaneAI/pennylane/pull/5411) [(#5421)](https://github.com/PennyLaneAI/pennylane/pull/5421) -* Upgraded `null.qubit` to the new device API. Also, added support for all measurements and various modes of differentiation. - [(#5211)](https://github.com/PennyLaneAI/pennylane/pull/5211) - * `ApproxTimeEvolution` is now compatible with any operator that defines a `pauli_rep`. [(#5362)](https://github.com/PennyLaneAI/pennylane/pull/5362) @@ -276,75 +286,77 @@ * `Prod.eigvals()` is now compatible with Qudit operators. [(#5400)](https://github.com/PennyLaneAI/pennylane/pull/5400) -* Obtaining classical shadows using the `default.clifford` device is now compatible with - [stim](https://github.com/quantumlib/Stim) `v1.13.0`. - [(#5409)](https://github.com/PennyLaneAI/pennylane/pull/5409) +* `qml.transforms.hamiltonian_expand` can now handle multi-term observables with a constant offset. + [(#5414)](https://github.com/PennyLaneAI/pennylane/pull/5414) -* `qml.specs` and `qml.Tracker` now return information about algorithmic errors for the qnode as well. - [(#5464)](https://github.com/PennyLaneAI/pennylane/pull/5464) - [(#5465)](https://github.com/PennyLaneAI/pennylane/pull/5465) +* `taper_operation` method is compatible with new operator arithmetic. + [(#5326)](https://github.com/PennyLaneAI/pennylane/pull/5326) -* `qml.specs` now returns information regarding algorithmic errors for the qnode as well. - [(#5464)](https://github.com/PennyLaneAI/pennylane/pull/5464) +* Removed the warning that an observable might not be hermitian in `qnode` executions. This enables jit-compilation. + [(#5506)](https://github.com/PennyLaneAI/pennylane/pull/5506) -* `qml.transforms.hamiltonian_expand` can now handle multi-term observables with a constant offset. - [(#5414)](https://github.com/PennyLaneAI/pennylane/pull/5414) +* `qml.transforms.split_non_commuting` will now work with single-term operator arithmetic. + [(#5314)](https://github.com/PennyLaneAI/pennylane/pull/5314) -* `default.mixed` has improved support for sampling-based measurements with non-numpy interfaces. - [(#5514)](https://github.com/PennyLaneAI/pennylane/pull/5514) +

Mid-circuit measurements and dynamic circuits

-* The `qml.qchem.hf_state` function is upgraded to be compatible with the parity and Bravyi-Kitaev bases. - [(#5472)](https://github.com/PennyLaneAI/pennylane/pull/5472) +* The `QubitDevice` class and children classes support the `dynamic_one_shot` transform provided that they support `MidMeasureMP` operations natively. + [(#5317)](https://github.com/PennyLaneAI/pennylane/pull/5317) -

Community contributions 🥳

+* The `dynamic_one_shot` transform is introduced enabling dynamic circuit execution on circuits with shots and devices that support `MidMeasureMP` operations natively. + [(#5266)](https://github.com/PennyLaneAI/pennylane/pull/5266) -* Functions `measure_with_samples` and `sample_state` have been added to the new `qutrit_mixed` module found in - `qml.devices`. These functions are used to sample device-compatible states, returning either the final measured state or value of an observable. - [(#5082)](https://github.com/PennyLaneAI/pennylane/pull/5082) +* Added a qml.capture module that will contain PennyLane's own capturing mechanism for hybrid + quantum-classical programs. + [(#5509)](https://github.com/PennyLaneAI/pennylane/pull/5509) -* Replaced `cache_execute` with an alternate implementation based on `@transform`. - [(#5318)](https://github.com/PennyLaneAI/pennylane/pull/5318) +

Performance and broadcasting

-* The `QNode` now defers `diff_method` validation to the device under the new device api `qml.devices.Device`. - [(#5176)](https://github.com/PennyLaneAI/pennylane/pull/5176) +* Gradient transforms may now be applied to batched/broadcasted QNodes, as long as the + broadcasting is in non-trainable parameters. + [(#5452)](https://github.com/PennyLaneAI/pennylane/pull/5452) -* `taper_operation` method is compatible with new operator arithmetic. - [(#5326)](https://github.com/PennyLaneAI/pennylane/pull/5326) +* Improve the performance of computing the matrix of `qml.QFT` + [(#5351)](https://github.com/PennyLaneAI/pennylane/pull/5351) -* `qml.transforms.split_non_commuting` will now work with single-term operator arithmetic. - [(#5314)](https://github.com/PennyLaneAI/pennylane/pull/5314) +* `qml.transforms.broadcast_expand` now supports shot vectors when returning `qml.sample()`. + [(#5473)](https://github.com/PennyLaneAI/pennylane/pull/5473) -* Fixed differentiability for Hamiltonian measurements in new `qutrit_mixed` module. - [(#5186)](https://github.com/PennyLaneAI/pennylane/pull/5186) - -* Added `simulate` function to the new `qutrit_mixed` module in `qml.devices`. This allows for simulation of a - noisy qutrit circuit with measurement and sampling. - [(#5213)](https://github.com/PennyLaneAI/pennylane/pull/5213) +* `LightningVJPs` is now compatible with Lightning devices using the new device API. + [(#5469)](https://github.com/PennyLaneAI/pennylane/pull/5469) -* Implemented the method `process_counts` in `ExpectationMP`, `VarianceMP`, `CountsMP`, and `SampleMP` - [(#5256)](https://github.com/PennyLaneAI/pennylane/pull/5256) - [(#5395)](https://github.com/PennyLaneAI/pennylane/pull/5395) +

Other improvements

+ +* `qml.ops.Conditional` now stores the `data`, `num_params`, and `ndim_param` attributes of + the operator it wraps. + [(#5473)](https://github.com/PennyLaneAI/pennylane/pull/5473) + +* The `molecular_hamiltonian` function calls `PySCF` directly when `method='pyscf'` is selected. + [(#5118)](https://github.com/PennyLaneAI/pennylane/pull/5118) + +* Upgraded `null.qubit` to the new device API. Also, added support for all measurements and various modes of differentiation. + [(#5211)](https://github.com/PennyLaneAI/pennylane/pull/5211) + +* Obtaining classical shadows using the `default.clifford` device is now compatible with + [stim](https://github.com/quantumlib/Stim) `v1.13.0`. + [(#5409)](https://github.com/PennyLaneAI/pennylane/pull/5409) + +* `default.mixed` has improved support for sampling-based measurements with non-numpy interfaces. + [(#5514)](https://github.com/PennyLaneAI/pennylane/pull/5514) + +* Replaced `cache_execute` with an alternate implementation based on `@transform`. + [(#5318)](https://github.com/PennyLaneAI/pennylane/pull/5318) + +* The `QNode` now defers `diff_method` validation to the device under the new device api `qml.devices.Device`. + [(#5176)](https://github.com/PennyLaneAI/pennylane/pull/5176) * Extend the device test suite to cover gradient methods, templates and arithmetic observables. [(#5273)](https://github.com/PennyLaneAI/pennylane/pull/5273) [(#5518)](https://github.com/PennyLaneAI/pennylane/pull/5518) -* Add type hints for unimplemented methods of the abstract class `Operator`. - [(#5490)](https://github.com/PennyLaneAI/pennylane/pull/5490) - * A clear error message is added in `KerasLayer` when using the newest version of TensorFlow with Keras 3 (which is not currently compatible with `KerasLayer`), linking to instructions to enable Keras 2. [(#5488)](https://github.com/PennyLaneAI/pennylane/pull/5488) - - * Created the `DefaultQutritMixed` class, which inherits from `qml.devices.Device`, with an implementation - for `preprocess`. - [(#5451)](https://github.com/PennyLaneAI/pennylane/pull/5451) - -* Removed the warning that an observable might not be hermitian in `qnode` executions. This enables jit-compilation. - [(#5506)](https://github.com/PennyLaneAI/pennylane/pull/5506) - -* Implement `Shots.bins()` method. - [(#5476)](https://github.com/PennyLaneAI/pennylane/pull/5476)

Breaking changes 💔