@jit(int32(complex64, int32))
def mandelbrot_types(c,maxiter):
    r = c.real
    i = c.imag
    for n in range(maxiter):
        r2 = r*r
        i2 = i*i
        if r2 + i2 > 4.0:
            return n
        i = 2*r*i+c.imag
        r = r2-i2+c.real
    return maxiter

@guvectorize([(complex64[:], int32, int32[:])], '(n),()->(n)', target='parallel')
def mandelbrot_numpy(c, maxiter, output):
    for i in range(c.shape[0]):
        output[i] = mandelbrot_types(c[i], maxiter)
        
def mandelbrot_set2(xmin,xmax,ymin,ymax,width,height,maxiter):
    r1 = np.linspace(xmin, xmax, width, dtype=np.float32)
    r2 = np.linspace(ymin, ymax, height, dtype=np.float32)
    c = r1 + r2[:,None]*1j    
    return mandelbrot_numpy(c,maxiter)
    
%time plt.subplot(1, 2, 1).imshow(mandelbrot_set2(*male_hodnoty))
%time plt.subplot(1, 2, 2).imshow(mandelbrot_set2(*velke_hodnoty))