mutual_info(state, indices0, indices1, base=None, check_state=False, c_dtype='complex128')[source]

Compute the mutual information between two subsystems given 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. It supports all interfaces (Numpy, Autograd, Torch, Tensorflow and Jax).

Each state can be given as a state vector in the computational basis, or as a density matrix.

  • state (tensor_like) – (2**N) state vector or (2**N, 2**N) density matrix.

  • indices0 (list[int]) – List of indices in the first subsystem.

  • indices1 (list[int]) – List of indices in the second subsystem.

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

  • check_state (bool) – If True, the function will check the state validity (shape and norm).

  • c_dtype (str) – Complex floating point precision type.


Mutual information between the subsystems

Return type



The mutual information between subsystems for a state vector can be returned as follows:

>>> x = np.array([1, 0, 0, 1]) / np.sqrt(2)
>>> qml.math.mutual_info(x, indices0=[0], indices1=[1])

It is also possible to change the log basis.

>>> qml.math.mutual_info(x, indices0=[0], indices1=[1], base=2)

Similarly the quantum state can be provided as a density matrix:

>>> y = np.array([[1/2, 1/2, 0, 1/2], [1/2, 0, 0, 0], [0, 0, 0, 0], [1/2, 0, 0, 1/2]])
>>> qml.math.mutual_info(y, indices0=[0], indices1=[1])