The multifrontal solvers are working only with positive definite
matrices. If you matrix is negative definite, you may just to change the
sign. Alternatively try ldlt solver in TAUCS - but it is slow.
>
> TAUCS gives me a "generic error" when trying to solve it.
If you use taucs_logfile("stdout"); then you should obtain better
description on what happens.
> Also, has anyone tried CSPARSE? Can anyone compare TAUCS vs. CSPARSE
> (pros/cons)?
Do you mean the package from Tim Davis? I have not tried it, so I do not
know.
Yes, I do.
I have browsed CSparse. I am not sure if this is the fastest code. It
better to look at other codes of Tim Davis at
http://www.cise.ufl.edu/research/sparse/
CHOLMOD should be equivalent to TAUCS but it also applicable for
positive definite matrices. For asymmetric matrices one could use
UMFPACK. For indefinite matrices there is LDL but it seems that it is
not multifrontal - therefore it should be similar to ldlt in TAUCS.
What typical dimensions of your matrices?
For simplicity I have tried this problem in SciPy (as a dense matrix).
It shows that the matrix, as one could expect, not positive definite.
However, when I negate both the matrix and the RHS I receive the right
answer
from numpy import *
from scipy.linalg import *
a = array(
[[-2, 1, 0, 0],
[1, -2, 1, 0],
[0, 1, -2, 1],
[0, 0, 1, -2]])
fac = cho_factor(-a)
print cho_solve(fac, array([2,1,1,2]))
This produces
[ 3. 4. 4. 3.]
So this should be the way to treat this problem with TAUCS. Just negate
the matrix and RHS.
*nods* CSparse wasn't meant to be the fastest; it was meant to be a
readable demonstration code for algorithms used in sparse matrix
factorizations. It goes along with Tim Davis' recent SIAM Press book.
mfh
5000 x 5000 to 10000 x 10000
Anyway in my case all the matrices will be positive definite. That is
because the matrices are obtained from basis function obtained from a convex
optimization problem and so they will always be nonnegative basis functions.
-a
For such dimensions you definitely need a sparse solver. If a matrix
positive definite, then TAUCS should be okay.
I just thought that you matrices are smaller. For smaller matrices it
might well be that it will be faster to treat them as dense and run LAPACK.