Skip to content

Commit

Permalink
Merge branch 'master' into evolution_operator
Browse files Browse the repository at this point in the history
  • Loading branch information
lillian542 authored Dec 9, 2022
2 parents 768fa07 + 2162274 commit a140b1f
Show file tree
Hide file tree
Showing 5 changed files with 775 additions and 721 deletions.
7 changes: 7 additions & 0 deletions doc/introduction/data.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@ where the quantum dataset is a collection of `quantum data` obtained from variou
The packages ``zstd`` and ``dill`` are required to use the :mod:`~pennylane.data` module.
These can be installed with ``pip install zstd dill``.

.. warning::

PennyLane datasets use the ``dill`` module to compress, store, and read data. Since ``dill``
is built on the ``pickle`` module, we reproduce an important warning from the ``pickle``
module: it is possible to construct malicious pickle data which will execute arbitrary code
during unpickling. Never unpickle data that could have come from an untrusted source, or
that could have been tampered with.

Loading Datasets in PennyLane
-----------------------------
Expand Down
9 changes: 8 additions & 1 deletion doc/releases/changelog-dev.md
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,9 @@
Replaces `qml.transforms.make_tape` with `make_qscript`.
[(#3429)](https://github.com/PennyLaneAI/pennylane/pull/3429)

* Extended the functionality of `qml.matrix` to qutrits.
[(#3460)](https://github.com/PennyLaneAI/pennylane/pull/3460)

* File `qcut.py` in `qml.transforms` reorganized into multiple files in `qml.transforms.qcut`
[3413](https://github.com/PennyLaneAI/pennylane/pull/3413)

Expand Down Expand Up @@ -356,7 +359,7 @@
[(#3399)](https://github.com/PennyLaneAI/pennylane/pull/3399)

* Improved the performance of executing circuits under the `jax.vmap` transformation, which can now leverage the batch-execution capabilities of some devices. [(#3452)](https://github.com/PennyLaneAI/pennylane/pull/3452)

<h4>Return types project</h4>

* The autograd interface for the new return types now supports devices with shot vectors.
Expand Down Expand Up @@ -644,6 +647,9 @@ Deprecations cycles are tracked at [doc/developement/deprecations.rst](https://d
$U^{\dagger} | \psi \rangle$ the actual state being measured in the $Z$-basis.
[(#3409)](https://github.com/PennyLaneAI/pennylane/pull/3409)

* Adds warnings about using ``dill`` to pickle and unpickle datasets.
[#3505](https://github.com/PennyLaneAI/pennylane/pull/3505)

<h3>Bug fixes</h3>

* Fixed a bug where `hamiltonian_expand` didn't preserve the type of the inputted results in its output.
Expand Down Expand Up @@ -687,6 +693,7 @@ Deprecations cycles are tracked at [doc/developement/deprecations.rst](https://d

This release contains contributions from (in alphabetical order):

Guillermo Alonso
Juan Miguel Arrazola
Utkarsh Azad
Samuel Banning
Expand Down
12 changes: 11 additions & 1 deletion pennylane/data/data_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,9 @@ def _generate_folders(node, folders):
def load(
data_name, attributes=None, lazy=False, folder_path="", force=False, num_threads=50, **params
):
r"""Downloads the data if it is not already present in the directory and return it to user as a :class:`~pennylane.data.Dataset` object.
r"""Downloads the data if it is not already present in the directory and return it to user as a
:class:`~pennylane.data.Dataset` object. For the full list of available datasets, please see the
`datasets website <https://pennylane.ai/qml/datasets.html>`_.
Args:
data_name (str) : A string representing the type of data required such as `qchem`, `qpsin`, etc.
Expand All @@ -226,6 +228,14 @@ def load(
Returns:
list[:class:`~pennylane.data.Dataset`]
.. warning::
PennyLane datasets use the ``dill`` module to compress, store, and read data. Since ``dill``
is built on the ``pickle`` module, we reproduce an important warning from the ``pickle``
module: it is possible to construct malicious pickle data which will execute arbitrary code
during unpickling. Never unpickle data that could have come from an untrusted source, or
that could have been tampered with.
"""

_ = lazy
Expand Down
7 changes: 5 additions & 2 deletions pennylane/ops/functions/matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,12 @@ def _matrix(tape, wire_order=None):
wire_order = wire_order or tape.wires

# initialize the unitary matrix
result = qml.math.eye(2 ** len(wire_order), like=interface)
if len(tape.operations) == 0:
result = qml.math.eye(2 ** len(wire_order), like=interface)
else:
result = matrix(tape.operations[0], wire_order=wire_order)

for op in tape.operations:
for op in tape.operations[1:]:
U = matrix(op, wire_order=wire_order)
# Coerce the matrices U and result and use matrix multiplication. Broadcasted axes
# are handled correctly automatically by ``matmul`` (See e.g. NumPy documentation)
Expand Down
Loading

0 comments on commit a140b1f

Please sign in to comment.