# LAPACK: ZGETRF with INFO greater than zero but ZGETRI does not fail.

I am computing the inverse of a complex matrix. I execute ZGETRF but U(2,2) = 0. When I compute ZGETRI, the inverse is determined. Can I trust this inverse?

• You can make a check. Is A * inv(A) = 1? If this is not the case (within numerical precision) then your inverse is obviously wrong. – Henri Menke Aug 8 '17 at 21:43
• is U(2,2) exactly 0 or something $\approx u$ – M.K. aka Grisu Aug 9 '17 at 10:50
• I would like to know for every case, without having to multiply the matrices, but I can do that. Thanks! – N Luis Aug 9 '17 at 14:21
• I haven't checked if U(2,2) is actually zero. But, per definition of ZGETRF, when INFO > 0, U(INFO,INFO) = 0... – N Luis Aug 9 '17 at 14:22
• if $U(2,2) = 0$ (exactly, as a return value INFO=2 would indicate), then the original matrix is singular so ZGETRI should fail (with the same error INFO=2). Not directly related to your original question, but may I ask why you want to compute the explicit inverse of your matrix operator? – GoHokies Aug 9 '17 at 19:06

I have answered a similar question when a failed zgetrf will be followed by a successful zgetrs. In this question, the situation is similar.
To call zgetri, you have to call zgetrf first. Therefore, if zgetrf failed (in a sense that $U_{2,2}=0$) in the first place, there is no point in calling zgetri and hope for a reliable result.
Why zgetri does not result in an explicit error itself is another question, and probably will depend on the particular implementation of LAPACK/BLAS library. But, to sum it up, since you got an error in the first step of your two-step process of obtaining the inverse of the matrix, you certainly cannot trust the obtained inverse.