The function JacobiSVD and BDCSVD can calcuate condtion number of a dense matrix via singular values. However I need to know condition number of a sparese matrix due to slow computation speed using iterative linear solver. I can't find such function. If the sparse matrix is converted to one dense one in advance, the memory allocation occur because of large size of the matrix(about 10,000 x 10, 000). Many people may encounter this problem. Is there one way there to calculate condition number for a large sparese matrix in Eigen?

  • 1
    $\begingroup$ But see: gitlab.com/libeigen/eigen/-/blob/master/Eigen/src/Core/… $\endgroup$ – user14717 Sep 17 '20 at 15:59
  • 2
    $\begingroup$ calculating != estimating. Would a (non-guaranteed) estimate be sufficient for you OP? $\endgroup$ – Federico Poloni Sep 17 '20 at 17:55
  • 2
    $\begingroup$ ^this. Computing eigenvalues/condition numbers is expensive for sparse matrices. But there are randomized algorithms that are much cheaper. $\endgroup$ – Wolfgang Bangerth Sep 17 '20 at 18:45
  • 1
    $\begingroup$ 10000 by 10000 isn't large- it requires less than a gigabyte of RAM to store such a matrix in double precision. If you just want to investigate the conditioning of some sample matrices, there's absolutely no reason not to convert to full and compute the condition number approximately using an LU factorization or more precisely using the SVD. Once you have a better understanding of the ill-conditioning of your problems, you can look to improve the preconditioner that you're using with your iterative method. $\endgroup$ – Brian Borchers Sep 18 '20 at 4:32
  • 1
    $\begingroup$ SuiteSparse has a routine called cholmod rcond which estimates the reciprocal condition number of a sparse matrix that can be decomposed with an LLT or LDLT factorization. "Returns a rough estimate of the reciprocal of the condition number: the minimum entry on the diagonal of L (or absolute entry of D for an LDLT factorization) divided by the maximum entry." This seems like a viable alternative to forming the dense matrix. fossies.org/linux/SuiteSparse/CHOLMOD/Doc/CHOLMOD_UserGuide.pdf $\endgroup$ – Charlie S Sep 27 '20 at 17:57

Your Answer

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

Browse other questions tagged or ask your own question.