# Test set for linear solvers

Lets assume I have a iterative linear system solver, e. g. this one.

Whats the typical approach on verifying and testing this kind of solvers? Is there a standard test set of linear systems one could use to verify the above BiCGStab-Implementation and if not, how would one create such test data?

• Hi alexz, and welcome to scicomp! You may find what you're looking for in this post: scicomp.stackexchange.com/questions/46/… – Paul Sep 5 '14 at 20:34
• I would also try to reproduce the results from the original paper, in this case – user2457602 Sep 14 '14 at 16:09

One thing you can do for smoke testing is to take a known solution $x$ (you could generate it randomly or pick something convenient) and a known matrix $A$, and then set $b$ equal to $Ax$, and solve the equation $Ax = b$ to see if you recover your known solution. This method is known as the method of manufactured solutions.
To avoid the influence of convergence issues, you probably want to make sure that $A$ is well-conditioned. One way to manufacture a well-conditioned $A$ would be to select a collection of eigenvalues that are in a bounded interval, and construct the diagonal matrix $\Lambda$ such that the main diagonal consists of those eigenvalues. Then, if you generate an invertible matrix $V$ (also should be well conditioned), $A = V \Lambda V^{-1}$. It's probably best to let $V$ be orthogonal in some of your test cases, in which case $V^{-1} = V^{T}$ and you avoid conditioning issues at the cost of making $A$ symmetric.