title: Replace python list comprehension generating 3D array with numpy functions
body: <p>I have two matrices (numpy arrays), <strong>mu</strong> and <strong>nu</strong>. From these I would like to create a third array as follows:</p>
  
  <p><strong>new_array</strong>_{j, k, l} = <strong>mu</strong>_{l, k} <strong>nu</strong>_{j, k}</p>
  
  <p>I can do it naively using list comprehensions: </p>
  
  <pre><code>[[[mu[l, k] * nu[j, k] for k in np.arange(N)] for l in np.arange(N)] for j in np.arange(N)]
  </code></pre>
  
  <p>but it quickly becomes slow.</p>
  
  <p>How can I create <strong>new_array</strong> using numpy functions which should be faster?</p>