mindquantum.core.circuit.qfi
- mindquantum.core.circuit.qfi(circuit: Circuit, backend='mqvector')[source]
Calculate the quantum fisher information of the given parameterized circuit with given parameters.
The quantum fisher information of a parameterized circuit is defined as:
\[\text{QFI}_{i,j} = 4\text{Re}(A_{i,j} - B_{i,j})\]where
\[A_{i,j} = \frac{\partial \left<\psi\right| }{\partial x_{i}} \frac{\partial \left|\psi\right> }{\partial x_{j}}\]and
\[B_{i,j} = \frac{\partial \left<\psi\right| }{\partial x_i}\left|\psi\right> \left<\psi\right|\frac{\partial \left|\psi\right> }{\partial x_{j}}\]- Parameters
- Returns
Function, a function that can calculate quantum fisher information.
Examples
>>> import numpy as np >>> from mindquantum.core.circuit import qfi, Circuit >>> circ = Circuit().rx('a', 0).ry('b', 0).rz('c', 0) >>> qfi_ops = qfi(circ) >>> qfi_ops(np.array([1, 2, 3])) array([[ 1. , 0. , -0.90929743], [ 0. , 0.29192658, -0.18920062], [-0.90929743, -0.18920062, 0.94944468]])