I have two 3 dimensional numpy arrays A, B (size ~ (1000, 1000, 3) -> image processing) and the element-wise functions on it.
The functions are sequentially:
import numpy as np
A = A ** 3
A = np.maximum(A, 0.001)
C = np.divide(B, A)
Since the function operating these 3 commands is the bottleneck of a time-demanding process, I would like to ask whether there is a way to perform all of those with a single access to each element in memory, i.e. the fastest performance.
The only combinations I could find was the divide part, e.g. here or here, or this one which is a special case because of the einstein sum.
Is there any way to do that accessing each element in the memory one time (thus make it time-efficient) without the need to write a custom ufunc?