Cloudy & Associates

solvers for ill conditioned matrices

Our chemistry master matrix is ill-conditioned, according to Robin's analysis. Here are some packages that might help, according to ChatGPT:

Yes, there are several high-quality open-source linear algebra libraries capable of handling ill-conditioned matrices, depending on your needs (language, problem size, matrix type). Here are some widely used ones with robust features:

🔧 Top Open-Source Packages for Ill-Conditioned Matrices LAPACK / LAPACK++ / CLAPACK Languages: Fortran (core), C/C++, Python (via wrappers) Use: Dense and banded matrices, solving linear systems, SVD, eigenvalues. Handles ill-conditioning? Yes, especially through routines like SVD or pivoted QR decompositions. Bindings: Python: SciPy (scipy.linalg) C++: LAPACK++ C: CLAPACK

🟦 SuiteSparse / UMFPACK Languages: C, C++, Python (via scikit-umfpack) Use: Sparse matrix solvers, including LU with partial pivoting. Handles ill-conditioning? Yes — reliable for sparse, nearly singular matrices.

Eigen Language: C++ Use: General-purpose linear algebra; includes dense matrix decompositions (e.g., QR, SVD). Handles ill-conditioning? Yes, especially via JacobiSVD, CompleteOrthogonalDecomposition.

🟧 PETSc (Portable Extensible Toolkit for Scientific Computation) Language: C with bindings for Python, Fortran Use: Large-scale systems, iterative solvers, preconditioning Handles ill-conditioning? Yes — especially with custom preconditioners for very large systems.

🟨 SciPy (Python) Language: Python (built on LAPACK, BLAS, and SuiteSparse) Use: General numerical computation, including scipy.linalg and scipy.sparse.linalg Handles ill-conditioning? Yes Example: scipy.linalg.lstsq, scipy.linalg.svd, or regularized solvers.

Tips for Solving Ill-Conditioned Matrices

Use SVD: It’s numerically stable and provides a way to regularize or truncate small singular values.

Use QR with column pivoting (dgeqp3 in LAPACK).

Use Tikhonov regularization (also known as ridge regression).

Preconditioning is essential in iterative methods like CG or GMRES.

Recommendations by Language Language Recommended Library

Python scipy.linalg with svd, pinv, or lstsq

C++ Eigen or LAPACK++

C LAPACK or UMFPACK

Mixed HPC PETSc or Trilinos