麻木不会加速我的鳕鱼

2024-10-04 03:22:24 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在用我的一部分代码来加速。但是,它不能正常工作。事实上,我没有看到任何改善!有人能给我一些建议如何修理它吗?在

顺便说一下,所有的输入变量都是1D/2D/3D numpy变量

import numba as nb
@nb.jit 
def Permutation(Spect, Blob_Len, Fs, alpha, Terminate,
                    x, y, z, Per_IndexH1, Per_IndexH2, P_Value, MeanSpect, TempPVal, Boundary): 

  for i in range(Terminate):

      TempPVal[:] = 0.0
      DS1 = Spect[:, :, Per_IndexH1[i, 0 : Boundary]]
      DS2 = Spect[:, :, Per_IndexH2[i, Boundary:]]
      MS1 = np.sum(DS1, axis = 2)
      MS2 = np.sum(DS2, axis = 2)

      TempPVal[np.abs(MS1 - MS2) > MeanSpect] = 1
      P_Value = P_Value + TempPVal


  P_Value = P_Value / Terminate 
  return P_Value

Tags: valuenpsumnbperboundaryspectterminate