This question already has an answer here:

I am looking for a LAPACK routine that allows to find a non-trivial solution to the following equation:

A x = 0

provided that A is a n×n square singular non-symmetric band matrix.

In reality A matrix may not be exactly singular as it is based on some parameter and I use a root finding algorithm to find this parameter (requiring det(A) = 0, where the determinant is found with DGBTRF and multiplication of the diagonal elements).

The only solution I have came up so far is to consider A a dense matrix matrix, use DGEEV to find its eigenvalues and eigenvectors and take the eigenvector for the eigenvalue closest to zero. However, I believe this is strongly sub-optimal approach. Can anyone suggest a better one?


marked as duplicate by Christian Clason, BrunoLevy, Community Nov 14 '15 at 18:14

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


LAPACK has xSTERF as routines to find eigenvalues for band matrices.

If you are only interested in the smallest one, you might find the following answer interesting. However you need to implement the algorithm yourself.

  • $\begingroup$ Could you actually link to the answer, not just the question (every answer has a share link, use that)? As it stands, I can't tell which one you refer to. $\endgroup$ – Christian Clason Nov 13 '15 at 16:26
  • $\begingroup$ Thanks a lot, but as I can see xSTERF is only for tridianonal symmetric matrix. My matrix unfortunatelly is neither tridiagonal nor symmetric. $\endgroup$ – Maciek D. Nov 14 '15 at 18:11

I'm not sure this would be much more efficient, but you can try to solve $Ax=v$ where $\|v\|<\varepsilon$. If the result $\|x\|$ is also $\|x\|<\epsilon$ the matrix may not be singular.

  • $\begingroup$ I have not tried this approach, but I have an impression that most LAPACK routines will fail if the matrix is singular. And in real case the matrix will be only close to singular due to the numerical errors. $\endgroup$ – Maciek D. Nov 14 '15 at 18:17
  • $\begingroup$ you will need QR solver... $\endgroup$ – Michael Medvinsky Nov 14 '15 at 18:46
  • $\begingroup$ also an iterative solver may work $\endgroup$ – Michael Medvinsky Nov 14 '15 at 18:49

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