# qml.qinfo.transforms.vn_entropy¶

vn_entropy(qnode, wires, base=None)[source]

Compute the Von Neumann entropy from a QNode returning a state().

$S( \rho ) = -\text{Tr}( \rho \log ( \rho ))$
Parameters
• qnode (tensor_like) – A QNode returning a state().

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

• base (float) – Base for the logarithm, default is None the natural logarithm is used in this case.

Returns

Von Neumann entropy of the considered subsystem.

Return type

float

Example

It is possible to obtain the entropy of a subsystem 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()
>>> vn_entropy(circuit, wires=[0])(np.pi/2)
0.6931472

The function is differentiable with backpropagation for all interfaces, e.g.: