# qml.math.vn_entanglement_entropy¶

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

Compute the Von Neumann entanglement entropy between two subsystems in a given state.

$S(\rho_A) = -\text{Tr}[\rho_A \log \rho_A] = -\text{Tr}[\rho_B \log \rho_B] = S(\rho_B)$

where $$S$$ is the von Neumann entropy, and $$\rho_A = \text{Tr}_B [\rho_{AB}]$$ and $$\rho_B = \text{Tr}_A [\rho_{AB}]$$ are the reduced density matrices for each partition.

The Von Neumann entanglement entropy is a measure of the degree of quantum entanglement between two subsystems constituting a pure bipartite quantum state. The entropy of entanglement is the Von Neumann entropy of the reduced density matrix for any of the subsystems. If it is non-zero, it indicates the two subsystems are entangled.

Each state must be given as a density matrix. To find the mutual information given a pure state, call dm_from_state_vector() first.

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

• indices0 (list[int]) – Indices of the qubits in the first subsystem.

• indices1 (list[int]) – Indices of the qubits 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.

Returns

The von Neumann entanglement entropy of the bipartite state.

Return type

float

Examples

The entanglement entropy between subsystems for a state vector can be returned as follows:

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


It is also possible to change the logarithm base:

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


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

>>> y = np.array([[1, 1, -1, -1], [1, 1, -1, -1], [-1, -1, 1, 1], [-1, -1, 1, 1]]) * 0.25
>>> qml.math.vn_entanglement_entropy(y, indices0=[0], indices1=[1])
0