投影严格对角化经典Python代码(Numpy向量化,Numba优化)
精髓是这一段@jit(nopython=True)def solve_Heff(nk, V): L, nk = V.shape def Mterm2(q): M2 = np.zeros((nk, nk), dtype=np.complex128) Ap = np.power(np.absolute(V),2).sum(axis=1).copy() # 预处理一个常数项 for i in range(nk):