This is a nice short code, but it covers only a very special case and does not tell which one exactly.
I recommend spincalc() from Jonathan Fuller. It is much more powerfull!

Regarding my own question: to use the initial vector different than 0, one needs to change the line 140 from u = b to u = b - A*x0. Take it with caution - this was only an empirical guess.

Dear all
Hi,
what is the main reason of better convergence rate and more speed of LSMR in comparison to LSQR algorithm for solving linear least squares equations?
contact me via "mojtabasadeghi44@yahoo.com".
Best wishes.

Hello,
I am trying to use your code for the very large overdetermined linear system, which needs to be repeatedly solved many times with a different right hand side. Hence, I wonder if warm-starting is possible (the naive extension with the initial guess renders the algorithm unstable)?
Thanks,
Srdan

This is a nice short code, but it covers only a very special case and does not tell which one exactly.
I recommend spincalc() from Jonathan Fuller. It is much more powerfull!
http://www.mathworks.com/matlabcentral/fileexchange/20696-function-to-convert-between-dcm-euler-angles-quaternions-and-euler-vectors

Comment only