Hello,
I faced a problem in solving sparse linear system of the form:
A*x = b
where:
A - is squared, symmetric and sparse matrix.
note: the matrix A contains only the upper triangular values (in order to
save memory)
b - a vector
x - a vector of variable
I tried:
1. Eigen::SparseLU<Eigen::SparseMatrix<double>, Eigen::COLAMDOrdering<int>>
2. Eigen::ConjugateGradient<Eigen::SparseMatrix<double>, Eigen::Upper>
None of them works well!
Is there any structure to this matrix A (e.g. tri-diagonal, penta-diagonal etc)? Where does it come from and what does it look like? Have you tried simple iterative schemes like Gauss-Seidel (with or without over-relaxation), which have the benefit of creating no "fill-in" within your sparse matrix?
If it has no structure, other than the fact it is symmetric, then Eigen's SparseCholesky module might be better than SparseLU.
What particular application is creating this matrix?
The matrix size is 300x300.
I will try to write my own.
I've got nothing against Eigen but a 300 x 300 (augmented) matrix no-frills solver you can write yourself on a half reasonable machine will eat it in seconds at the most.
Or you can use/abuse/change/condemn my <vector> version which I adapted from it for my purposes. I'll post it shortly, if you like.
Opinions vary obviously, and I don't want to stifle any debate, but the optimisations for a 300x300 matrix are probably not worth the trouble and strife from the added potential for introducing errors via the additional complexity.
Time taken to solve augmented 300 x 300 matrix 226486 microseconds
Blooper 0.00107663 detected row 201
No. of bloopers for the given tolerance: 1
... TEST 02 complete.
Program ended with exit code: 0
I should have included the range which goes up to 10^9 so the bloopers aren't significant.