title: Matrix Multiplication in pure Python?
body: <p>I'm trying to multiply two matrices together using pure Python. Input (<code>X1</code> is a 3x3 and <code>Xt</code> is a 3x2):</p>
  
  <pre><code>X1 =  [[1.0016, 0.0, -16.0514], 
         [0.0, 10000.0, -40000.0], 
         [-16.0514, -40000.0, 160513.6437]]
  Xt =  [(1.0, 1.0), 
         (0.0, 0.25), 
         (0.0, 0.0625)]
  </code></pre>
  
  <p>where Xt is the zip transpose of another matrix. Now here is the code:</p>
  
  <pre><code>def matrixmult (A, B):
      C = [[0 for row in range(len(A))] for col in range(len(B[0]))]
      for i in range(len(A)):
          for j in range(len(B[0])):
              for k in range(len(B)):
                  C[i][j] += A[i][k]*B[k][j]
      return C
  </code></pre>
  
  <p>The error that python gives me is this: </p>
  
  <blockquote>
    <p>IndexError: list index out of range. </p>
  </blockquote>
  
  <p>Now I'm not sure if <code>Xt</code> is recognised as an matrix and is still a list object, but technically this should work. </p>