mindquantum.core.gates.RotPauliString
- class mindquantum.core.gates.RotPauliString(pauli_string: str, pr)[源代码]
任意泡利串的旋转门。
\[U(\theta)=e^{-i\theta P/2}, P=\otimes_i\sigma_i, \text{where } \sigma \in \{X, Y, Z\}\]- 参数:
pauli_string (str) - 泡利串。泡利串中的元素只能是
['i', 'x', 'y', 'z', 'I', 'X', 'Y', 'Z']
。pr (Union[int, float, str, dict, ParameterResolver]) - 参数化门的参数。
样例:
>>> import numpy as np >>> from mindquantum.core.gates import RotPauliString >>> from mindquantum.core.operators import TimeEvolution, QubitOperator >>> from mindquantum.core.circuit import Circuit >>> g = RotPauliString('XYZ', 1.0).on([0, 1, 2]) >>> circ1 = Circuit() + g >>> circ2 = TimeEvolution(QubitOperator('X0 Y1 Z2'), 0.5).circuit >>> np.allclose(circ1.matrix(), circ2.matrix()) True