Skip to content

Commit

Permalink
Fix the wrong implementation of the new tests for xblat1.f. (Fixes: #963
Browse files Browse the repository at this point in the history
)

Since this is a regression after upgrading from v3.11.0 to v3.12.0, we can
narrow down the range of the bug into the newly added SB1NRM2 subroutine.
According to the buildlog and the documentation in the code, the VALUES(9),
calculated as SXVALS(XX,2) should be infty. But the current code is returning
a zero (or randomly) initialized variable YY, which does not make sense.

In fact, if you go back to the reference implementation, namely the
supplementary material of this paper
  https://dl.acm.org/doi/abs/10.1145/3061665
You can find a similar implementation of the SXVALS function in the
`la_xxvals.F90` file. This patch corrests the test following the reference
code.
  • Loading branch information
cdluminate committed Dec 21, 2023
1 parent db501d9 commit d371e22
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 8 deletions.
8 changes: 6 additions & 2 deletions BLAS/TESTING/cblat1.f
Original file line number Diff line number Diff line change
Expand Up @@ -994,13 +994,17 @@ REAL FUNCTION SXVALS(XX,K)
* .. Scalar Arguments ..
REAL XX
INTEGER K
* .. Parameters ..
REAL ZERO
PARAMETER (ZERO=0.0E+0)
* .. Local Scalars ..
REAL X, Y, YY, Z
REAL X, Y, Z
* .. Intrinsic Functions ..
INTRINSIC HUGE
* .. Executable Statements ..
X = ZERO
Y = HUGE(XX)
Z = YY
Z = Y*Y
IF (K.EQ.1) THEN
X = -Z
ELSE IF (K.EQ.2) THEN
Expand Down
8 changes: 6 additions & 2 deletions BLAS/TESTING/dblat1.f
Original file line number Diff line number Diff line change
Expand Up @@ -1326,13 +1326,17 @@ DOUBLE PRECISION FUNCTION DXVALS(XX,K)
* .. Scalar Arguments ..
DOUBLE PRECISION XX
INTEGER K
* .. Parameters ..
DOUBLE PRECISION ZERO
PARAMETER (ZERO=0.0D+0)
* .. Local Scalars ..
DOUBLE PRECISION X, Y, YY, Z
DOUBLE PRECISION X, Y, Z
* .. Intrinsic Functions ..
INTRINSIC HUGE
* .. Executable Statements ..
X = ZERO
Y = HUGE(XX)
Z = YY
Z = Y*Y
IF (K.EQ.1) THEN
X = -Z
ELSE IF (K.EQ.2) THEN
Expand Down
8 changes: 6 additions & 2 deletions BLAS/TESTING/sblat1.f
Original file line number Diff line number Diff line change
Expand Up @@ -1278,13 +1278,17 @@ REAL FUNCTION SXVALS(XX,K)
* .. Scalar Arguments ..
REAL XX
INTEGER K
* .. Parameters ..
REAL ZERO
PARAMETER (ZERO=0.0E+0)
* .. Local Scalars ..
REAL X, Y, YY, Z
REAL X, Y, Z
* .. Intrinsic Functions ..
INTRINSIC HUGE
* .. Executable Statements ..
X = ZERO
Y = HUGE(XX)
Z = YY
Z = Y*Y
IF (K.EQ.1) THEN
X = -Z
ELSE IF (K.EQ.2) THEN
Expand Down
8 changes: 6 additions & 2 deletions BLAS/TESTING/zblat1.f
Original file line number Diff line number Diff line change
Expand Up @@ -994,13 +994,17 @@ DOUBLE PRECISION FUNCTION DXVALS(XX,K)
* .. Scalar Arguments ..
DOUBLE PRECISION XX
INTEGER K
* .. Parameters ..
DOUBLE PRECISION ZERO
PARAMETER (ZERO=0.0D+0)
* .. Local Scalars ..
DOUBLE PRECISION X, Y, YY, Z
DOUBLE PRECISION X, Y, Z
* .. Intrinsic Functions ..
INTRINSIC HUGE
* .. Executable Statements ..
X = ZERO
Y = HUGE(XX)
Z = YY
Z = Y*Y
IF (K.EQ.1) THEN
X = -Z
ELSE IF (K.EQ.2) THEN
Expand Down

0 comments on commit d371e22

Please sign in to comment.