如何使numxepr与complex64一起使用?

我正在尝试执行以下代码:

import numpy as np
import numexpr as ne

def julia(h,w,maxit=20,a=0.0):
    x = np.linspace(-1.8,1.8,dtype=np.float32)
    y = np.linspace(-1.8,h,dtype=np.float32)
    xv,yv = np.meshgrid(x,y)
    c = xv+yv*1j
    z = c
    divtime = maxit + np.zeros(z.shape,dtype=np.uint8)
    q = np.complex64(0.7885*np.exp(1j*a))

    for i in range(maxit):
        ne.evaluate('z*z + q',out=z) # line with error
        diverge = z*np.conj(z) > 4
        div_now = diverge & (divtime == maxit)
        divtime[div_now] = i
        z[diverge] = 2
    return divtime

julia(100,100)

变量zq均为complex64类型,但numexpr返回complex128。有没有办法使它与complex64值一起使用以提高性能?

wjr349464977 回答:如何使numxepr与complex64一起使用?

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3168715.html

大家都在问