Question

I use LAPACK in a c code that allows me to inverse a matrix. to be more precise, I use dgetrf_ then dgetri_ to do the inversion.

But as I'm dealing with big matrices and as i don't know if the matrices will be invertible or not, I loose a lot of time tring to inverse an non-invertible matrix... Is there a way, using LAPACK, to check this ?

Was it helpful?

Solution

See this link (despite it being a couple years old) regarding the failure of dgetrf+dgetri on a singular matrix. It also suggests a way to check the "invertibility" of the matrix in question: estimating the condition number (function dgecon).

The condition number can help because it is a property of the matrix itself, and therefore not related to the accuracy of your algorithm and/or round-off error of the PC. The larger the conditioning number, the closer to singularity your matrix is, so you could essentially set an (variable) upper-bound on your conditioning number. See the tables at the bottom of this page to see a potential function-calling-order based on the type of matrices you're using.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top