0
$\begingroup$

I have a large system of equations $$Ax=b$$ and I know matrix $A$ and right-hand side vector $b$. I'm using MKL to solve this system. The matrices are complex. I have used the general solver ZGETRS (Intel MKL zgetrs) which needs the matrix input in LU decomposition. So I have used ZGETRF (Intel MKL zgetrf) that performs the LU decomposition.

I checked the matrix $A$ through SVD as well - the SVD decomposition says no problem, matrix $A$ is regular.

But when I send the $A$ to ZGETRF, there comes a error code "4" (from manual if info is positive, "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.") But then the program send the LU-factorized matrix $A$ to ZGETRS, which should solve the $Ax=b$ system. And this one writes me no error (info=0). But the solution it gives me is trivial solution - all unknouwns should be zero.

What does it mean - where could be the error in the matrix? When SVD says the matrix is regular but LU decomposer says it's singular?

$\endgroup$
  • $\begingroup$ It certainly appears that your matrix is effectively numerically singular. You haven't told us what the singular values of the matrix were or what the condition number was, but that would probably confirm that the matrix is effectively singular. $\endgroup$ – Brian Borchers Apr 6 '13 at 20:26
  • $\begingroup$ You haven't told us what your right hand side is. Is the right hand side $b=0$? $\endgroup$ – Brian Borchers Apr 6 '13 at 20:27
  • $\begingroup$ ah the SVD singular values are bad: (6539.01908648159,2423.27751256167) (6.86711206338094,1.41421356237310) (1.41421356237309,0.999999975372136) (0.143418124026307,2.972522673431737E-015) (0.000000000000000E+000,0.000000000000000E+000) (0.000000000000000E+000,0.000000000000000E+000) (0.000000000000000E+000,0.000000000000000E+000) (0.000000000000000E+000,0.000000000000000E+000) I haven't looked at it.. the right hand side is full of complex numbers as well $\endgroup$ – lovis Apr 7 '13 at 18:43
  • $\begingroup$ but I am very surprised that the SVD procedure doesn't write an error and the equation solver doesn't "have a problem" as well. When the singular values are so bad $\endgroup$ – lovis Apr 7 '13 at 18:44
  • $\begingroup$ Just because the matrix is singular isn't a reason for the SVD to fail- singular matrices have perfectly good SVD's, it's just that some of the singular values are 0. What is surprising to me is that the zgetrs routine returns a 0 solution using the the singular U matrix computed by zgetrf. $\endgroup$ – Brian Borchers Apr 8 '13 at 2:27
1
$\begingroup$

Summarizing the answer to the question.

zgetrf (LU factorization of a complex matrix $A$) returns info=i>0 if $U_{ii}=0$; thus in your case $U_{44}=0$ during the attempted LU-decomposition by MKL. That happens (excluding very exotic cases) when your original matrix $A$ is singular or numerically singular. If zgetrf returned an error there is no point trying to execute back-substitution zgetrs.

"Why is my matrix singular?" — is a totally different question that requires the information about where $A$ comes from in the first place.

zgesvd will try to compute the singular value decomposition (SVD) of your matrix $A$. Note, every matrix (full-rank, singular, numerically singular - you name it) has an SVD. In your question, you mentioned that SVD has no troubles and $A$ is regular. I guess, you mean that zgesvd does not return any error message, which is an expected behavior. zgesvd returns info$\neq$0 only if some input parameter to it was wrong or the computation of SVD did not converge for some reason (see zgesvd).

To sum it up: for SVD-purposes, your matrix is fine, and in the comments, you listed the singular values that confirms the hypothesis of matrix being singular. Thus, LU-decomposition zgetrf will fail.

One may have the reasons to use zgetrf for factorizing followed by zgetrs; however, you might find useful zgesv, that is technically the wrapper around zgetrf/zgetrs (if you don't use its iterative refinement options). Its error messages (info) are the same as zgetrf. This might simplify your life in catching errors during the factorization and not executing unnecessary subroutines.

$\endgroup$
  • $\begingroup$ zgesvdx would give the conditioning information and makes a better assessment about the problem albeit slower. $\endgroup$ – percusse Aug 19 '17 at 8:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.