JuliaLang/IterativeSolvers.jl — pull request #18 by timholy (2013-12-21 00:24:45+00:00)
Title: Add LSQR and rework API

This is a combination of many things, loosely split into different commits.

In addition to adding LSQR and reworking the API, it fixes a number of real or potential problems:

- `cg` and likely others: if you supply the exact solution as an initial guess, it doesn't converge in a single step, at least in part because of unit-normalization in `init!(K::KrylovSubSpace, Vector)` and perhaps other issues
- in `stationary`, lines like `xold=x` don't copy the data (they will point to the same memory location, and hence `xold` gets updated along with `x`)
- `gmres` and perhaps others: not type stable (`x` can be `nothing` or a vector in the same function)
- At least `cg` and `chebychev`: if `A` and `b` are both integer matrices, we get `InexactError`s
- `simple`: routines compare against `tol * abs(θ)`, but then report convergence by comparing to `tol` (so you can converge but then claim you didn't)
- Several types had ambiguous fields

Only partially fixed:
- Many routines: if the user wants to iterate until convergence no matter what, a user might supply `maxiter=typemax(Int)`. Because of how `resnorms` gets allocated, this would cause memory problems. We might want to switch to the newly-added `push!` for recording residuals.

Of mild concern:
- If you comment out the random seed-setting in `test.jl`, repeated runs will throw errors, usually from `chebychev` but occasionally from `gmres`.

Switching the order of the fields in `ConvergenceHistory` was sort of an accident of history along the way to debugging something else; hopefully that's not too annoying.