Quantum operations¶

Module name: pennylane.ops

Submodule containing core quantum operations supported by PennyLane.

PennyLane supports a collection of built-in quantum operations and observables, including both discrete-variable (DV) operations as used in the qubit model, and continuous-variable (CV) operations as used in the qumode model of quantum computation.

Here, we summarize the built-in operations and observables supported by PennyLane, as well as the conventions chosen for their implementation.

Note

When writing a plugin device for PennyLane, make sure that your plugin supports as many of the PennyLane built-in operations defined here as possible.

If the convention differs between the built-in PennyLane operation and the corresponding operation in the targeted framework, ensure that the conversion between the two conventions takes places automatically by the plugin device.

General operations¶

Operations and observables that can be used on both qubit and CV devices.

class Identity(wires)[source]

The identity observable $$\I$$.

The expectation of this observable

$E[\I] = \text{Tr}(\I \rho)$

corresponds to the trace of the quantum state, which in exact simulators should always be equal to 1.