qml.qinfo.transforms.mutual_info¶
-
mutual_info
(qnode, wires0, wires1, base=None)[source]¶ Compute the mutual information from a
QNode
returning astate()
:\[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
- Returns
A function that computes the mutual information from the output state of the QNode and accepts the same arguments.
- Return type
function
Example
It is possible to obtain the mutual information of two subsystems from a
QNode
returning astate()
.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=[0], wires1=[1]) >>> mutual_info_circuit(np.pi/2) 1.3862943611198906 >>> x = np.array(0.4, requires_grad=True) >>> mutual_info_circuit(x) 0.3325090393262875 >>> qml.grad(mutual_info_circuit)(np.array(0.4, requires_grad=True)) 1.2430067731198946
See also
vn_entropy()
,pennylane.math.mutual_info()
andpennylane.mutual_info()
code/api/pennylane.qinfo.transforms.mutual_info
Download Python script
Download Notebook
View on GitHub