MCPcopy Create free account
hub / github.com/Apress/python-for-matlab-development / nIter

Function nIter

code/hpc/MB_vectorized.py:33–49  ·  view source on GitHub ↗
(c, imax)

Source from the content-addressed store, hash-verified

31import numpy as np
32import time
33def nIter(c, imax):
34 nR,nC = c.shape
35 z = np.zeros_like(c)
36 img = np.zeros(z.shape,
37 dtype=np.uint8)
38 Idx = np.ones(z.shape,
39 dtype=np.bool )
40 for i in range(imax):
41 z[Idx] = z[Idx]*z[Idx] + \
42 c[Idx]
43 New = (z.real**2 +
44 z.imag**2 <= 4)
45 .reshape(nR,nC)
46 if not np.any(New):
47 break
48 img[New] = i
49 Idx *= New
50 return img
51
52def main():

Callers 1

MB_vectorized.pyFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected