Time-efficient combination of numpy functions
<p>I have two 3 dimensional numpy arrays A, B (size ~ (1000, 1000, 3) -> image processing) and the element-wise functions on it.</p>

<p>The functions are sequentially:</p>

<pre><code>import numpy as np
A  = A ** 3
A = np.maximum(A, 0.001)
C = np.divide(B, A)
</code></pre>

<p>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.</p>

<p>The only combinations I could find was the divide part, e.g. <a href="https://stackoverflow.com/questions/20293614/divide-one-numpy-array-by-another-only-where-both-arrays-are-non-zero">here</a> or <a href="https://stackoverflow.com/questions/26248654/numpy-return-0-with-divide-by-zero">here</a>, or <a href="https://stackoverflow.com/questions/36003322/aggregate-numpy-functions">this one</a> which is a special case because of the einstein sum. </p>

<p>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?</p>