title: Faster method for dividing two matrices in 8 small matrices
body: <p>Here is my code for dividing two matrices:</p>
  
  <pre><code>def divideM1(X,Y):
    n=len(X)
    a=[[col for col in row[:len(row)/2]] for row in X[:n/2]]
    b=[[col for col in row[len(row)/2:]] for row in X[:n/2]]
    c=[[col for col in row[:len(row)/2]] for row in X[n/2:]]
    d=[[col for col in row[len(row)/2:]] for row in X[n/2:]]
    e=[[col for col in row[:len(row)/2]] for row in Y[:n/2]]
    f=[[col for col in row[len(row)/2:]] for row in Y[:n/2]]
    g=[[col for col in row[:len(row)/2]] for row in Y[n/2:]]
    h=[[col for col in row[len(row)/2:]] for row in Y[n/2:]]
  
    return a,b,c,d,e,f,g,h
  
  def divideM2(X,Y):
    n=len(X)
    a=[[0 for i in range(n/2)] for j in range(n/2)]
    b=[[0 for i in range(n/2)] for j in range(n/2)]
    c=[[0 for i in range(n/2)] for j in range(n/2)]
    d=[[0 for i in range(n/2)] for j in range(n/2)]
    f=[[0 for i in range(n/2)] for j in range(n/2)]
    e=[[0 for i in range(n/2)] for j in range(n/2)]
    g=[[0 for i in range(n/2)] for j in range(n/2)]
    h=[[0 for i in range(n/2)] for j in range(n/2)]
  
    for i in range(n/2):
        for j in range(n/2):
          a[i][j]=X[i][j]
          b[i][j]=X[i][j+n/2]
          c[i][j]=X[i+n/2][j]
          d[i][j]=X[i+n/2][j+n/2]
          e[i][j]=Y[i][j]
          f[i][j]=Y[i][j+n/2]
          g[i][j]=Y[i+n/2][j]
          h[i][j]=Y[i+n/2][j+n/2]
    return a,b,c,d,e,f,g,h
  </code></pre>
  
  <p>If I use time.time() it seems method 2-"divideM2" is faster than method 1 -"divideM1" but why is that?
  Is there a better method to divide ?</p>
  
  <p>Edit1:
  Interestingly when I am using time.time():</p>
  
  <pre><code>start = time.time()
  print("method1")
  for i in range(10000):
    1&gt;2
  divideM2(a1,a1)
  end = time.time()
  t1=end-start
  print t1 ,"m1"
  
  start = time.time()
  print("method2")
  for j in range(10000):
    1&gt;2
  divideM1(a2,a2)
  end = time.time()
  t2= end-start
  print t2, "m2"
  
  if t1&gt;t2:
    print "method 2 is faster"
  else:
    print "method 1 is faster"
  </code></pre>
  
  <p>I always get "method 2 is faster" even if I am comparing "divide1" by itself. Can someone explain this as well?</p>