Reputation: 59
What is the best way (in terms of the accuracy of the result) to solve a linear system?. Is it using iterative methods (like conjugate gradient...) or decomposition methods (like SVD or LU)?
If you can recommend any solver in C++.
Thank you in advance.
Upvotes: 0
Views: 67
Reputation: 26342
In numerical methods there is usually no best way to do anything. If there had been the best algorithm to solve a linear system, everyone would've been using it. Direct and iterative methods are somewhat orthogonal to each other: direct methods are useful when the system size is small and you need accurate solution, iterative methods can be used for much larger systems and when you can tolerate a certain error. The choice of a linear solver also depends on the type of a system matrix, dense or sparse, and its properties (symmetry, positive-definiteness, etc.).
There are many linear solvers available in C++. Take a look, for example, at Intel MKL library. It is free now.
Upvotes: 1