title: Create a 3D numpy array with 3 2D numpy arrays or 3 1D numpy array
body: <p>I have three numpy 2D arrays:</p>
  <pre><code>A1 with the shape of (x * y)
  A2 with the shape of (x * z)
  A3 with the shape of (y * z)
  </code></pre>
  <p>The values in the three arrays are either True or False. Now, I want to create a 3D array of shape (x * y * z) so that each element in the 3D array follows:</p>
  <pre><code>3D_array[x, y, z] = A1[x, y] &amp; A2[x, z] &amp; A3[y, z]
  </code></pre>
  <p>I know I can do with a loop. But is there any faster way to do this? Like through vectorization?</p>
  <p>Alternatively, the three 2D arrays are actually just some pair-wise interaction between three 1D arrays. So a more general way to present my question is:</p>
  <p>Give three 1D numpy array (X), (Y), (Z) in length of x, y, z respectively, what is the best way to create a 3D numpy array so that each element in the 3D array equals:</p>
  <pre><code>3D_array[i, j, k] = my_function(X[i], Y[j], Z[k])
  </code></pre>
  <p>where the my_function is a customized function that returns, say, True/False. Again, I am looking for something better than looping.</p>
  <p>Any solutions to either the first question or the more general one are welcomed. Many thanks!</p>