while num_iter < max_num_iter:
if num_iter > 0:
p_div = p.sum(axis=0)
p_div[1:, :] -= p[0, 0:-1, :]
p_div[:, 1:] -= p[1, :, 0:-1]
result_channel = image_data[:, :, channel] - p_div
result_gradient[0, 0:-1, :] = np.diff(result_channel, axis=0)
result_gradient[1, :, 0:-1] = np.diff(result_channel, axis=1)
factors = 1.0 + tau / weight * np.sqrt(
(result_gradient**2).sum(axis=0)
)
factors = factors[np.newaxis, ...]
p_new = p - tau * result_gradient
p_new /= factors
cdef int[1000] arr
# or
arr: cython.int[1000]
@numba.jit
decorator to functions
numba
'd
numpy
API
(np.diff(arr, axis=0)
) not supported
numpy
arrays — no slicing!
numpy
-array ↔
Mojo-Tensor is (pretty much) black pointer magic