qml.mutual_info

mutual_info(wires0, wires1, log_base=None)[source]

Mutual information between the subsystems prior to measurement:

\[I(A, B) = S(\rho^A) + S(\rho^B) - S(\rho^{AB})\]

where \(S\) is the von Neumann entropy.

The mutual information is a measure of correlation between two subsystems. More specifically, it quantifies the amount of information obtained about one system by measuring the other system.

Parameters
  • wires0 (Sequence[int] or int) – the wires of the first subsystem

  • wires1 (Sequence[int] or int) – the wires of the second subsystem

  • log_base (float) – Base for the logarithm. If None, the natural logarithm is used.

Example:

dev = qml.device("default.qubit", wires=2)

@qml.qnode(dev)
def circuit_mutual(x):
    qml.IsingXX(x, wires=[0, 1])
    return qml.mutual_info(wires0=[0], wires1=[1])

Executing this QNode:

>>> circuit_mutual(np.pi/2)
1.3862943611198906

It is also possible to get the gradient of the previous QNode:

>>> param = np.array(np.pi/4, requires_grad=True)
>>> qml.grad(circuit_mutual)(param)
1.2464504802804612

Note

Calculating the derivative of mutual_info() is currently supported when using the classical backpropagation differentiation method (diff_method="backprop") with a compatible device and finite differences (diff_method="finite-diff").

Contents

Using PennyLane

Development

API