Skip to content

Commit

Permalink
Merge pull request #4841 from martin-frbg/lapack1033
Browse files Browse the repository at this point in the history
Prevent compilers from using FMA that could increase error in ?GEEVX (Reference-LAPACK PR 1033)
  • Loading branch information
martin-frbg authored Aug 5, 2024
2 parents ae9e0e3 + c8b4cec commit 5bdd3a0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
12 changes: 8 additions & 4 deletions lapack-netlib/SRC/dlanv2.f
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
*> \author Univ. of Colorado Denver
*> \author NAG Ltd.
*
*> \ingroup doubleOTHERauxiliary
*> \ingroup lanv2
*
*> \par Further Details:
* =====================
Expand Down Expand Up @@ -144,7 +144,7 @@ SUBROUTINE DLANV2( A, B, C, D, RT1R, RT1I, RT2R, RT2I, CS, SN )
* ..
* .. Local Scalars ..
DOUBLE PRECISION AA, BB, BCMAX, BCMIS, CC, CS1, DD, EPS, P, SAB,
$ SAC, SCALE, SIGMA, SN1, TAU, TEMP, Z, SAFMIN,
$ SAC, SCALE, SIGMA, SN1, TAU, TEMP, Z, SAFMIN,
$ SAFMN2, SAFMX2
INTEGER COUNT
* ..
Expand Down Expand Up @@ -248,10 +248,14 @@ SUBROUTINE DLANV2( A, B, C, D, RT1R, RT1I, RT2R, RT2I, CS, SN )
*
* Compute [ A B ] = [ CS SN ] [ AA BB ]
* [ C D ] [-SN CS ] [ CC DD ]
*
* Note: Some of the multiplications are wrapped in parentheses to
* prevent compilers from using FMA instructions. See
* https://github.com/Reference-LAPACK/lapack/issues/1031.
*
A = AA*CS + CC*SN
B = BB*CS + DD*SN
C = -AA*SN + CC*CS
B = ( BB*CS ) + ( DD*SN )
C = -( AA*SN ) + ( CC*CS )
D = -BB*SN + DD*CS
*
TEMP = HALF*( A+D )
Expand Down
12 changes: 8 additions & 4 deletions lapack-netlib/SRC/slanv2.f
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
*> \author Univ. of Colorado Denver
*> \author NAG Ltd.
*
*> \ingroup realOTHERauxiliary
*> \ingroup lanv2
*
*> \par Further Details:
* =====================
Expand Down Expand Up @@ -144,7 +144,7 @@ SUBROUTINE SLANV2( A, B, C, D, RT1R, RT1I, RT2R, RT2I, CS, SN )
* ..
* .. Local Scalars ..
REAL AA, BB, BCMAX, BCMIS, CC, CS1, DD, EPS, P, SAB,
$ SAC, SCALE, SIGMA, SN1, TAU, TEMP, Z, SAFMIN,
$ SAC, SCALE, SIGMA, SN1, TAU, TEMP, Z, SAFMIN,
$ SAFMN2, SAFMX2
INTEGER COUNT
* ..
Expand Down Expand Up @@ -248,10 +248,14 @@ SUBROUTINE SLANV2( A, B, C, D, RT1R, RT1I, RT2R, RT2I, CS, SN )
*
* Compute [ A B ] = [ CS SN ] [ AA BB ]
* [ C D ] [-SN CS ] [ CC DD ]
*
* Note: Some of the multiplications are wrapped in parentheses to
* prevent compilers from using FMA instructions. See
* https://github.com/Reference-LAPACK/lapack/issues/1031.
*
A = AA*CS + CC*SN
B = BB*CS + DD*SN
C = -AA*SN + CC*CS
B = ( BB*CS ) + ( DD*SN )
C = -( AA*SN ) + ( CC*CS )
D = -BB*SN + DD*CS
*
TEMP = HALF*( A+D )
Expand Down

0 comments on commit 5bdd3a0

Please sign in to comment.