Looking at the matrix you uploaded, a number of things seem a bit strange:
- Your matrix
K
is a relatively small (400 x 400
) dense matrix.
- Your matrix
K
contains a significant number of near-zero entries, with (abs(K(i,j)) < 1.E-16*max(abs(K))
).
For matrices of this size, computing the Cholesky factorisation directly should be the most efficient approach. I'm not sure why you say that you can't do this?
Iterative techniques, such as preconditioned conjugate gradient methods, are typically used only for very large and sparse systems of equations, so don't seem applicable here.
When solving systems of sparse linear equations such as this it's not the number of rows/cols in the matrix that's important it's the sparsity pattern of the matrix itself.
If, for instance, your matrix A
is very sparse it may be possible to compute the sparse Cholesky factorisation A = L*L'
directly. Beware though, the ordering of equations determines the sparsity pattern of the resulting factors, and choosing a poor ordering strategy for A
can result in catastrophic fill-in for L*L'
and poor performance.
There are a number of strategies, such as Approximate Minimum Degree and Multi-level Nested Dissection that should be used to reorder A
to obtain pseudo-optimal sparsity for L*L'
.
A number of good packages exist that implement high performance sparse factorisation, including implementations of the re-ordering schemes described above. I would recommend looking into the CHOLMOD package by Davis.
If you still find that your system of equations is too big to handle efficiently using direct factorisation you should look into preconditioning your iterative PCG
solver.
Good preconditioning can reduce the effective condition number of the linear system - greatly enhancing convergence in most cases.
You should always use at least the simple diagonal Jacobi preconditioner, although usually much better performance can be realised using more sophisticated approaches such as incomplete Cholesky factorisation or possibly algebraic multi-grid or multi-level methods. You may find the PETSc library helpful in this regard, as it contains high-performance implementations of a number of iterative solvers and preconditioning schemes.
Hope this helps.