# Symmetric sparse direct solvers in scipy

scipy.linalg.solve, in its newer versions, has a parameter assume_a that can be used to specify that the matrix $$A$$ is symmetric or positive definite; in these cases, LDL or Cholesky are used rather than LU (Lapack's sysv and posv rather than gesv).

Is there a similar interface for sparse solvers? As far as I understand, scipy.sparse.linalg.spsolve does not support assume_a and always uses LU. What is the recommended way to use a symmetric sparse direct solver in Scipy, then (if there is any at all)?

I have seen that there is also sksparse.cholmod, but it is a separate package with a different interface, and from the documentation it looks like it does not handle indefinite matrices at all.

• For Cholesky, $A$ must of course be nonnegative definite, eigenvalues $\ge 0$. E.g. sksparse.cholmod.cholesky( A, beta=1e-6 ) does $A + 10^{-6} I \to L L'$. Is that what you want ? Jan 12 '20 at 18:03
• @denis I was hoping to find also something for truly indefinite matrices like LDL (something that can solve a system with $\begin{bmatrix}0 & 1 \\ 1 & 0\end{bmatrix}$, for instance). And I was hoping to find it in scipy rather than in another package, but that may be asking too much. :) Jan 12 '20 at 18:10
• Would you know of test cases for such problems, with matrices, on the web ? Thanks Jan 15 '20 at 14:26
• @denis You can find a lot of them if you select "numerical symmetry property: symmetric indefinite" in the Matrix market search tool. For instance these ones. Jan 15 '20 at 15:23
• Would you know of problems for generalized eigenvalues, pairs $A, M$ ? Matrixmarket is from 1999 / 2004, a long time ago (Moore's laws of cpus, memory, software, maybe eigenvalue algorithms too). Thanks Jan 24 '20 at 15:10