title: Numpy np.dot() on multidimensional arrays
body: <p>This is an easy question, but I'm getting confused by the size involved.</p>
  
  <p>Using NumPy, I have a 3-dimensional array, shape = (10, 100, 100).</p>
  
  <p>(The way I think of it is as an np.ndarray of 10 "matrices", each shaped 100 by 100, i.e. </p>
  
  <pre><code>arr1 = [M1 M2 M3....M10]
  </code></pre>
  
  <p>where <code>M1.shape = (100,100), M2.shape = (100,100),...</code></p>
  
  <p>I also have a second array of data called "arrB", which is <code>arrB.shaped (100,)</code>. My goal is to do matrix multiplication with these numpy arrays, i.e. <code>(arrB.T)*arr1*(arrB)</code>, resulting in a single integer. Using numpy arrays, this operation should be completed with <code>np.dot()</code></p>
  
  <pre><code>op1 = np.dot(arr1, arrB)
  op2 = np.dot((arrB.T), op1)
  </code></pre>
  
  <p>or </p>
  
  <pre><code>endproduct = np.dot((arrB.T), np.dot(arr1, arrB) )
  </code></pre>
  
  <p>However, this does not work. I get an error:</p>
  
  <pre><code>ValueError: shapes (100,) and (10,100) not aligned: 100 (dim 0) != 10 (dim 0)
  </code></pre>
  
  <p>If I do the operation on one "matrix" M# at a time, I can perform this operation, i.e. </p>
  
  <pre><code>element1 = arr1[0]
  end = np.dot((arrB.T), np.dot(element1, arrB) )
  </code></pre>
  
  <p>Without splicing my original array, doing the operations, and appending again, how can I perform these operations on my original array <code>arr1</code> to result in</p>
  
  <pre><code>result = [(arrB.T)*arr1[0]*(arrB) (arrB.T)*arr1[1]*(arrB) (arrB.T)*arr1[2]*(arrB) ... 
                                                  ....(arrB.T)*arr1[9]*(arrB) ]
  </code></pre>