title: Efficient & pythonic check for singular matrix
body: <p>Working on some matrix algebra here.  Sometimes I need to invert a matrix that may be singular or ill-conditioned.  I understand it is pythonic to simply do this:</p>
  
  <pre><code>try:
      i = linalg.inv(x)
  except LinAlgErr as err:
      #handle it
  </code></pre>
  
  <p>but am not sure how efficient that is.  Wouldn't this be better?</p>
  
  <pre><code>if linalg.cond(x) &lt; 1/sys.float_info.epsilon:
      i = linalg.inv(x)
  else:
      #handle it
  </code></pre>
  
  <p>Does numpy.linalg simply perform up front the test I proscribed?</p>