mindquantum.core.circuit.partial_psi_psi
- mindquantum.core.circuit.partial_psi_psi(circuit: Circuit, backend='mqvector')[source]
Calculate the following value of the given parameterized quantum circuit.
\[B_i = \frac{\partial \left<\psi\right| }{\partial x_i}\left|\psi\right>\]- Parameters
- Returns
Function, a function that can calculate inner product of partial psi and psi.
Examples
>>> import numpy as np >>> from mindquantum.core.circuit import partial_psi_psi, Circuit >>> circ = Circuit().rx('a', 0).ry('b', 0).rz('c', 0) >>> ppp = partial_psi_psi(circ) >>> ppp(np.array([1, 2, 3])) array([0.+0.j , 0.-0.42073549j, 0.-0.11242255j])