Page 1 of 1

xROTMG issue & proposed fix

PostPosted: Tue Jun 25, 2019 11:02 am
by jonasson
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.
bug_srotmg.f90.txt
Program demonstrating bug
(1.1 KiB) Downloaded 461 times


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.
srotmg.f.txt
(7.66 KiB) Downloaded 471 times

drotmg.f.txt
(7.8 KiB) Downloaded 470 times


Kristjan Jonasson, University of Iceland
Mick Pont, NAG

Re: xROTMG issue & proposed fix

PostPosted: Tue Jun 25, 2019 11:54 am
by Julien Langou
Thanks Kristjan and Mick!
We will have a look. Can you post this post on GitHub as an issue?
https://github.com/Reference-LAPACK/lapack
Cheers, Julien.