How to Solve Numba Lowering error?

后端 未结 2 1870
轻奢々
轻奢々 2021-01-21 06:30

I have a function, which I am trying to speed up using the @jit decorator from Numba module. For me it is essential to speed this up as much as possible, because my main code ca

2条回答
  •  一整个雨季
    2021-01-21 06:47

    I can't see from your code why this isn't vectorizable. Vectorizing can speed up this kind of Python code by around 100x. Not sure of how it does relative to jit.

    It looks like you could, for instance, take your dEdt out of the loop, and compute it in one step with something like :

    dEdt = 0.5 * (Cmx[:, :, :, 0] * dg * (1+A*1j) * Nf[:] * Ef[:, None] * np.exp( 1j* (Sweep.omega[None, :, None, None]-Sweep.omega) *tijd)).sum(axis=2).sum(axis=1) - 0.5*(pd-g)*Ef + fbr*Ef2  + Kinj*EAinj*(1 + np.exp(1j*(u+Vmzm)) )
    

    (Though I don't really know what the dimensionality of your Sweet.omega is).

提交回复
热议问题