:orphan:
-
Two new methods:
setup_execution_config
andpreprocess_transforms
are added to theDevice
class. Device developers are encouraged to override these two methods separately instead of thepreprocess
method. For now, to avoid ambiguity, a device is allowed to override either these two methods orpreprocess
, but not both. In the long term, we will slowly phase out the use ofpreprocess
in favour of these two methods for better separation of concerns. (#6617) -
Developers of plugin devices now have the option of providing a TOML-formatted configuration file to declare the capabilities of the device. See Device Capabilities for details.
-
An internal module
pennylane.devices.capabilities
is added that defines a newDeviceCapabilites
data class, as well as functions that load and parse the TOML-formatted configuration files. (#6407)>>> from pennylane.devices.capabilities import DeviceCapabilities >>> capabilities = DeviceCapabilities.from_toml_file("my_device.toml") >>> isinstance(capabilities, DeviceCapabilities) True
-
Devices that extends
qml.devices.Device
now has an optional class attributecapabilities
that is an instance of theDeviceCapabilities
data class, constructed from the configuration file if it exists. Otherwise, it is set toNone
. (#6433)from pennylane.devices import Device class MyDevice(Device): config_filepath = "path/to/config.toml" ...
>>> isinstance(MyDevice.capabilities, DeviceCapabilities) True
-
-
Added a dense implementation of computing the Lie closure in a new function
lie_closure_dense
inpennylane.labs.dla
. (#6371) -
Added a dense implementation of computing the structure constants in a new function
structure_constants_dense
inpennylane.labs.dla
. (#6376) -
Added utility functions for handling dense matrices in the Lie theory context. (#6563)
-
Added
qml.devices.qubit_mixed
module for mixed-state qubit device support (#6379). This module introduces anapply_operation
helper function that features:-
Two density matrix contraction methods using
einsum
andtensordot
-
Optimized handling of special cases including: Diagonal operators, Identity operators, CX (controlled-X), Multi-controlled X gates, Grover operators
-
-
Added submodule 'initialize_state' featuring a
create_initial_state
function for initializing a density matrix fromqml.StatePrep
operations orqml.QubitDensityMatrix
operations. (#6503) -
Added support for constructing
BoseWord
andBoseSentence
, similar toFermiWord
andFermiSentence
. (#6518) -
Added method
preprocess
to theQubitMixed
device class to preprocess the quantum circuit before execution. Necessary non-intrusive interfaces changes to class init method were made along the way to theQubitMixed
device class to support new API feature. (#6601) -
Added a second class
DefaultMixedNewAPI
to theqml.devices.qubit_mixed
module, which is to be the replacement of legacyDefaultMixed
which for now to hold the implementations ofpreprocess
andexecute
methods. (#6607) -
Added
christiansen_mapping()
function to mapBoseWord
andBoseSentence
to qubit operators, using christiansen mapping. (#6623) -
Added
unary_mapping()
function to mapBoseWord
andBoseSentence
to qubit operators, using unary mapping. (#6576) -
Added
binary_mapping()
function to mapBoseWord
andBoseSentence
to qubit operators, using standard-binary mapping. (#6564) -
The
qml.qchem.factorize
function now supports new methods for double factorization: Cholesky decomposition (cholesky=True
) and compressed double factorization (compressed=True
). (#6573) (#6611) -
Added
qml.qchem.symmetry_shift
function to perform the block-invariant symmetry shift on the electronic integrals. (#6574)
-
Raises a comprehensive error when using
qml.fourier.qnode_spectrum
with standard numpy arguments andinterface="auto"
. (#6622) -
Added support for the
wire_options
dictionary to customize wire line formatting inqml.draw_mpl
circuit visualizations, allowing global and per-wire customization with options likecolor
,linestyle
, andlinewidth
. (#6486) -
QNode
andqml.execute
now forbid certain keyword arguments from being passed positionally. (#6610) -
Shortened the string representation for the
qml.S
,qml.T
, andqml.SX
operators. (#6542) -
Added functions and dunder methods to add and multiply Resources objects in series and in parallel. (#6567)
-
jax.vmap
can be captured withqml.capture.make_plxpr
and is compatible with quantum circuits. (#6349) (#6422) -
qml.capture.PlxprInterpreter
base class has been added for easy transformation and execution of pennylane variant jaxpr. (#6141) -
A
DefaultQubitInterpreter
class has been added to provide plxpr execution using python based tools, and theDefaultQubit.eval_jaxpr
method is now implemented. (#6594) (#6328) -
An optional method
eval_jaxpr
is added to the device API for native execution of plxpr programs. (#6580) -
qml.capture.qnode_call
has been made private and moved to theworkflow
module. (#6620)
-
Added PyTree support for measurements in a circuit. (#6378)
import pennylane as qml @qml.qnode(qml.device("default.qubit")) def circuit(): qml.Hadamard(0) qml.CNOT([0,1]) return {"Probabilities": qml.probs(), "State": qml.state()}
>>> circuit() {'Probabilities': array([0.5, 0. , 0. , 0.5]), 'State': array([0.70710678+0.j, 0. +0.j, 0. +0.j, 0.70710678+0.j])}
-
_cache_transform
transform has been moved to its own file located atqml.workflow._cache_transform.py
. (#6624) -
qml.BasisRotation
template is now JIT compatible. (#6019) -
The Jaxpr primitives for
for_loop
,while_loop
andcond
now store slices instead of numbers of args. (#6521) -
Expand
ExecutionConfig.gradient_method
to storeTransformDispatcher
type. (#6455) -
Fix the string representation of
Resources
instances to match the attribute names. (#6581)
-
Added base class
Resources
,CompressedResourceOp
,ResourceOperator
for advanced resource estimation. (#6428) -
Added
ResourceOperator
classes for QFT and all operators in QFT's decomposition. (#6447)
-
qml.fourier.qnode_spectrum
no longer automatically converts pure numpy parameters to the Autograd framework. As the function uses automatic differentiation for validation, parameters from an autodiff framework have to be used. (#6622) -
qml.math.jax_argnums_to_tape_trainable
is moved and made private to avoid a qnode dependency in the math module. (#6609) -
Gradient transforms are now applied after the user's transform program. (#6590)
-
Legacy operator arithmetic has been removed. This includes
qml.ops.Hamiltonian
,qml.operation.Tensor
,qml.operation.enable_new_opmath
,qml.operation.disable_new_opmath
, andqml.operation.convert_to_legacy_H
. Note thatqml.Hamiltonian
will continue to dispatch toqml.ops.LinearCombination
. For more information, check out the updated operator troubleshooting page. (#6548) (#6602) (#6589) -
The developer-facing
qml.utils
module has been removed. Specifically, the following 4 sets of functions have been either moved or removed(#6588):-
qml.utils._flatten
,qml.utils.unflatten
has been moved and renamed toqml.optimize.qng._flatten_np
andqml.optimize.qng._unflatten_np
respectively. -
qml.utils._inv_dict
andqml._get_default_args
have been removed. -
qml.utils.pauli_eigs
has been moved toqml.pauli.utils
. -
qml.utils.expand_vector
has been moved toqml.math.expand_vector
.
-
-
The
qml.qinfo
module has been removed. Please see the respective functions in theqml.math
andqml.measurements
modules instead. (#6584) -
Top level access to
Device
,QubitDevice
, andQutritDevice
have been removed. Instead, they are available asqml.devices.LegacyDevice
,qml.devices.QubitDevice
, andqml.devices.QutritDevice
respectively. (#6537) -
The
'ancilla'
argument forqml.iterative_qpe
has been removed. Instead, use the'aux_wire'
argument. (#6532) -
The
qml.BasisStatePreparation
template has been removed. Instead, useqml.BasisState
. (#6528) -
The
qml.workflow.set_shots
helper function has been removed. We no longer interact with the legacy device interface in our code. Instead, shots should be specified on the tape, and the device should use these shots. (#6534) -
QNode.gradient_fn
has been removed. Please useQNode.diff_method
instead.QNode.get_gradient_fn
can also be used to process the diff method. (#6535) -
The
qml.QubitStateVector
template has been removed. Instead, useqml.StatePrep
. (#6525) -
qml.broadcast
has been removed. Users should usefor
loops instead. (#6527) -
The
max_expansion
argument forqml.transforms.clifford_t_decomposition
has been removed. (#6531) (#6571) -
The
expand_depth
argument forqml.compile
has been removed. (#6531) -
The
qml.shadows.shadow_expval
transform has been removed. Instead, please use theqml.shadow_expval
measurement process. (#6530) (#6561)
-
The
tape
andqtape
properties ofQNode
have been deprecated. Instead, use theqml.workflow.construct_tape
function. (#6583) (#6650) -
The
max_expansion
argument inqml.devices.preprocess.decompose
is deprecated and will be removed in v0.41. (#6400) -
The
decomp_depth
argument inqml.transforms.set_decomposition
is deprecated and will be removed in v0.41. (#6400) -
The
output_dim
property ofqml.tape.QuantumScript
has been deprecated. Instead, use methodshape
ofQuantumScript
orMeasurementProcess
to get the same information. (#6577) -
The
QNode.get_best_method
andQNode.best_method_str
methods have been deprecated. Instead, use theqml.workflow.get_best_diff_method
function. (#6418) -
The
qml.execute
gradient_fn
keyword argument has been renameddiff_method
, to better align with the termionology used by theQNode
.gradient_fn
will be removed in v0.41. (#6549)
-
Add reporting of test warnings as failures. (#6217)
-
Add a warning message to Gradients and training documentation about ComplexWarnings. (#6543)
-
The
qml.HilbertSchmidt
andqml.LocalHilbertSchmidt
templates now apply the complex conjugate of the unitaries instead of the adjoint, providing the correct result. (#6604) -
QNode
return behaviour is now consistent for lists and tuples. (#6568) -
qml.QNode
now accepts arguments with types defined in libraries that are not necessarily in the list of supported interfaces, such as theGraph
class defined innetworkx
. (#6600) -
qml.math.get_deep_interface
now works properly for autograd arrays. (#6557) -
Fixed
Identity.__repr__
to return correct wires list. (#6506)
This release contains contributions from (in alphabetical order):
Shiwen An, Utkarsh Azad, Astral Cai, Yushao Chen, Diksha Dhawan, Pietropaolo Frisoni, Austin Huang, Korbinian Kottmann, Christina Lee, William Maxwell, Andrija Paurevic, Justin Pickering, Jay Soni, David Wierichs,