title: How to speed up operations on a python array?
body: <p>I have an 1D numpy array <code>A</code> of shape (N by 1) where N=4000000. I need to run a function (fcn) on each of its elements. </p>
  
  <pre><code>import bumpy as np
  def fcn(a, B, c):
      return a - np.sqrt(c) * B) / np.sqrt(1 - c)
  </code></pre>
  
  <p>Since B is (M=100 by P=20) and c is scalar, the output of the function is an array of size M by P. </p>
  
  <p>I have tried different methods, but all are slow for example:</p>
  
  <pre><code>for a in A:
      result = fcn(a, B, c)
      # do something with result...
  </code></pre>
  
  <p>Do you know how to speed it up, for example by multiprocessing or any other way?</p>