qml.I

I

The Identity operator

The expectation of this observable

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

See also

The equivalent long-form alias Identity

Parameters
  • wires (Iterable[Any] or Any) – Wire label(s) that the identity acts on.

  • id (str) – custom label given to an operator instance, can be useful for some applications where the instance has to be identified.

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

arithmetic_depth

Arithmetic depth of the operator.

basis

The basis of an operation, or for controlled gates, of the target operation.

batch_size

Batch size of the operator if it is used with broadcasted parameters.

control_wires

Control wires of the operator.

ev_order

Order in (x, p) that a CV observable is a polynomial of.

grad_method

Gradient computation method.

grad_recipe

Gradient recipe for the parameter-shift method.

has_adjoint

has_decomposition

has_diagonalizing_gates

has_generator

has_matrix

has_sparse_matrix

hash

Integer hash that uniquely represents the operator.

hyperparameters

Dictionary of non-trainable variables that this operation depends on.

id

Custom string to label a specific operator instance.

is_hermitian

All observables must be hermitian

name

String for the name of the operator.

ndim_params

Number of dimensions per trainable parameter of the operator.

num_params

num_wires

Number of wires that the operator acts on.

parameter_frequencies

Returns the frequencies for each operator parameter with respect to an expectation value of the form \(\langle \psi | U(\mathbf{p})^\dagger \hat{O} U(\mathbf{p})|\psi\rangle\).

parameters

Trainable parameters that the operator depends on.

pauli_rep

A PauliSentence representation of the Operator, or None if it doesn't have one.

supports_heisenberg

wires

Wires that the operator acts on.

adjoint()

Create an operation that is the adjoint of this one.

compare(other)

Compares with another Hamiltonian, Tensor, or Observable, to determine if they are equivalent.

compute_decomposition(wires[, n_wires])

Representation of the operator as a product of other operators (static method).

compute_diagonalizing_gates(wires[, n_wires])

Sequence of gates that diagonalize the operator in the computational basis (static method).

compute_eigvals([n_wires])

Eigenvalues of the operator in the computational basis (static method).

compute_matrix([n_wires])

Representation of the operator as a canonical matrix in the computational basis (static method).

compute_sparse_matrix([n_wires])

Representation of the operator as a sparse matrix in the computational basis (static method).

decomposition()

Representation of the operator as a product of other operators.

diagonalizing_gates()

Sequence of gates that diagonalize the operator in the computational basis.

eigvals()

Eigenvalues of the operator in the computational basis.

generator()

Generator of an operator that is in single-parameter-form.

heisenberg_expand(U, wire_order)

Expand the given local Heisenberg-picture array into a full-system one.

heisenberg_obs(wire_order)

Representation of the observable in the position/momentum operator basis.

identity_op(*params)

Alias for matrix representation of the identity operator.

label([decimals, base_label, cache])

A customizable string representation of the operator.

map_wires(wire_map)

Returns a copy of the current operator with its wires changed according to the given wire map.

matrix([wire_order])

Representation of the operator as a matrix in the computational basis.

pow(z)

A list of new operators equal to this one raised to the given power.

queue([context])

Append the operator to the Operator queue.

simplify()

Reduce the depth of nested operators to the minimum.

single_qubit_rot_angles()

The parameters required to implement a single-qubit gate as an equivalent Rot gate, up to a global phase.

sparse_matrix([wire_order])

Representation of the operator as a sparse matrix in the computational basis.

terms()

Representation of the operator as a linear combination of other operators.

Contents

Using PennyLane

Release news

Development

API

Internals