title: How to tell if a sparse matrix can't be solved
body: <p>I'm writing a program in Python using scipy's spsolve to solve a linear equation using a sparse matrix (csr_matrix). The matrices are fairly large (M=90826x90826, b=90826x1) and are hard to check by hand.</p>
  
  <p>The problem I've encountered is that for a small fraction of the matrices I'm creating, scipy.sparse.linalg.spsolve(M,b) undergoes such a catastrophic failure that it crashes the entire program. Even wrapping the line in a try/except and the program itself in another try/except, doesn't help. I don't even get a response in the Exception field.</p>
  
  <p>I verified manually that the data I'm sending it is incorrect for what I want, but I can't really check it anywhere else. My program involves face detection, and the problem may be caused by bad detection. In this case, the "face" was found to be in the cheek of the actual face. However, manually verifying that the detection is correct before proceeding is not really an option (the final product will be used by a non-technical client). And automatic verification is outside the scope of the project.</p>
  
  <p>Anyway, if I can just detect that the matrices will cause spsolve to crash, it's fine to simply skip the image. But I can't seem to find literature about how to keep spsolve from crashing.</p>
  
  <p>The values I'm sending of type float64 and can be positive or negative. From what I've seen of the matrices that can be solved, M is generally filled with 4's and -1's, while b can be almost any positive or negative number.</p>