title: Numpy: Matrix inverse calculated incorrectly?
body: <p>I have a matrix, <code>key_class</code> of the value:</p>
  
  <p><code>[[17, 17, 5],
  [21, 18, 21],
  [2, 2, 19]]</code></p>
  
  <p>I'm trying to calculate its inverse with the following code:</p>
  
  <pre><code>key_class = [[17, 17, 5],
               [21, 18, 21],
               [2, 2, 19]]
  
  import sys 
  key_class = np.array(key_class)
  print ("Class key:")
  print (key_class)
  
  # Check if matrix is singular
  if np.linalg.cond(key_class) &lt; 1/sys.float_info.epsilon:
      print ("Inverse exists")
      key_class_inverse = np.linalg.inv(key_class)
  else:
      print ("Inverse does not exist")
  
  key_class_mul = np.floor(np.matmul(key_class, key_class_inverse))
  
  print ("Class inverse:")
  print (key_class_inverse)
  print ("Multiplicative Inverse:")
  print (key_class_mul)
  </code></pre>
  
  <p>Here's the output:</p>
  
  <pre><code>Class key:
  [[17 17  5]
   [21 18 21]
   [ 2  2 19]]
  Inverse exists
  Class inverse:
  [[-3.19488818e-01  3.33333333e-01 -2.84345048e-01]
   [ 3.80191693e-01 -3.33333333e-01  2.68370607e-01]
   [-6.38977636e-03  2.11344372e-18  5.43130990e-02]]
  Multiplicative Inverse:
  [[ 1. -1.  0.]
   [ 0.  1.  0.]
   [-1.  0.  0.]]
  </code></pre>
  
  <p>The output should have been an identity matrix which isn't the case. What's going wrong?</p>