# qml.qinfo.transforms.mutual_info¶

mutual_info(qnode, wires0, wires1, base=None)[source]

Compute the mutual information from a QNode returning a state():

$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
• qnode (QNode) – A QNode returning a state().

• wires0 (Sequence(int)) – List of wires in the first subsystem.

• wires1 (Sequence(int)) – List of wires in the second subsystem.

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

Returns

A function with the same arguments as the QNode that returns the mutual information from its output state.

Return type

func

Example

It is possible to obtain the mutual information of two subsystems from a QNode returning a state().

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

@qml.qnode(dev)
def circuit(x):
qml.IsingXX(x, wires=[0, 1])
return qml.state()

>>> mutual_info_circuit = qinfo.mutual_info(circuit, wires0=, wires1=)
>>> mutual_info_circuit(np.pi/2)
1.3862943611198906
>>> x = np.array(0.4, requires_grad=True)
>>> mutual_info_circuit(x)
0.3325090393262875