mindquantum.core.operators.ground_state_of_sum_zz

查看源文件
mindquantum.core.operators.ground_state_of_sum_zz(ops: QubitOperator, sim='mqvector')[源代码]

计算只有泡利 \(Z\) 项的哈密顿量的基态能量。

参数:
  • ops (QubitOperator) - 只有泡利 \(Z\) 项的哈密顿量。

  • sim (str) - 所使用模拟器的类型,当前支持 'mqvector''mqvector_gpu'。默认值: 'mqvector'

返回:

float,给定哈密顿量的基态能量。

样例:

>>> from mindquantum.core.operators import ground_state_of_sum_zz, QubitOperator
>>> h = QubitOperator('Z0 Z1', 1.0) + QubitOperator('Z0 Z2', -1.5)
>>> ground_state_of_sum_zz(h)
-2.5
>>> import numpy as np
>>> np.min(np.diag(h.matrix().toarray()))
(-2.5+0j)