# LAPACK - singular matrices - what does the positive integer info mean?

please can you help me with my code - I use Lapack to solve complex matrix (quite biq) and do it in two steps: I call zgetrf (LU factorization) and then zgetrs (solving system). But the info value for zgetrf is not zero - zgetrf fails to factorize the matrix. The info value is 2. In the manual of Intel MKL (I use Lapack from these) they write:

info INTEGER.

If info=0, the execution is successful.

If info = -i, the i-th parameter had an illegal value.

If info = i, $u_{ii}$ is 0. The factorization has been completed, but $U$ is exactly singular. Division by 0 will occur if you use the factor $U$ for solving a system of linear equations.

So I understand my matrix is somehow singular. But what does the number say - if my info=2 then the second line in my matrix is linear dependent? Or something like that? Many thanks

-

Short answer: nothing more than $U_{ii} = 0$, i.e. that your computed $U$ factorization is exactly singular.

xGETRF is not safe as a rank revealing factorization, so I would not draw any conclusion, apart from the fact that $A$ is ill-conditioned and no solution to $Ax=b$ can be safely computed. Information on rank and null space should be derived (if desired) by other decompositions, eg. $QR$.

-
many thanks, Stefano! – lovis Feb 7 '13 at 17:10

If you compute the LU factorization of an $n$ by $n$ matrix $A$, then you'll end up with

$PA=LU$

where $P$ is a permutation matrix, $L$ is lower triangular and nonsingular, and $U$ is upper triangular. If $A$ happens to singular then the LAPACK routine will produce a $U$ matrix that is singular. The only way that an upper triangular matrix can be singular is to have a diagonal entry which is 0 (the determinant of $U$ is the product of its diagonal entries.) The info value returned by the LAPACK routine tells you the row/column of the first 0 on the diagonal of $U$.

You could use this information (for example) to find a nonzero vector $\hat{x}$ such that $U\hat{x}=0$. Suppose that info is $k$. Then let $\hat{x}_{j}=0$ for $j=n, n-1, \ldots, k+1$. Let $\hat{x}_{k}=1$. Then use back substitution to find $\hat{x}_{k-1}, \hat{x}_{k-2}, \ldots, \hat{x}_{1}$.

Then $LU\hat{x}=0$, so $\hat{x}$ is in the null space of $PA$.

-
many thanks, Bill, for your explanation! – lovis Feb 7 '13 at 17:10