Dear folks!
There is a bug in srotmg and drotmg in the reference blas that comes with LAPACK. It has been there at least since LAPACK 3.2. A test program, bug_srotmg.f90, demonstrating the problem using SROTMG, is attached.
What happens is that rotmg keeps 2 by 2 Givens rotations in factored form, G = D*H. As computation moves on, with repeated application of rotmg, the elements in the diagonal D gradually become smaller and may in the end underflow. Thus, when d11 or d22 < 4096^(-2), then D is scaled up and H is scaled down correspondingly inside rotmg. In the original BLAS (1977) this was implemented with assigned goto and worked OK, but in the current versions it just produces the wrong H completely in cases when both d11 and d22 go below 4096^(-2) simultaneously (which can happen in realistic cases).
Fixed versions of both SROTMG and DROTMG are also attached to this post.
Kristjan Jonasson, University of Iceland
Mick Pont, NAG

