Skip to content

Commit 0504c35

Browse files
committed
Fix the wrong implementation of the xblat1.f implementations. (Fixes: #963)
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.
1 parent db501d9 commit 0504c35

File tree

4 files changed

+12
-8
lines changed

4 files changed

+12
-8
lines changed

BLAS/TESTING/cblat1.f

+3-2
Original file line numberDiff line numberDiff line change
@@ -995,12 +995,13 @@ REAL FUNCTION SXVALS(XX,K)
995995
REAL XX
996996
INTEGER K
997997
* .. Local Scalars ..
998-
REAL X, Y, YY, Z
998+
REAL X, Y, Z
999999
* .. Intrinsic Functions ..
10001000
INTRINSIC HUGE
10011001
* .. Executable Statements ..
1002+
X = ZERO
10021003
Y = HUGE(XX)
1003-
Z = YY
1004+
Z = Y*Y
10041005
IF (K.EQ.1) THEN
10051006
X = -Z
10061007
ELSE IF (K.EQ.2) THEN

BLAS/TESTING/dblat1.f

+3-2
Original file line numberDiff line numberDiff line change
@@ -1327,12 +1327,13 @@ DOUBLE PRECISION FUNCTION DXVALS(XX,K)
13271327
DOUBLE PRECISION XX
13281328
INTEGER K
13291329
* .. Local Scalars ..
1330-
DOUBLE PRECISION X, Y, YY, Z
1330+
DOUBLE PRECISION X, Y, Z
13311331
* .. Intrinsic Functions ..
13321332
INTRINSIC HUGE
13331333
* .. Executable Statements ..
1334+
X = ZERO
13341335
Y = HUGE(XX)
1335-
Z = YY
1336+
Z = Y*Y
13361337
IF (K.EQ.1) THEN
13371338
X = -Z
13381339
ELSE IF (K.EQ.2) THEN

BLAS/TESTING/sblat1.f

+3-2
Original file line numberDiff line numberDiff line change
@@ -1279,12 +1279,13 @@ REAL FUNCTION SXVALS(XX,K)
12791279
REAL XX
12801280
INTEGER K
12811281
* .. Local Scalars ..
1282-
REAL X, Y, YY, Z
1282+
REAL X, Y, Z
12831283
* .. Intrinsic Functions ..
12841284
INTRINSIC HUGE
12851285
* .. Executable Statements ..
1286+
X = ZERO
12861287
Y = HUGE(XX)
1287-
Z = YY
1288+
Z = Y*Y
12881289
IF (K.EQ.1) THEN
12891290
X = -Z
12901291
ELSE IF (K.EQ.2) THEN

BLAS/TESTING/zblat1.f

+3-2
Original file line numberDiff line numberDiff line change
@@ -995,12 +995,13 @@ DOUBLE PRECISION FUNCTION DXVALS(XX,K)
995995
DOUBLE PRECISION XX
996996
INTEGER K
997997
* .. Local Scalars ..
998-
DOUBLE PRECISION X, Y, YY, Z
998+
DOUBLE PRECISION X, Y, Z
999999
* .. Intrinsic Functions ..
10001000
INTRINSIC HUGE
10011001
* .. Executable Statements ..
1002+
X = ZERO
10021003
Y = HUGE(XX)
1003-
Z = YY
1004+
Z = Y*Y
10041005
IF (K.EQ.1) THEN
10051006
X = -Z
10061007
ELSE IF (K.EQ.2) THEN

0 commit comments

Comments
 (0)