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