From 5385f8c965bea6ef209ea4f37493b27cabcc0057 Mon Sep 17 00:00:00 2001 From: trbromley Date: Wed, 4 Oct 2023 13:07:37 -0400 Subject: [PATCH 01/33] Add --- doc/releases/changelog-dev.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/doc/releases/changelog-dev.md b/doc/releases/changelog-dev.md index b526ea59d9d..064dbdb3029 100644 --- a/doc/releases/changelog-dev.md +++ b/doc/releases/changelog-dev.md @@ -4,6 +4,12 @@

New features since last release

+

Decompose circuits into the Clifford+T gateset 🧩

+ +

Postselection on results of mid-circuit measurement πŸ“Œ

+ +

Exponentiate Hamiltonians with flexible Trotter products 🀩

+ * Support drawing QJIT QNode from Catalyst. [(#4609)](https://github.com/PennyLaneAI/pennylane/pull/4609) From 0add950ece3d06c1916c5caeeb8f802b4c827dae Mon Sep 17 00:00:00 2001 From: trbromley Date: Wed, 4 Oct 2023 13:29:38 -0400 Subject: [PATCH 02/33] Reorganize --- doc/releases/changelog-dev.md | 180 ++++++++++++++++++---------------- 1 file changed, 98 insertions(+), 82 deletions(-) diff --git a/doc/releases/changelog-dev.md b/doc/releases/changelog-dev.md index 064dbdb3029..7b1d0b7c3af 100644 --- a/doc/releases/changelog-dev.md +++ b/doc/releases/changelog-dev.md @@ -6,10 +6,35 @@

Decompose circuits into the Clifford+T gateset 🧩

-

Postselection on results of mid-circuit measurement πŸ“Œ

+

Postselection and statistics in mid-circuit measurements πŸ“Œ

+ +* Measurement statistics can now be collected for mid-circuit measurements. Currently, + `qml.expval`, `qml.var`, `qml.probs`, `qml.sample`, and `qml.counts` are supported on + `default.qubit`, `default.mixed`, and the new `DefaultQubit2` device. + [(#4544)](https://github.com/PennyLaneAI/pennylane/pull/4544) + + ```python + dev = qml.device("default.qubit", wires=2) + + @qml.qnode(dev) + def circ(x, y): + qml.RX(x, wires=0) + qml.RY(y, wires=1) + m0 = qml.measure(1) + return qml.expval(qml.PauliZ(0)), qml.sample(m0) + ``` + + QNodes can be executed as usual when collecting mid-circuit measurement statistics: + + ```pycon + >>> circ(1.0, 2.0, shots=5) + (array(0.6), array([1, 1, 1, 0, 1])) + ```

Exponentiate Hamiltonians with flexible Trotter products 🀩

+

New device capabilities, integration with Catalyst, and more! βš—οΈ

+ * Support drawing QJIT QNode from Catalyst. [(#4609)](https://github.com/PennyLaneAI/pennylane/pull/4609) @@ -39,28 +64,26 @@ "0: ──RX──H─── \n1: ──H───RY── \n2: ──RZ────── " ``` -* Measurement statistics can now be collected for mid-circuit measurements. Currently, - `qml.expval`, `qml.var`, `qml.probs`, `qml.sample`, and `qml.counts` are supported on - `default.qubit`, `default.mixed`, and the new `DefaultQubit2` device. - [(#4544)](https://github.com/PennyLaneAI/pennylane/pull/4544) +* `default.qubit` now implements the new device API. The old version of the device is still + accessible by the short name `default.qubit.legacy`, or directly via `qml.devices.DefaultQubitLegacy`. + [(#4594)](https://github.com/PennyLaneAI/pennylane/pull/4594) + [(#4436)](https://github.com/PennyLaneAI/pennylane/pull/4436) + [(#4620)](https://github.com/PennyLaneAI/pennylane/pull/4620) + [(#4632)](https://github.com/PennyLaneAI/pennylane/pull/4632) - ```python - dev = qml.device("default.qubit", wires=2) + TODO - @qml.qnode(dev) - def circ(x, y): - qml.RX(x, wires=0) - qml.RY(y, wires=1) - m0 = qml.measure(1) - return qml.expval(qml.PauliZ(0)), qml.sample(m0) - ``` +* Extended ``qml.qchem.import_state`` to import wavefunctions from MPS DMRG and SHCI classical + calculations performed with the Block2 and Dice libraries, incorporating new tests and wavefunction + input selection logic. + [#4523](https://github.com/PennyLaneAI/pennylane/pull/4523) + [#4524](https://github.com/PennyLaneAI/pennylane/pull/4524) + [#4626](https://github.com/PennyLaneAI/pennylane/pull/4626) + [#4634](https://github.com/PennyLaneAI/pennylane/pull/4634) - QNodes can be executed as usual when collecting mid-circuit measurement statistics: +

Improvements πŸ› 

- ```pycon - >>> circ(1.0, 2.0, shots=5) - (array(0.6), array([1, 1, 1, 0, 1])) - ``` +

Transforms

* Operator transforms `qml.matrix`, `qml.eigvals`, `qml.generator`, and `qml.transforms.to_zx` are updated to the new transform program system. @@ -75,14 +98,13 @@ * Quantum information transforms are updated to the new transform program system. [(#4569)](https://github.com/PennyLaneAI/pennylane/pull/4569) -* `default.qubit` now implements the new device API. The old version of the device is still - accessible by the short name `default.qubit.legacy`, or directly via `qml.devices.DefaultQubitLegacy`. - [(#4594)](https://github.com/PennyLaneAI/pennylane/pull/4594) - [(#4436)](https://github.com/PennyLaneAI/pennylane/pull/4436) - [(#4620)](https://github.com/PennyLaneAI/pennylane/pull/4620) - [(#4632)](https://github.com/PennyLaneAI/pennylane/pull/4632) +* Add the method ``add_transform`` and ``insert_front_transform`` transform in the ``TransformProgram``. + [(#4559)](https://github.com/PennyLaneAI/pennylane/pull/4559) -

Improvements πŸ› 

+* Dunder ``__add__`` method is added to the ``TransformProgram`` class, therefore two programs can be added using ``+`` . + [(#4549)](https://github.com/PennyLaneAI/pennylane/pull/4549) + +

Next-generation device API

* `default.qubit` now tracks the number of equivalent qpu executions and total shots when the device is sampling. Note that `"simulations"` denotes the number of simulation passes, where as @@ -93,58 +115,28 @@ have been added to `pennylane.interfaces.jacobian_products`. [(#4435)](https://github.com/PennyLaneAI/pennylane/pull/4435) -* Extended ``qml.qchem.import_state`` to import wavefunctions from MPS DMRG and SHCI classical - calculations performed with the Block2 and Dice libraries, incorporating new tests and wavefunction - input selection logic. - [#4523](https://github.com/PennyLaneAI/pennylane/pull/4523) - [#4524](https://github.com/PennyLaneAI/pennylane/pull/4524) - [#4626](https://github.com/PennyLaneAI/pennylane/pull/4626) - [#4634](https://github.com/PennyLaneAI/pennylane/pull/4634) - -* `MeasurementProcess` and `QuantumScript` objects are now registered as jax pytrees. - [(#4607)](https://github.com/PennyLaneAI/pennylane/pull/4607) - [(#4608)](https://github.com/PennyLaneAI/pennylane/pull/4608) - -* Tensor-network template `qml.MPS` now supports changing `offset` between subsequent blocks for more flexibility. - [(#4531)](https://github.com/PennyLaneAI/pennylane/pull/4531) - -* The qchem ``fermionic_dipole`` and ``particle_number`` functions are updated to use a - ``FermiSentence``. The deprecated features for using tuples to represent fermionic operations are - removed. - [(#4546)](https://github.com/PennyLaneAI/pennylane/pull/4546) - [(#4556)](https://github.com/PennyLaneAI/pennylane/pull/4556) - -* Add the method ``add_transform`` and ``insert_front_transform`` transform in the ``TransformProgram``. - [(#4559)](https://github.com/PennyLaneAI/pennylane/pull/4559) - -* Dunder ``__add__`` method is added to the ``TransformProgram`` class, therefore two programs can be added using ``+`` . - [(#4549)](https://github.com/PennyLaneAI/pennylane/pull/4549) - * `qml.sample()` in the new device API now returns a `np.int64` array instead of `np.bool8`. [(#4539)](https://github.com/PennyLaneAI/pennylane/pull/4539) -* Wires can be provided to the new device API. - [(#4538)](https://github.com/PennyLaneAI/pennylane/pull/4538) - [(#4562)](https://github.com/PennyLaneAI/pennylane/pull/4562) - * The new device API now has a `repr()` [(#4562)](https://github.com/PennyLaneAI/pennylane/pull/4562) -* The density matrix aspects of `StateMP` have been split into their own measurement - process, `DensityMatrixMP`. - [(#4558)](https://github.com/PennyLaneAI/pennylane/pull/4558) +* Wires can be provided to the new device API. + [(#4538)](https://github.com/PennyLaneAI/pennylane/pull/4538) + [(#4562)](https://github.com/PennyLaneAI/pennylane/pull/4562) -* `qml.exp` returns a more informative error message when decomposition is unavailable for non-unitary operator. - [(#4571)](https://github.com/PennyLaneAI/pennylane/pull/4571) +* `DefaultQubit2` can now accept a `jax.random.PRNGKey` as a `seed`, to set the key for the JAX pseudo random + number generator when using the JAX interface. This corresponds to the `prng_key` on + `DefaultQubitJax` in the old API. + [(#4596)](https://github.com/PennyLaneAI/pennylane/pull/4596) -* The `StateMP` measurement now accepts a wire order (eg. a device wire order). The `process_state` - method will re-order the given state to go from the inputted wire-order to the process's wire-order. - If the process's wire-order contains extra wires, it will assume those are in the zero-state. - [(#4570)](https://github.com/PennyLaneAI/pennylane/pull/4570) - [(#4602)](https://github.com/PennyLaneAI/pennylane/pull/4602) +* DefaultQubit2 dispatches to a faster implementation for applying `ParametrizedEvolution` to a state + when it is more efficient to evolve the state than the operation matrix. + [(#4598)](https://github.com/PennyLaneAI/pennylane/pull/4598) + [(#4620)](https://github.com/PennyLaneAI/pennylane/pull/4620) -* Improve builtin types support with `qml.pauli_decompose`. - [(#4577)](https://github.com/PennyLaneAI/pennylane/pull/4577) +* `DefaultQubit2` now works as expected with measurement processes that don't specify wires. + [(#4580)](https://github.com/PennyLaneAI/pennylane/pull/4580) * Various changes to measurements to improve feature parity between the legacy `default.qubit` and the new `DefaultQubit2`. This includes not trying to squeeze batched `CountsMP` results and implementing @@ -155,31 +147,55 @@ specifies an interface, the result will be computed with that interface. [(#4582)](https://github.com/PennyLaneAI/pennylane/pull/4582) -* `DefaultQubit2` now works as expected with measurement processes that don't specify wires. - [(#4580)](https://github.com/PennyLaneAI/pennylane/pull/4580) +* `ShotAdaptiveOptimizer` has been updated to pass shots to QNode executions instead of overriding + device shots before execution. This makes it compatible with the new device API. + [(#4599)](https://github.com/PennyLaneAI/pennylane/pull/4599) + +

More PyTrees!

+ +* `MeasurementProcess` and `QuantumScript` objects are now registered as jax pytrees. + [(#4607)](https://github.com/PennyLaneAI/pennylane/pull/4607) + [(#4608)](https://github.com/PennyLaneAI/pennylane/pull/4608) + + TODO + +

Improving QChem and existing algorithms

+ +* The qchem ``fermionic_dipole`` and ``particle_number`` functions are updated to use a + ``FermiSentence``. The deprecated features for using tuples to represent fermionic operations are + removed. + [(#4546)](https://github.com/PennyLaneAI/pennylane/pull/4546) + [(#4556)](https://github.com/PennyLaneAI/pennylane/pull/4556) + +* Tensor-network template `qml.MPS` now supports changing `offset` between subsequent blocks for more flexibility. + [(#4531)](https://github.com/PennyLaneAI/pennylane/pull/4531) + +* Improve builtin types support with `qml.pauli_decompose`. + [(#4577)](https://github.com/PennyLaneAI/pennylane/pull/4577) * `AmplitudeEmbedding` now inherits from `StatePrep`, allowing for it to not be decomposed when at the beginning of a circuit, thus behaving like `StatePrep`. [(#4583)](https://github.com/PennyLaneAI/pennylane/pull/4583) -* `DefaultQubit2` can now accept a `jax.random.PRNGKey` as a `seed`, to set the key for the JAX pseudo random - number generator when using the JAX interface. This corresponds to the `prng_key` on - `DefaultQubitJax` in the old API. - [(#4596)](https://github.com/PennyLaneAI/pennylane/pull/4596) +

Other improvements

-* DefaultQubit2 dispatches to a faster implementation for applying `ParametrizedEvolution` to a state - when it is more efficient to evolve the state than the operation matrix. - [(#4598)](https://github.com/PennyLaneAI/pennylane/pull/4598) - [(#4620)](https://github.com/PennyLaneAI/pennylane/pull/4620) +* The density matrix aspects of `StateMP` have been split into their own measurement + process, `DensityMatrixMP`. + [(#4558)](https://github.com/PennyLaneAI/pennylane/pull/4558) -* `ShotAdaptiveOptimizer` has been updated to pass shots to QNode executions instead of overriding - device shots before execution. This makes it compatible with the new device API. - [(#4599)](https://github.com/PennyLaneAI/pennylane/pull/4599) +* The `StateMP` measurement now accepts a wire order (eg. a device wire order). The `process_state` + method will re-order the given state to go from the inputted wire-order to the process's wire-order. + If the process's wire-order contains extra wires, it will assume those are in the zero-state. + [(#4570)](https://github.com/PennyLaneAI/pennylane/pull/4570) + [(#4602)](https://github.com/PennyLaneAI/pennylane/pull/4602) * `StateMeasurement.process_state` now assumes the input is flat. `ProbabilityMP.process_state` has been updated to reflect this assumption and avoid redundant reshaping. [(#4602)](https://github.com/PennyLaneAI/pennylane/pull/4602) +* `qml.exp` returns a more informative error message when decomposition is unavailable for non-unitary operator. + [(#4571)](https://github.com/PennyLaneAI/pennylane/pull/4571) + * Added `qml.math.get_deep_interface` to get the interface of a scalar hidden deep in lists or tuples. [(#4603)](https://github.com/PennyLaneAI/pennylane/pull/4603) From 09eceee6351a79d5887910872cf557ebb3f7d50a Mon Sep 17 00:00:00 2001 From: trbromley Date: Wed, 4 Oct 2023 13:41:36 -0400 Subject: [PATCH 03/33] Reorder --- doc/releases/changelog-dev.md | 96 +++++++++++++++++------------------ 1 file changed, 48 insertions(+), 48 deletions(-) diff --git a/doc/releases/changelog-dev.md b/doc/releases/changelog-dev.md index 7b1d0b7c3af..00d51c43c04 100644 --- a/doc/releases/changelog-dev.md +++ b/doc/releases/changelog-dev.md @@ -83,14 +83,18 @@

Improvements πŸ› 

-

Transforms

+

More PyTrees!

-* Operator transforms `qml.matrix`, `qml.eigvals`, `qml.generator`, and `qml.transforms.to_zx` are updated - to the new transform program system. - [(#4573)](https://github.com/PennyLaneAI/pennylane/pull/4573) +* `MeasurementProcess` and `QuantumScript` objects are now registered as JAX PyTrees. + [(#4607)](https://github.com/PennyLaneAI/pennylane/pull/4607) + [(#4608)](https://github.com/PennyLaneAI/pennylane/pull/4608) + + TODO + +

Transforms

* All quantum functions transforms are update to the new transform program system. - [(#4439)](https://github.com/PennyLaneAI/pennylane/pull/4439) + [(#4439)](https://github.com/PennyLaneAI/pennylane/pull/4439) * All batch transforms are updated to the new transform program system. [(#4440)](https://github.com/PennyLaneAI/pennylane/pull/4440) @@ -98,43 +102,61 @@ * Quantum information transforms are updated to the new transform program system. [(#4569)](https://github.com/PennyLaneAI/pennylane/pull/4569) +* Operator transforms `qml.matrix`, `qml.eigvals`, `qml.generator`, and `qml.transforms.to_zx` are updated + to the new transform program system. + [(#4573)](https://github.com/PennyLaneAI/pennylane/pull/4573) + * Add the method ``add_transform`` and ``insert_front_transform`` transform in the ``TransformProgram``. [(#4559)](https://github.com/PennyLaneAI/pennylane/pull/4559) * Dunder ``__add__`` method is added to the ``TransformProgram`` class, therefore two programs can be added using ``+`` . [(#4549)](https://github.com/PennyLaneAI/pennylane/pull/4549) -

Next-generation device API

+

Improving QChem and existing algorithms

-* `default.qubit` now tracks the number of equivalent qpu executions and total shots - when the device is sampling. Note that `"simulations"` denotes the number of simulation passes, where as - `"executions"` denotes how many different computational bases need to be sampled in. - [(#4628)](https://github.com/PennyLaneAI/pennylane/pull/4628) +* The qchem ``fermionic_dipole`` and ``particle_number`` functions are updated to use a + ``FermiSentence``. The deprecated features for using tuples to represent fermionic operations are + removed. + [(#4546)](https://github.com/PennyLaneAI/pennylane/pull/4546) + [(#4556)](https://github.com/PennyLaneAI/pennylane/pull/4556) -* The `JacobianProductCalculator` abstract base class and implementation `TransformJacobianProducts` - have been added to `pennylane.interfaces.jacobian_products`. - [(#4435)](https://github.com/PennyLaneAI/pennylane/pull/4435) +* Tensor-network template `qml.MPS` now supports changing `offset` between subsequent blocks for more flexibility. + [(#4531)](https://github.com/PennyLaneAI/pennylane/pull/4531) -* `qml.sample()` in the new device API now returns a `np.int64` array instead of `np.bool8`. - [(#4539)](https://github.com/PennyLaneAI/pennylane/pull/4539) +* Improve builtin types support with `qml.pauli_decompose`. + [(#4577)](https://github.com/PennyLaneAI/pennylane/pull/4577) -* The new device API now has a `repr()` - [(#4562)](https://github.com/PennyLaneAI/pennylane/pull/4562) +* `AmplitudeEmbedding` now inherits from `StatePrep`, allowing for it to not be decomposed + when at the beginning of a circuit, thus behaving like `StatePrep`. + [(#4583)](https://github.com/PennyLaneAI/pennylane/pull/4583) -* Wires can be provided to the new device API. - [(#4538)](https://github.com/PennyLaneAI/pennylane/pull/4538) - [(#4562)](https://github.com/PennyLaneAI/pennylane/pull/4562) +

Next-generation device API

+ +* `default.qubit` now tracks the number of equivalent QPU executions and total shots + when the device is sampling. Note that `"simulations"` denotes the number of simulation passes, where as + `"executions"` denotes how many different computational bases need to be sampled in. + [(#4628)](https://github.com/PennyLaneAI/pennylane/pull/4628) * `DefaultQubit2` can now accept a `jax.random.PRNGKey` as a `seed`, to set the key for the JAX pseudo random number generator when using the JAX interface. This corresponds to the `prng_key` on `DefaultQubitJax` in the old API. [(#4596)](https://github.com/PennyLaneAI/pennylane/pull/4596) -* DefaultQubit2 dispatches to a faster implementation for applying `ParametrizedEvolution` to a state +* `DefaultQubit2` dispatches to a faster implementation for applying `ParametrizedEvolution` to a state when it is more efficient to evolve the state than the operation matrix. [(#4598)](https://github.com/PennyLaneAI/pennylane/pull/4598) [(#4620)](https://github.com/PennyLaneAI/pennylane/pull/4620) +* Wires can be provided to the new device API. + [(#4538)](https://github.com/PennyLaneAI/pennylane/pull/4538) + [(#4562)](https://github.com/PennyLaneAI/pennylane/pull/4562) + +* `qml.sample()` in the new device API now returns a `np.int64` array instead of `np.bool8`. + [(#4539)](https://github.com/PennyLaneAI/pennylane/pull/4539) + +* The new device API now has a `repr()` + [(#4562)](https://github.com/PennyLaneAI/pennylane/pull/4562) + * `DefaultQubit2` now works as expected with measurement processes that don't specify wires. [(#4580)](https://github.com/PennyLaneAI/pennylane/pull/4580) @@ -151,39 +173,17 @@ device shots before execution. This makes it compatible with the new device API. [(#4599)](https://github.com/PennyLaneAI/pennylane/pull/4599) -

More PyTrees!

- -* `MeasurementProcess` and `QuantumScript` objects are now registered as jax pytrees. - [(#4607)](https://github.com/PennyLaneAI/pennylane/pull/4607) - [(#4608)](https://github.com/PennyLaneAI/pennylane/pull/4608) - - TODO - -

Improving QChem and existing algorithms

- -* The qchem ``fermionic_dipole`` and ``particle_number`` functions are updated to use a - ``FermiSentence``. The deprecated features for using tuples to represent fermionic operations are - removed. - [(#4546)](https://github.com/PennyLaneAI/pennylane/pull/4546) - [(#4556)](https://github.com/PennyLaneAI/pennylane/pull/4556) - -* Tensor-network template `qml.MPS` now supports changing `offset` between subsequent blocks for more flexibility. - [(#4531)](https://github.com/PennyLaneAI/pennylane/pull/4531) - -* Improve builtin types support with `qml.pauli_decompose`. - [(#4577)](https://github.com/PennyLaneAI/pennylane/pull/4577) - -* `AmplitudeEmbedding` now inherits from `StatePrep`, allowing for it to not be decomposed - when at the beginning of a circuit, thus behaving like `StatePrep`. - [(#4583)](https://github.com/PennyLaneAI/pennylane/pull/4583) -

Other improvements

+* The `JacobianProductCalculator` abstract base class and implementation `TransformJacobianProducts` + have been added to `pennylane.interfaces.jacobian_products`. + [(#4435)](https://github.com/PennyLaneAI/pennylane/pull/4435) + * The density matrix aspects of `StateMP` have been split into their own measurement process, `DensityMatrixMP`. [(#4558)](https://github.com/PennyLaneAI/pennylane/pull/4558) -* The `StateMP` measurement now accepts a wire order (eg. a device wire order). The `process_state` +* The `StateMP` measurement now accepts a wire order (e.g., a device wire order). The `process_state` method will re-order the given state to go from the inputted wire-order to the process's wire-order. If the process's wire-order contains extra wires, it will assume those are in the zero-state. [(#4570)](https://github.com/PennyLaneAI/pennylane/pull/4570) From 4ac1ef9a539ec1582d291b158a60d931256fbe44 Mon Sep 17 00:00:00 2001 From: trbromley Date: Wed, 4 Oct 2023 13:49:24 -0400 Subject: [PATCH 04/33] Reorder --- doc/releases/changelog-dev.md | 40 +++++++++++++++++------------------ 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/doc/releases/changelog-dev.md b/doc/releases/changelog-dev.md index 00d51c43c04..cd6db0a76fb 100644 --- a/doc/releases/changelog-dev.md +++ b/doc/releases/changelog-dev.md @@ -205,12 +205,11 @@

Breaking changes πŸ’”

-* The device test suite now converts device kwargs to integers or floats if they can be converted to integers or floats. - [(#4640)](https://github.com/PennyLaneAI/pennylane/pull/4640) - -* `MeasurementProcess.eigvals()` now raises an `EigvalsUndefinedError` if the measurement observable - does not have eigenvalues. - [(#4544)](https://github.com/PennyLaneAI/pennylane/pull/4544) +* `default.qubit` now implements the new device API. If you initialize a device + with `qml.device("default.qubit")`, all methods and properties that were tied to the old + device API will no longer be on the device. The legacy version can still be accessed with + `qml.device("default.qubit.legacy", wires=n_wires)`. + [(#4436)](https://github.com/PennyLaneAI/pennylane/pull/4436) * The `__eq__` and `__hash__` methods of `Operator` and `MeasurementProcess` no longer rely on the object's address is memory. Using `==` with operators and measurement processes will now behave the @@ -270,14 +269,6 @@ * The CV observables ``qml.X`` and ``qml.P`` are removed. Please use ``qml.QuadX`` and ``qml.QuadP`` instead. [(#4533)](https://github.com/PennyLaneAI/pennylane/pull/4533) -* The method ``tape.unwrap()`` and corresponding ``UnwrapTape`` and ``Unwrap`` classes are removed. - Instead of ``tape.unwrap()``, use :func:`~.transforms.convert_to_numpy_parameters`. - [(#4535)](https://github.com/PennyLaneAI/pennylane/pull/4535) - -* The ``RandomLayers.compute_decomposition`` keyword argument ``ratio_imprivitive`` has been changed to - ``ratio_imprim`` to match the call signature of the operation. - [(#4552)](https://github.com/PennyLaneAI/pennylane/pull/4552) - * The ``sampler_seed`` argument of ``qml.gradients.spsa_grad`` has been removed. Instead, the ``sampler_rng`` argument should be set, either to an integer value, which will be used to create a PRNG internally, or to a NumPy pseudo-random number generator (PRNG) created via @@ -288,6 +279,21 @@ been removed. Please use ``QuantumScript.bind_new_parameters`` instead. [(#4548)](https://github.com/PennyLaneAI/pennylane/pull/4548) +* The method ``tape.unwrap()`` and corresponding ``UnwrapTape`` and ``Unwrap`` classes are removed. + Instead of ``tape.unwrap()``, use ``qml.transforms.convert_to_numpy_parameters``. + [(#4535)](https://github.com/PennyLaneAI/pennylane/pull/4535) + +* `MeasurementProcess.eigvals()` now raises an `EigvalsUndefinedError` if the measurement observable + does not have eigenvalues. + [(#4544)](https://github.com/PennyLaneAI/pennylane/pull/4544) + +* The device test suite now converts device kwargs to integers or floats if they can be converted to integers or floats. + [(#4640)](https://github.com/PennyLaneAI/pennylane/pull/4640) + +* The ``RandomLayers.compute_decomposition`` keyword argument ``ratio_imprivitive`` has been changed to + ``ratio_imprim`` to match the call signature of the operation. + [(#4552)](https://github.com/PennyLaneAI/pennylane/pull/4552) + * The private `TmpPauliRot` operator used for `SpecialUnitary` no longer decomposes to nothing when the theta value is trainable. [(#4585)](https://github.com/PennyLaneAI/pennylane/pull/4585) @@ -296,12 +302,6 @@ which effectively just called `marginal_prob` with `np.abs(state) ** 2`. [(#4602)](https://github.com/PennyLaneAI/pennylane/pull/4602) -* `default.qubit` now implements the new device API. If you initialize a device - with `qml.device("default.qubit")`, all functions and properties that were tied to the old - device API will no longer be on the device. The legacy version can still be accessed with - `qml.device("default.qubit.legacy", wires=n_wires)`. - [(#4436)](https://github.com/PennyLaneAI/pennylane/pull/4436) -

Deprecations πŸ‘‹

* The ``prep`` keyword argument in ``QuantumScript`` is deprecated and will be removed from `QuantumScript`. From 0e41758a6fe7f9d718b1b160b62788bdbe648f7b Mon Sep 17 00:00:00 2001 From: trbromley Date: Wed, 4 Oct 2023 13:52:10 -0400 Subject: [PATCH 05/33] Reorder and add authors --- doc/releases/changelog-dev.md | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/doc/releases/changelog-dev.md b/doc/releases/changelog-dev.md index cd6db0a76fb..d025092a939 100644 --- a/doc/releases/changelog-dev.md +++ b/doc/releases/changelog-dev.md @@ -304,27 +304,30 @@

Deprecations πŸ‘‹

-* The ``prep`` keyword argument in ``QuantumScript`` is deprecated and will be removed from `QuantumScript`. - ``StatePrepBase`` operations should be placed at the beginning of the `ops` list instead. - [(#4554)](https://github.com/PennyLaneAI/pennylane/pull/4554) - * The following decorator syntax for transforms has been deprecated and will raise a warning: + [(#4457)](https://github.com/PennyLaneAI/pennylane/pull/4457/) + ```python @transform_fn(**transform_kwargs) @qml.qnode(dev) def circuit(): ... ``` + If you are using a transform that has supporting `transform_kwargs`, please call the transform directly using `circuit = transform_fn(circuit, **transform_kwargs)`, or use `functools.partial`: + ```python @functools.partial(transform_fn, **transform_kwargs) @qml.qnode(dev) def circuit(): ... ``` - [(#4457)](https://github.com/PennyLaneAI/pennylane/pull/4457/) + +* The ``prep`` keyword argument in ``QuantumScript`` is deprecated and will be removed from `QuantumScript`. + ``StatePrepBase`` operations should be placed at the beginning of the `ops` list instead. + [(#4554)](https://github.com/PennyLaneAI/pennylane/pull/4554) * `qml.gradients.pulse_generator` becomes `qml.gradients.pulse_odegen` to adhere to paper naming conventions. During v0.33, `pulse_generator` is still available but raises a warning. @@ -380,6 +383,8 @@ This release contains contributions from (in alphabetical order): Utkarsh Azad, +Thomas Bromley, +Isaac De Vlugt, Stepan Fomichev, Joana Fraxanet, Diego Guala, From 2ab8d3b169fdfd6d8f4bc811457fdd784589320c Mon Sep 17 00:00:00 2001 From: trbromley Date: Wed, 4 Oct 2023 14:00:44 -0400 Subject: [PATCH 06/33] Add --- doc/releases/changelog-dev.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/doc/releases/changelog-dev.md b/doc/releases/changelog-dev.md index d025092a939..48658472f95 100644 --- a/doc/releases/changelog-dev.md +++ b/doc/releases/changelog-dev.md @@ -389,7 +389,8 @@ Stepan Fomichev, Joana Fraxanet, Diego Guala, Soran Jahangiri, -Korbinian Kottmann +Edward Jiang, +Korbinian Kottmann, Christina Lee, Lillian M. A. Frederiksen, Vincent Michaud-Rioux, @@ -397,4 +398,4 @@ Romain Moyard, Daniel F. Nino, Mudit Pandey, Matthew Silverman, -Jay Soni, +Jay Soni. From 958be81fc3ef76599bf6ac0c2bacd2c376689263 Mon Sep 17 00:00:00 2001 From: trbromley Date: Wed, 4 Oct 2023 14:36:10 -0400 Subject: [PATCH 07/33] Add --- doc/releases/changelog-dev.md | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/doc/releases/changelog-dev.md b/doc/releases/changelog-dev.md index 48658472f95..6080d8559ed 100644 --- a/doc/releases/changelog-dev.md +++ b/doc/releases/changelog-dev.md @@ -35,6 +35,25 @@

New device capabilities, integration with Catalyst, and more! βš—οΈ

+* `default.qubit` now uses the new `qml.devices.Device` API and supporting functionality in + `qml.devices.qubit`. If you experience any issues with the updated `default.qubit`, please let us + know by [posting an issue](https://github.com/PennyLaneAI/pennylane/issues/new/choose). + The old version of the device is still + accessible by the short name `default.qubit.legacy`, or directly via `qml.devices.DefaultQubitLegacy`. + [(#4594)](https://github.com/PennyLaneAI/pennylane/pull/4594) + [(#4436)](https://github.com/PennyLaneAI/pennylane/pull/4436) + [(#4620)](https://github.com/PennyLaneAI/pennylane/pull/4620) + [(#4632)](https://github.com/PennyLaneAI/pennylane/pull/4632) + + This changeover has a number of benefits for `default.qubit`, including: + + * The number of wires is now optional - simply having `qml.device("default.qubit")` is valid! If + wires are not provided at instantiation, the device automatically infers the required number of + wires for each circuit provided for execution. + + * `default.qubit` is no longer silently swapped out with an interface-appropriate device when the + backpropagation differentiation method is requested. + * Support drawing QJIT QNode from Catalyst. [(#4609)](https://github.com/PennyLaneAI/pennylane/pull/4609) @@ -64,15 +83,6 @@ "0: ──RX──H─── \n1: ──H───RY── \n2: ──RZ────── " ``` -* `default.qubit` now implements the new device API. The old version of the device is still - accessible by the short name `default.qubit.legacy`, or directly via `qml.devices.DefaultQubitLegacy`. - [(#4594)](https://github.com/PennyLaneAI/pennylane/pull/4594) - [(#4436)](https://github.com/PennyLaneAI/pennylane/pull/4436) - [(#4620)](https://github.com/PennyLaneAI/pennylane/pull/4620) - [(#4632)](https://github.com/PennyLaneAI/pennylane/pull/4632) - - TODO - * Extended ``qml.qchem.import_state`` to import wavefunctions from MPS DMRG and SHCI classical calculations performed with the Block2 and Dice libraries, incorporating new tests and wavefunction input selection logic. From d50da853964f8732937a165563868e393aac1e63 Mon Sep 17 00:00:00 2001 From: trbromley Date: Wed, 4 Oct 2023 14:40:30 -0400 Subject: [PATCH 08/33] Add --- doc/releases/changelog-dev.md | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/doc/releases/changelog-dev.md b/doc/releases/changelog-dev.md index 6080d8559ed..f1f50bc328a 100644 --- a/doc/releases/changelog-dev.md +++ b/doc/releases/changelog-dev.md @@ -52,7 +52,25 @@ wires for each circuit provided for execution. * `default.qubit` is no longer silently swapped out with an interface-appropriate device when the - backpropagation differentiation method is requested. + backpropagation differentiation method is requested. For example, consider: + + ```python + dev = qml.device("default.qubit", wires=1) + + @qml.qnode(dev, diff_method="backprop") + def f(x): + qml.RX(x, wires=0) + return qml.expval(qml.PauliX(0)) + ``` + + In previous versions of PennyLane, the device will be swapped + + ```pycon + >>> f.device + + >>> f.device == dev + False + ``` * Support drawing QJIT QNode from Catalyst. [(#4609)](https://github.com/PennyLaneAI/pennylane/pull/4609) From 05e062fa2f6f50086599dd6636ccb09ccecc49cc Mon Sep 17 00:00:00 2001 From: trbromley Date: Wed, 4 Oct 2023 14:47:14 -0400 Subject: [PATCH 09/33] Add --- doc/releases/changelog-dev.md | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/doc/releases/changelog-dev.md b/doc/releases/changelog-dev.md index f1f50bc328a..d8e7080e75b 100644 --- a/doc/releases/changelog-dev.md +++ b/doc/releases/changelog-dev.md @@ -52,7 +52,7 @@ wires for each circuit provided for execution. * `default.qubit` is no longer silently swapped out with an interface-appropriate device when the - backpropagation differentiation method is requested. For example, consider: + backpropagation differentiation method is used. For example, consider: ```python dev = qml.device("default.qubit", wires=1) @@ -61,16 +61,28 @@ def f(x): qml.RX(x, wires=0) return qml.expval(qml.PauliX(0)) + + f(jax.numpy.array(0.2)) ``` - In previous versions of PennyLane, the device will be swapped + In previous versions of PennyLane, the device will be swapped for the JAX equivalent: ```pycon >>> f.device - + >>> f.device == dev False ``` + + Now, `default.qubit` can itself dispatch to all of the interfaces in a backprop-compatible way + and hence does not need to be swapped: + + ```pycon + >>> f.device + + >>> f.device == dev + True + ``` * Support drawing QJIT QNode from Catalyst. [(#4609)](https://github.com/PennyLaneAI/pennylane/pull/4609) From 864958753a3d12d39e30c3caa165208ef2027e5d Mon Sep 17 00:00:00 2001 From: trbromley Date: Wed, 4 Oct 2023 14:47:39 -0400 Subject: [PATCH 10/33] Add --- doc/releases/changelog-dev.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/releases/changelog-dev.md b/doc/releases/changelog-dev.md index d8e7080e75b..c587018332b 100644 --- a/doc/releases/changelog-dev.md +++ b/doc/releases/changelog-dev.md @@ -84,6 +84,8 @@ True ``` + * TODO + * Support drawing QJIT QNode from Catalyst. [(#4609)](https://github.com/PennyLaneAI/pennylane/pull/4609) From 9f587ab105d410056ae1c32d4b6661a4fed8a7d3 Mon Sep 17 00:00:00 2001 From: trbromley Date: Fri, 13 Oct 2023 17:16:42 -0400 Subject: [PATCH 11/33] Update deprecations --- doc/development/deprecations.rst | 64 ++++++++++++++++---------------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/doc/development/deprecations.rst b/doc/development/deprecations.rst index 67518d937c1..e5c4bdaa5e0 100644 --- a/doc/development/deprecations.rst +++ b/doc/development/deprecations.rst @@ -9,7 +9,7 @@ Pending deprecations * ``qml.ExpvalCost`` has been deprecated, and usage will now raise a warning. - Deprecated in v0.24 - - Will be removed in v0.32 + - Will be removed in v0.34 Instead, it is recommended to simply pass Hamiltonians to the ``qml.expval`` function inside QNodes: @@ -21,27 +21,20 @@ Pending deprecations some_qfunc(params) return qml.expval(Hamiltonian) -* The behaviour of ``Operator.__eq__`` and ``Operator.__hash__`` will be updated soon. Their documentation - has been updated to reflect the incoming changes. - - The upcoming changes to operator equality will allow users to use operator equality the same way as - with ``qml.equal``. With the changes to hashing, unique operators that are equal will have the same - hash. These changes will allow behaviour such as the following: - - >>> qml.RX(0.1, wires=0) == qml.RX(0.1, wires=0) - True - >>> {qml.PauliZ(0), qml.PauliZ(0)} - {PauliZ(wires=[0])} +* The ``prep`` keyword argument in ``QuantumScript`` is deprecated and will be removed from ``QuantumScript``. + ``StatePrepBase`` operations should be placed at the beginning of the `ops` list instead. - Meanwhile, the current behaviour is shown below: + - Deprecated in v0.33 + - Will be removed in v0.34 - >>> qml.RX(0.1, wires=0) == qml.RX(0.1, wires=0) - False - >>> {qml.PauliZ(0), qml.PauliZ(0)} - {PauliZ(wires=[0]), PauliZ(wires=[0])} +* `qml.gradients.pulse_generator` becomes `qml.gradients.pulse_odegen` to adhere to paper naming conventions. During v0.33, `pulse_generator` + is still available but raises a warning. + + - Deprecated in v0.33 + - Will be removed in v0.34 - - Added in v0.32 - - Behaviour will change in v0.33 +Completed deprecation cycles +---------------------------- * The public methods of ``DefaultQubit`` are pending changes to follow the new device API. @@ -51,7 +44,7 @@ Pending deprecations will be abstracted away from the device class itself and provided by composition, rather than inheritance. Therefore, some public and private methods from ``DefaultQubit`` will no longer exist, though its behaviour in a workflow will remain the same. - + If you directly interact with device methods, please consult :class:`pennylane.devices.Device` and :class:`pennylane.devices.DefaultQubit` @@ -62,22 +55,29 @@ Pending deprecations `discussion forum `_. - Deprecated in v0.31 - -* The ``prep`` keyword argument in ``QuantumScript`` is deprecated and will be removed from ``QuantumScript``. - ``StatePrepBase`` operations should be placed at the beginning of the `ops` list instead. + - Changed in v0.33 - - Deprecated in v0.33 - - Will be removed in v0.34 +* The behaviour of ``Operator.__eq__`` and ``Operator.__hash__`` will be updated soon. Their documentation + has been updated to reflect the incoming changes. -* `qml.gradients.pulse_generator` becomes `qml.gradients.pulse_odegen` to adhere to paper naming conventions. During v0.33, `pulse_generator` - is still available but raises a warning. - - - Deprecated in v0.33 - - Will be removed in v0.34 + The upcoming changes to operator equality will allow users to use operator equality the same way as + with ``qml.equal``. With the changes to hashing, unique operators that are equal will have the same + hash. These changes will allow behaviour such as the following: + >>> qml.RX(0.1, wires=0) == qml.RX(0.1, wires=0) + True + >>> {qml.PauliZ(0), qml.PauliZ(0)} + {PauliZ(wires=[0])} -Completed deprecation cycles ----------------------------- + Meanwhile, the current behaviour is shown below: + + >>> qml.RX(0.1, wires=0) == qml.RX(0.1, wires=0) + False + >>> {qml.PauliZ(0), qml.PauliZ(0)} + {PauliZ(wires=[0]), PauliZ(wires=[0])} + + - Added in v0.32 + - Behaviour changed in v0.33 * ``qml.qchem.jordan_wigner`` had been removed. Use ``qml.jordan_wigner`` instead. List input to define the fermionic operator From af1edad430ac1dd62b6e0e5ef4d35f2a61d6ec5e Mon Sep 17 00:00:00 2001 From: trbromley Date: Mon, 16 Oct 2023 16:26:09 -0400 Subject: [PATCH 12/33] Add more to final feature section --- doc/releases/changelog-dev.md | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/doc/releases/changelog-dev.md b/doc/releases/changelog-dev.md index 663cfccf6a1..c198b5f45b4 100644 --- a/doc/releases/changelog-dev.md +++ b/doc/releases/changelog-dev.md @@ -84,9 +84,9 @@ True ``` - * TODO - -* Support drawing QJIT QNode from Catalyst. +* Added support for drawing a QNode that has been decorated with `qjit` from PennyLane's + [Catalyst](https://docs.pennylane.ai/projects/catalyst) library for just-in-time hybrid + compilation. [(#4609)](https://github.com/PennyLaneAI/pennylane/pull/4609) ```python @@ -114,15 +114,19 @@ >>>draw "0: ──RX──H─── \n1: ──H───RY── \n2: ──RZ────── " ``` + + Stay tuned for more integration of Catalyst into PennyLane! -* Extended ``qml.qchem.import_state`` to import wavefunctions from MPS DMRG and SHCI classical - calculations performed with the Block2 and Dice libraries, incorporating new tests and wavefunction - input selection logic. +* Extended ``qml.qchem.import_state`` to import more quantum chemistry wavefunctions, from MPS DMRG + and SHCI classical calculations performed with the Block2 and Dice libraries. [#4523](https://github.com/PennyLaneAI/pennylane/pull/4523) [#4524](https://github.com/PennyLaneAI/pennylane/pull/4524) [#4626](https://github.com/PennyLaneAI/pennylane/pull/4626) [#4634](https://github.com/PennyLaneAI/pennylane/pull/4634) + Check out our [how-to guide](https://pennylane.ai/qml/demos/tutorial_initial_state_preparation) + to learn more about how PennyLane integrates with your favourite quantum chemistry libraries. +

Improvements πŸ› 

More PyTrees!

From 9022717b54eb8aa0508f9e5b989f58331bceaac6 Mon Sep 17 00:00:00 2001 From: Isaac De Vlugt Date: Mon, 16 Oct 2023 16:59:15 -0400 Subject: [PATCH 13/33] clifford + T entry --- doc/releases/changelog-dev.md | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/doc/releases/changelog-dev.md b/doc/releases/changelog-dev.md index c587018332b..b2b73f1a350 100644 --- a/doc/releases/changelog-dev.md +++ b/doc/releases/changelog-dev.md @@ -6,6 +6,38 @@

Decompose circuits into the Clifford+T gateset 🧩

+* A new transform called `clifford_t_decomposition` is available, which decomposes + circuits into the Clifford+T gateset. + [(#ABCD)]() + + The Clifford+T universal gate set β€” `Hadamard`, `S`, `CNOT` and `T` β€” is paramount + to the implementation of many fault-tolerant protocols on quantum computers. With + the new `clifford_t_decomposition` transform, circuits can be decomposed into + a basis consisting of Clifford, `RZ` and `GlobalPhase` operations. Here, Clifford + gates include `Identity`, `PauliX`, `PauliY`, `PauliZ`, `SX`, `S`, `Hadamard`, + `CNOT`, `CY`, `CZ`, `SWAP` and `ISWAP`. + + ```python + dev = qml.device("default.qubit", wires=2) + + def circuit(): + qml.SingleExcitation(0.2, [1, 0]) + return qml.state() + + clifford_circuit = qml.QNode(qml.transforms.clifford_t_decomposition(circuit), dev) + print(qml.draw(clifford_circuit)()) + ``` + + ```pycon + 0: ──RZ(-2.36)──H────╭●──S†─────────H──RZ(0.10)──H─╭●──S──────────H──S──T──GlobalPhase(-2.36)── +1: ──RZ(-0.79)──H──S─╰X──RZ(-0.10)─────────────────╰X──RZ(-1.57)──H──T─────GlobalPhase(-2.36)── + ``` + + `RZ` gates are approximated in the Clifford+T basis using the method + described in [Ross and Selinger (2016)](https://arxiv.org/abs/1403.2975). The + `epsilon` argument in `clifford_t_decomposition` allows for the error in approximating + `RZ` gates to be adjusted. +

Postselection and statistics in mid-circuit measurements πŸ“Œ

* Measurement statistics can now be collected for mid-circuit measurements. Currently, From 3b87545ec69a15cb9620c46527734df5a4888124 Mon Sep 17 00:00:00 2001 From: Isaac De Vlugt Date: Mon, 16 Oct 2023 17:01:50 -0400 Subject: [PATCH 14/33] minor --- doc/releases/changelog-dev.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/releases/changelog-dev.md b/doc/releases/changelog-dev.md index 3edbb144957..99ef301b6a2 100644 --- a/doc/releases/changelog-dev.md +++ b/doc/releases/changelog-dev.md @@ -7,7 +7,7 @@

Decompose circuits into the Clifford+T gateset 🧩

* A new transform called `clifford_t_decomposition` is available, which decomposes - circuits into the Clifford+T gateset. + circuits into the Clifford+T gate set. [(#ABCD)]() The Clifford+T universal gate set β€” `Hadamard`, `S`, `CNOT` and `T` β€” is paramount From a0ad955f9dc18bf34c37cab5be740404d2e4cabe Mon Sep 17 00:00:00 2001 From: trbromley Date: Mon, 16 Oct 2023 17:06:57 -0400 Subject: [PATCH 15/33] Add --- doc/releases/changelog-dev.md | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/doc/releases/changelog-dev.md b/doc/releases/changelog-dev.md index c198b5f45b4..b6c466d9952 100644 --- a/doc/releases/changelog-dev.md +++ b/doc/releases/changelog-dev.md @@ -8,28 +8,33 @@

Postselection and statistics in mid-circuit measurements πŸ“Œ

-* Measurement statistics can now be collected for mid-circuit measurements. Currently, - `qml.expval`, `qml.var`, `qml.probs`, `qml.sample`, and `qml.counts` are supported on - `default.qubit`, `default.mixed`, and the new `DefaultQubit2` device. +* Measurement statistics can now be collected for mid-circuit measurements. [(#4544)](https://github.com/PennyLaneAI/pennylane/pull/4544) ```python - dev = qml.device("default.qubit", wires=2) + dev = qml.device("default.qubit") @qml.qnode(dev) def circ(x, y): qml.RX(x, wires=0) qml.RY(y, wires=1) m0 = qml.measure(1) - return qml.expval(qml.PauliZ(0)), qml.sample(m0) + return qml.expval(qml.PauliZ(0)), qml.expval(m0), qml.sample(m0) ``` - QNodes can be executed as usual when collecting mid-circuit measurement statistics: - ```pycon - >>> circ(1.0, 2.0, shots=5) - (array(0.6), array([1, 1, 1, 0, 1])) + >>> circ(1.0, 2.0, shots=10000) + (0.5606, 0.7089, array([0, 1, 1, ..., 1, 1, 1])) ``` + + Support is provided for both + [finite-shot and analytic modes](https://docs.pennylane.ai/en/stable/introduction/circuits.html#shots) + and devices default to using the + [deferred measurement](https://docs.pennylane.ai/en/stable/code/api/pennylane.defer_measurements.html) + principle to enact the mid-circuit measurements. + + In future releases, we will be exploring the ability to combine and manipulate mid-circuit + measurements such as `qml.expval(m0 @ m1)` or `qml.expval(m0 @ qml.PauliZ(0))`.

Exponentiate Hamiltonians with flexible Trotter products 🀩

From 187d85e645f5ad735fb838df69b29392f7f28186 Mon Sep 17 00:00:00 2001 From: trbromley Date: Mon, 16 Oct 2023 17:09:05 -0400 Subject: [PATCH 16/33] Add --- doc/introduction/measurements.rst | 9 ++------- doc/releases/changelog-dev.md | 2 ++ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/doc/introduction/measurements.rst b/doc/introduction/measurements.rst index d8966495903..213e37a98c8 100644 --- a/doc/introduction/measurements.rst +++ b/doc/introduction/measurements.rst @@ -331,12 +331,11 @@ tensor([0., 1.], requires_grad=True) Statistics can also be collected on mid-circuit measurements along with terminal measurement statistics. Currently, ``qml.probs``, ``qml.sample``, ``qml.expval``, ``qml.var``, and ``qml.counts`` are supported, -and can be requested along with other measurements. The devices that currently support collecting such -statistics are ``"default.qubit"``, ``"default.mixed"``, and ``"default.qubit.legacy"``. +and can be requested along with other measurements. .. code-block:: python3 - dev = qml.device("default.qubit", wires=2) + dev = qml.device("default.qubit") @qml.qnode(dev) def func(x, y): @@ -351,10 +350,6 @@ Executing this QNode: (tensor([0.9267767, 0.0732233], requires_grad=True), tensor([0.5, 0.5], requires_grad=True)) -Currently, statistics can only be collected for single mid-circuit measurement values. Moreover, any -measurement values manipulated using boolean or arithmetic operators cannot be used. These can lead to -unexpected/incorrect behaviour. - The deferred measurement principle provides a natural method to simulate the application of mid-circuit measurements and conditional operations in a differentiable and device-independent way. Performing true mid-circuit diff --git a/doc/releases/changelog-dev.md b/doc/releases/changelog-dev.md index b6c466d9952..23db3c3c40c 100644 --- a/doc/releases/changelog-dev.md +++ b/doc/releases/changelog-dev.md @@ -8,6 +8,8 @@

Postselection and statistics in mid-circuit measurements πŸ“Œ

+* TODO postselection + * Measurement statistics can now be collected for mid-circuit measurements. [(#4544)](https://github.com/PennyLaneAI/pennylane/pull/4544) From a3a92248589b013f155797c8ed10e63a5028033d Mon Sep 17 00:00:00 2001 From: trbromley Date: Mon, 16 Oct 2023 17:10:26 -0400 Subject: [PATCH 17/33] Fix --- doc/releases/changelog-dev.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/releases/changelog-dev.md b/doc/releases/changelog-dev.md index ba3e13ac375..218987570f7 100644 --- a/doc/releases/changelog-dev.md +++ b/doc/releases/changelog-dev.md @@ -30,7 +30,7 @@ ```pycon 0: ──RZ(-2.36)──H────╭●──S†─────────H──RZ(0.10)──H─╭●──S──────────H──S──T──GlobalPhase(-2.36)── -1: ──RZ(-0.79)──H──S─╰X──RZ(-0.10)─────────────────╰X──RZ(-1.57)──H──T─────GlobalPhase(-2.36)── + 1: ──RZ(-0.79)──H──S─╰X──RZ(-0.10)─────────────────╰X──RZ(-1.57)──H──T─────GlobalPhase(-2.36)── ``` `RZ` gates are approximated in the Clifford+T basis using the method From 11798c28181ef3a410bf5a857803a85ff8b612c0 Mon Sep 17 00:00:00 2001 From: Isaac De Vlugt Date: Mon, 16 Oct 2023 17:23:17 -0400 Subject: [PATCH 18/33] trotter product --- doc/releases/changelog-dev.md | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/doc/releases/changelog-dev.md b/doc/releases/changelog-dev.md index 99ef301b6a2..406bdd98217 100644 --- a/doc/releases/changelog-dev.md +++ b/doc/releases/changelog-dev.md @@ -63,7 +63,40 @@ (array(0.6), array([1, 1, 1, 0, 1])) ``` -

Exponentiate Hamiltonians with flexible Trotter products 🀩

+

Exponentiate Hamiltonians with flexible Trotter products πŸ–

+ +* Higher-order Trotter-Suzuki methods are now easily accessible through a new operation + called `TrotterProduct`. + [(#ABCD)]() + + Trotterization techniques are an affective route towards accurate and efficient + Hamiltonian simulation. The Suzuki-Trotter product formula allows for the ability + to express higher-order approximations to the matrix exponential of a Hamiltonian. + The new `TrotterProduct` operation implements the Suzuki-Trotter product formula + at the circuit level, where the `order` keyword argument specifies the order of + the approximation. + + ```python + coeffs = [0.25, 0.75] + ops = [qml.PauliX(0), qml.PauliZ(0)] + H = qml.dot(coeffs, ops) + + dev = qml.device("default.qubit", wires=2) + + @qml.qnode(dev) + def circuit(): + # Prepare some state + qml.Hadamard(0) + # Evolve according to H + qml.TrotterProduct(H, time=2.4, order=2) + # Measure some quantity + return qml.state() + ``` + + ```pycon + >>> my_circ() + [-0.13259524+0.59790098j 0. +0.j -0.13259524-0.77932754j 0. +0.j ] + ```

New device capabilities, integration with Catalyst, and more! βš—οΈ

From 675c0e186935146f9f06d6ecfd1ae4de640d965e Mon Sep 17 00:00:00 2001 From: Isaac De Vlugt Date: Mon, 16 Oct 2023 17:26:14 -0400 Subject: [PATCH 19/33] minor --- doc/releases/changelog-dev.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/doc/releases/changelog-dev.md b/doc/releases/changelog-dev.md index 7b8cd882f34..f958a45b731 100644 --- a/doc/releases/changelog-dev.md +++ b/doc/releases/changelog-dev.md @@ -78,10 +78,9 @@ Trotterization techniques are an affective route towards accurate and efficient Hamiltonian simulation. The Suzuki-Trotter product formula allows for the ability - to express higher-order approximations to the matrix exponential of a Hamiltonian. - The new `TrotterProduct` operation implements the Suzuki-Trotter product formula - at the circuit level, where the `order` keyword argument specifies the order of - the approximation. + to express higher-order approximations to the matrix exponential of a Hamiltonian, + and it is now available to use in PennyLane via the `TrotterProduct` operation. + Simply specifiy the `order` of the approximation and the evolution `time`. ```python coeffs = [0.25, 0.75] From 6fdd7432257c11161a012f523a7585825ce04201 Mon Sep 17 00:00:00 2001 From: Isaac De Vlugt Date: Mon, 16 Oct 2023 17:28:19 -0400 Subject: [PATCH 20/33] minor --- doc/releases/changelog-dev.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/doc/releases/changelog-dev.md b/doc/releases/changelog-dev.md index f958a45b731..59b3e9edbe0 100644 --- a/doc/releases/changelog-dev.md +++ b/doc/releases/changelog-dev.md @@ -91,11 +91,8 @@ @qml.qnode(dev) def circuit(): - # Prepare some state qml.Hadamard(0) - # Evolve according to H qml.TrotterProduct(H, time=2.4, order=2) - # Measure some quantity return qml.state() ``` From 12afee73dbb562b539829ed6fa40ad1a48f5f56e Mon Sep 17 00:00:00 2001 From: Isaac De Vlugt Date: Mon, 16 Oct 2023 17:28:32 -0400 Subject: [PATCH 21/33] minor --- doc/releases/changelog-dev.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/releases/changelog-dev.md b/doc/releases/changelog-dev.md index 59b3e9edbe0..78dab54884c 100644 --- a/doc/releases/changelog-dev.md +++ b/doc/releases/changelog-dev.md @@ -97,7 +97,7 @@ ``` ```pycon - >>> my_circ() + >>> circuit() [-0.13259524+0.59790098j 0. +0.j -0.13259524-0.77932754j 0. +0.j ] ``` From c34f9b668651fd593ea4ac5b339ff6437a8c992e Mon Sep 17 00:00:00 2001 From: Isaac De Vlugt Date: Tue, 17 Oct 2023 14:51:41 -0400 Subject: [PATCH 22/33] remove clifford + T section --- doc/releases/changelog-dev.md | 34 +--------------------------------- 1 file changed, 1 insertion(+), 33 deletions(-) diff --git a/doc/releases/changelog-dev.md b/doc/releases/changelog-dev.md index 78dab54884c..2e5958de679 100644 --- a/doc/releases/changelog-dev.md +++ b/doc/releases/changelog-dev.md @@ -4,39 +4,7 @@

New features since last release

-

Decompose circuits into the Clifford+T gateset 🧩

- -* A new transform called `clifford_t_decomposition` is available, which decomposes - circuits into the Clifford+T gate set. - [(#ABCD)]() - - The Clifford+T universal gate set β€” `Hadamard`, `S`, `CNOT` and `T` β€” is paramount - to the implementation of many fault-tolerant protocols on quantum computers. With - the new `clifford_t_decomposition` transform, circuits can be decomposed into - a basis consisting of Clifford, `RZ` and `GlobalPhase` operations. Here, Clifford - gates include `Identity`, `PauliX`, `PauliY`, `PauliZ`, `SX`, `S`, `Hadamard`, - `CNOT`, `CY`, `CZ`, `SWAP` and `ISWAP`. - - ```python - dev = qml.device("default.qubit", wires=2) - - def circuit(): - qml.SingleExcitation(0.2, [1, 0]) - return qml.state() - - clifford_circuit = qml.QNode(qml.transforms.clifford_t_decomposition(circuit), dev) - print(qml.draw(clifford_circuit)()) - ``` - - ```pycon - 0: ──RZ(-2.36)──H────╭●──S†─────────H──RZ(0.10)──H─╭●──S──────────H──S──T──GlobalPhase(-2.36)── - 1: ──RZ(-0.79)──H──S─╰X──RZ(-0.10)─────────────────╰X──RZ(-1.57)──H──T─────GlobalPhase(-2.36)── - ``` - - `RZ` gates are approximated in the Clifford+T basis using the method - described in [Ross and Selinger (2016)](https://arxiv.org/abs/1403.2975). The - `epsilon` argument in `clifford_t_decomposition` allows for the error in approximating - `RZ` gates to be adjusted. +

Postselection and statistics in mid-circuit measurements πŸ“Œ

From a80e53c4edc47cb25622724365e62cb2cff69381 Mon Sep 17 00:00:00 2001 From: trbromley Date: Wed, 18 Oct 2023 10:42:50 -0400 Subject: [PATCH 23/33] Add --- doc/releases/changelog-dev.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/doc/releases/changelog-dev.md b/doc/releases/changelog-dev.md index 2e5958de679..e6c1d9d145a 100644 --- a/doc/releases/changelog-dev.md +++ b/doc/releases/changelog-dev.md @@ -4,8 +4,6 @@

New features since last release

-

-

Postselection and statistics in mid-circuit measurements πŸ“Œ

* TODO postselection @@ -42,13 +40,13 @@ * Higher-order Trotter-Suzuki methods are now easily accessible through a new operation called `TrotterProduct`. - [(#ABCD)]() + [(#4661)](https://github.com/PennyLaneAI/pennylane/pull/4661) Trotterization techniques are an affective route towards accurate and efficient Hamiltonian simulation. The Suzuki-Trotter product formula allows for the ability to express higher-order approximations to the matrix exponential of a Hamiltonian, and it is now available to use in PennyLane via the `TrotterProduct` operation. - Simply specifiy the `order` of the approximation and the evolution `time`. + Simply specify the `order` of the approximation and the evolution `time`. ```python coeffs = [0.25, 0.75] @@ -69,6 +67,10 @@ [-0.13259524+0.59790098j 0. +0.j -0.13259524-0.77932754j 0. +0.j ] ``` + The already-available `ApproxTimeEvolution` operation represents the special case of `order=1`. + It is recommended to switch over to use of `TrotterProduct` because `ApproxTimeEvolution` will be + deprecated and removed in upcoming releases. +

New device capabilities, integration with Catalyst, and more! βš—οΈ

* `default.qubit` now uses the new `qml.devices.Device` API and supporting functionality in From 781f69e0fc15b635a32da8daa1d8a49785ded984 Mon Sep 17 00:00:00 2001 From: trbromley Date: Wed, 18 Oct 2023 11:47:34 -0400 Subject: [PATCH 24/33] Add --- doc/releases/changelog-dev.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/doc/releases/changelog-dev.md b/doc/releases/changelog-dev.md index e6c1d9d145a..b7121b79b60 100644 --- a/doc/releases/changelog-dev.md +++ b/doc/releases/changelog-dev.md @@ -71,6 +71,12 @@ It is recommended to switch over to use of `TrotterProduct` because `ApproxTimeEvolution` will be deprecated and removed in upcoming releases. +* TODO QDrift + +

Building blocks for quantum phase estimation 🧱

+ +* TODO +

New device capabilities, integration with Catalyst, and more! βš—οΈ

* `default.qubit` now uses the new `qml.devices.Device` API and supporting functionality in From d512567fd0a6e98f6ef38adf5e05a4937a41d044 Mon Sep 17 00:00:00 2001 From: Isaac De Vlugt Date: Wed, 18 Oct 2023 16:23:50 -0400 Subject: [PATCH 25/33] code example --- doc/releases/changelog-dev.md | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/doc/releases/changelog-dev.md b/doc/releases/changelog-dev.md index b7121b79b60..23349d75905 100644 --- a/doc/releases/changelog-dev.md +++ b/doc/releases/changelog-dev.md @@ -79,7 +79,7 @@

New device capabilities, integration with Catalyst, and more! βš—οΈ

-* `default.qubit` now uses the new `qml.devices.Device` API and supporting functionality in +* `default.qubit` now uses the new `qml.devices.Device` API and functionality in `qml.devices.qubit`. If you experience any issues with the updated `default.qubit`, please let us know by [posting an issue](https://github.com/PennyLaneAI/pennylane/issues/new/choose). The old version of the device is still @@ -95,6 +95,24 @@ wires are not provided at instantiation, the device automatically infers the required number of wires for each circuit provided for execution. + ```python + dev = qml.device("default.qubit") + + @qml.qnode(dev) + def circuit(): + qml.PauliZ("new") + qml.RZ(0.1, wires="device") + qml.Hadamard("api") + return qml.state() + ``` + + ```pycon + >>> print(qml.draw(circuit)()) + new: ──Z───────── State + device: ──RZ(0.10)── State + api: ──H───────── State + ``` + * `default.qubit` is no longer silently swapped out with an interface-appropriate device when the backpropagation differentiation method is used. For example, consider: From 946262c481b520c64118a7b2beb439a477c80ded Mon Sep 17 00:00:00 2001 From: Isaac De Vlugt Date: Wed, 18 Oct 2023 16:27:21 -0400 Subject: [PATCH 26/33] minor --- doc/releases/changelog-dev.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/doc/releases/changelog-dev.md b/doc/releases/changelog-dev.md index 23349d75905..a2a80e032a9 100644 --- a/doc/releases/changelog-dev.md +++ b/doc/releases/changelog-dev.md @@ -146,9 +146,9 @@ True ``` -* Added support for drawing a QNode that has been decorated with `qjit` from PennyLane's +* A QNode that has been decorated with `qjit` from PennyLane's [Catalyst](https://docs.pennylane.ai/projects/catalyst) library for just-in-time hybrid - compilation. + compilation is now compatible with `qml.draw`. [(#4609)](https://github.com/PennyLaneAI/pennylane/pull/4609) ```python @@ -173,8 +173,10 @@ ``` ```pycon - >>>draw - "0: ──RX──H─── \n1: ──H───RY── \n2: ──RZ────── " + >>> print(draw) + 0: ──RX──H─── + 1: ──H───RY── + 2: ──RZ────── ``` Stay tuned for more integration of Catalyst into PennyLane! From 396e997e87b05e1f6113349326a1f269135746f6 Mon Sep 17 00:00:00 2001 From: Isaac De Vlugt Date: Wed, 18 Oct 2023 16:28:18 -0400 Subject: [PATCH 27/33] minor --- doc/releases/changelog-dev.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/releases/changelog-dev.md b/doc/releases/changelog-dev.md index a2a80e032a9..4ce5f9dd838 100644 --- a/doc/releases/changelog-dev.md +++ b/doc/releases/changelog-dev.md @@ -181,8 +181,8 @@ Stay tuned for more integration of Catalyst into PennyLane! -* Extended ``qml.qchem.import_state`` to import more quantum chemistry wavefunctions, from MPS DMRG - and SHCI classical calculations performed with the Block2 and Dice libraries. +* `qml.qchem.import_state` has been extended to import more quantum chemistry wavefunctions, + from MPS, DMRG and SHCI classical calculations performed with the Block2 and Dice libraries. [#4523](https://github.com/PennyLaneAI/pennylane/pull/4523) [#4524](https://github.com/PennyLaneAI/pennylane/pull/4524) [#4626](https://github.com/PennyLaneAI/pennylane/pull/4626) From a8a7afa99c318232122e5863fe8095c549fc6369 Mon Sep 17 00:00:00 2001 From: Isaac De Vlugt Date: Wed, 18 Oct 2023 16:28:34 -0400 Subject: [PATCH 28/33] minor --- doc/releases/changelog-dev.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/releases/changelog-dev.md b/doc/releases/changelog-dev.md index 4ce5f9dd838..686c3530b71 100644 --- a/doc/releases/changelog-dev.md +++ b/doc/releases/changelog-dev.md @@ -164,7 +164,7 @@ qml.Hadamard(wires=i) qml.RX(x, wires=0) - loop() # pylint: disable=no-value-for-parameter + loop() qml.RY(y, wires=1) qml.RZ(z, wires=2) return qml.expval(qml.PauliZ(0)) From 87152c7199d7413fbbcaf7470b90810d025b29cd Mon Sep 17 00:00:00 2001 From: Isaac De Vlugt Date: Mon, 23 Oct 2023 17:15:15 -0400 Subject: [PATCH 29/33] edits to existing entries --- doc/releases/changelog-dev.md | 90 +++++++++++++++++++++++++++-------- 1 file changed, 71 insertions(+), 19 deletions(-) diff --git a/doc/releases/changelog-dev.md b/doc/releases/changelog-dev.md index 686c3530b71..4f32d90ab34 100644 --- a/doc/releases/changelog-dev.md +++ b/doc/releases/changelog-dev.md @@ -71,11 +71,63 @@ It is recommended to switch over to use of `TrotterProduct` because `ApproxTimeEvolution` will be deprecated and removed in upcoming releases. -* TODO QDrift +* Approximating matrix exponentiation with random product formulas, qDrift, is now available with the new `QDrift` + operation. + [(#4671)](https://github.com/PennyLaneAI/pennylane/pull/4671) + + As shown in [1811.08017](https://arxiv.org/pdf/1811.08017.pdf), qDrift is a Markovian process that can provide + a speedup in Hamiltonian simulation. At a high level, qDrift works by randomly sampling from the Hamiltonian + terms with a probability that depends on the Hamiltonian coefficients. This method for Hamiltonian + simulation is now ready to use in PennyLane with the `QDrift` operator. Simply specify the evolution `time` + and the number of samples drawn from the Hamiltonian, `n`: + + ```python + coeffs = [0.25, 0.75] + ops = [qml.PauliX(0), qml.PauliZ(0)] + H = qml.dot(coeffs, ops) + + dev = qml.device("default.qubit", wires=2) + + @qml.qnode(dev) + def circuit(): + qml.Hadamard(0) + qml.QDrift(H, time=1.2, n = 10) + return qml.probs() + ``` + + ```pycon + >>> circuit() + array([0.61814334, 0. , 0.38185666, 0. ]) + ```

Building blocks for quantum phase estimation 🧱

-* TODO +* A new operator called `CosineWindow` has been added to prepare an initial state based on a cosine wave function. + [(#4683)](https://github.com/PennyLaneAI/pennylane/pull/4683) + + As outlined in [2110.09590](https://arxiv.org/pdf/2110.09590.pdf), the cosine tapering window is part of a modification + to quantum phase estimation that can provide a cubic improvement to the algorithm's error rate. Using `CosineWindow` will + prepare a state whose amplitudes follow a cosinusoidal distribution over the computational basis. + + ```python + import pennylane as qml + import matplotlib.pyplot as plt + + dev = qml.device('default.qubit', wires=4) + + @qml.qnode(dev) + def example_circuit(): + qml.CosineWindow(wires=range(4)) + return qml.state() + output = example_circuit() + + # Graph showing state amplitudes + plt.bar(range(len(output)), output) + plt.show() + ``` + + +

New device capabilities, integration with Catalyst, and more! βš—οΈ

@@ -91,7 +143,7 @@ This changeover has a number of benefits for `default.qubit`, including: - * The number of wires is now optional - simply having `qml.device("default.qubit")` is valid! If + * The number of wires is now optional β€” simply having `qml.device("default.qubit")` is valid! If wires are not provided at instantiation, the device automatically infers the required number of wires for each circuit provided for execution. @@ -100,17 +152,17 @@ @qml.qnode(dev) def circuit(): - qml.PauliZ("new") - qml.RZ(0.1, wires="device") - qml.Hadamard("api") + qml.PauliZ(0) + qml.RZ(0.1, wires=1) + qml.Hadamard(2) return qml.state() ``` ```pycon >>> print(qml.draw(circuit)()) - new: ──Z───────── State - device: ──RZ(0.10)── State - api: ──H───────── State + 0: ──Z───────── State + 1: ──RZ(0.10)── State + 2: ──H───────── State ``` * `default.qubit` is no longer silently swapped out with an interface-appropriate device when the @@ -181,16 +233,6 @@ Stay tuned for more integration of Catalyst into PennyLane! -* `qml.qchem.import_state` has been extended to import more quantum chemistry wavefunctions, - from MPS, DMRG and SHCI classical calculations performed with the Block2 and Dice libraries. - [#4523](https://github.com/PennyLaneAI/pennylane/pull/4523) - [#4524](https://github.com/PennyLaneAI/pennylane/pull/4524) - [#4626](https://github.com/PennyLaneAI/pennylane/pull/4626) - [#4634](https://github.com/PennyLaneAI/pennylane/pull/4634) - - Check out our [how-to guide](https://pennylane.ai/qml/demos/tutorial_initial_state_preparation) - to learn more about how PennyLane integrates with your favourite quantum chemistry libraries. -

Improvements πŸ› 

More PyTrees!

@@ -301,6 +343,16 @@

Other improvements

+* `qml.qchem.import_state` has been extended to import more quantum chemistry wavefunctions, + from MPS, DMRG and SHCI classical calculations performed with the Block2 and Dice libraries. + [#4523](https://github.com/PennyLaneAI/pennylane/pull/4523) + [#4524](https://github.com/PennyLaneAI/pennylane/pull/4524) + [#4626](https://github.com/PennyLaneAI/pennylane/pull/4626) + [#4634](https://github.com/PennyLaneAI/pennylane/pull/4634) + + Check out our [how-to guide](https://pennylane.ai/qml/demos/tutorial_initial_state_preparation) + to learn more about how PennyLane integrates with your favourite quantum chemistry libraries. + * The `JacobianProductCalculator` abstract base class and implementation `TransformJacobianProducts` have been added to `pennylane.interfaces.jacobian_products`. [(#4435)](https://github.com/PennyLaneAI/pennylane/pull/4435) From 0bc19208779d3e8ae8d6190af50671776f53d403 Mon Sep 17 00:00:00 2001 From: Isaac De Vlugt <34751083+isaacdevlugt@users.noreply.github.com> Date: Mon, 23 Oct 2023 17:39:55 -0400 Subject: [PATCH 30/33] lingering merge conflicts --- doc/introduction/measurements.rst | 7 ------- 1 file changed, 7 deletions(-) diff --git a/doc/introduction/measurements.rst b/doc/introduction/measurements.rst index fc18c6b7c8c..4a8118981a8 100644 --- a/doc/introduction/measurements.rst +++ b/doc/introduction/measurements.rst @@ -385,13 +385,9 @@ Mid-circuit measurement statistics Statistics can be collected on mid-circuit measurements along with terminal measurement statistics. Currently, ``qml.probs``, ``qml.sample``, ``qml.expval``, ``qml.var``, and ``qml.counts`` are supported, -<<<<<<< HEAD -and can be requested along with other measurements. -======= and can be requested along with other measurements. The devices that currently support collecting such statistics are :class:`~.pennylane.devices.DefaultQubit`, :class:`~.pennylane.devices.DefaultMixed`, and :class:`~.pennylane.devices.DefaultQubitLegacy`. ->>>>>>> master .. code-block:: python3 @@ -410,7 +406,6 @@ Executing this QNode: (tensor([0.9267767, 0.0732233], requires_grad=True), tensor([0.5, 0.5], requires_grad=True)) -<<<<<<< HEAD The deferred measurement principle provides a natural method to simulate the application of mid-circuit measurements and conditional operations in a differentiable and device-independent way. Performing true mid-circuit @@ -419,9 +414,7 @@ quantum hardware and PennyLane device capabilities. For more examples on applying quantum functions conditionally, refer to the :func:`~.pennylane.cond` transform. -======= .. warning:: ->>>>>>> master Currently, statistics can only be collected for single mid-circuit measurement values. Moreover, any measurement values manipulated using boolean or arithmetic operators cannot be used. These can lead to From ac59829717722ba2bd62438c5ca2f4a8e54494a7 Mon Sep 17 00:00:00 2001 From: Isaac De Vlugt <34751083+isaacdevlugt@users.noreply.github.com> Date: Mon, 23 Oct 2023 17:41:27 -0400 Subject: [PATCH 31/33] minor --- doc/releases/changelog-0.33.0.md | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/releases/changelog-0.33.0.md b/doc/releases/changelog-0.33.0.md index 4e0f1f48674..a568cc9ddb7 100644 --- a/doc/releases/changelog-0.33.0.md +++ b/doc/releases/changelog-0.33.0.md @@ -144,6 +144,7 @@ output = example_circuit() # Graph showing state amplitudes + plt.style.use("pennylane.drawer.plot") plt.bar(range(len(output)), output) plt.show() ``` From bb4fdd13737f2d71cc566541b7e5f6858faf5564 Mon Sep 17 00:00:00 2001 From: trbromley Date: Tue, 24 Oct 2023 15:07:38 -0400 Subject: [PATCH 32/33] Add --- doc/releases/changelog-0.33.0.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/doc/releases/changelog-0.33.0.md b/doc/releases/changelog-0.33.0.md index a568cc9ddb7..70a8a9464b3 100644 --- a/doc/releases/changelog-0.33.0.md +++ b/doc/releases/changelog-0.33.0.md @@ -26,9 +26,9 @@ tensor([0., 1.], requires_grad=True) ``` - Here, we measure a probability of one on wire 1 as we postselect on the $|1\rangle$ state on wire - 0, thus resulting in the circuit being projected onto the state corresponding to the measurement - outcome $|1\rangle$ on wire 0. + Here, we measure a probability of one on wire 1 as we postselect on the :math:`|1\rangle` state on + wire 0, thus resulting in the circuit being projected onto the state corresponding to the + measurement outcome :math:`|1\rangle` on wire 0. * Measurement statistics can now be collected for mid-circuit measurements. [(#4544)](https://github.com/PennyLaneAI/pennylane/pull/4544) @@ -148,8 +148,8 @@ plt.bar(range(len(output)), output) plt.show() ``` - - + +

New device capabilities, integration with Catalyst, and more! βš—οΈ

From 936dd7d9ff5830ef470469e5f803733b7618447d Mon Sep 17 00:00:00 2001 From: trbromley Date: Tue, 24 Oct 2023 15:22:51 -0400 Subject: [PATCH 33/33] Add --- doc/releases/changelog-0.33.0.md | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/doc/releases/changelog-0.33.0.md b/doc/releases/changelog-0.33.0.md index e5842704d3b..0f7ec462c7a 100644 --- a/doc/releases/changelog-0.33.0.md +++ b/doc/releases/changelog-0.33.0.md @@ -263,7 +263,19 @@ [(#4607)](https://github.com/PennyLaneAI/pennylane/pull/4607) [(#4608)](https://github.com/PennyLaneAI/pennylane/pull/4608) - TODO + It is now possible to JIT-compile functions with arguments that are a `MeasurementProcess` or + a `QuantumScript`: + + ```python + tape0 = qml.tape.QuantumTape([qml.RX(1.0, 0), qml.RY(0.5, 0)], [qml.expval(qml.PauliZ(0))]) + dev = qml.device('lightning.qubit', wires=5) + + execute_kwargs = {"device": dev, "gradient_fn": qml.gradients.param_shift, "interface":"jax"} + + jitted_execute = jax.jit(qml.execute, static_argnames=execute_kwargs.keys()) + + jitted_execute((tape0, ), **execute_kwargs) + ```

Improving QChem and existing algorithms