Skip to content

Commit 7af0f41

Browse files
authored
Merge pull request #4189 from martin-frbg/issue4186
Prepare the interface for INCX < 0 in the new NRM2 implementation from BLAS 3.10
2 parents afdc56a + 4cc804c commit 7af0f41

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

interface/nrm2.c

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,21 @@ FLOATRET NAME(blasint *N, FLOAT *x, blasint *INCX){
5454

5555
if (n <= 0) return 0.;
5656

57+
#ifndef COMPLEX
58+
if (n == 1)
59+
#ifdef DOUBLE
60+
return fabs(x[0]);
61+
#else
62+
return fabsf(x[0]);
63+
#endif
64+
#endif
65+
66+
if (incx < 0)
67+
#ifdef COMPLEX
68+
x -= (n - 1) * incx * 2;
69+
#else
70+
x -= (n - 1) * incx;
71+
#endif
5772
IDEBUG_START;
5873

5974
FUNCTION_PROFILE_START();
@@ -82,6 +97,22 @@ FLOAT CNAME(blasint n, FLOAT *x, blasint incx){
8297

8398
if (n <= 0) return 0.;
8499

100+
#ifndef COMPLEX
101+
if (n == 1)
102+
#ifdef DOUBLE
103+
return fabs(x[0]);
104+
#else
105+
return fabsf(x[0]);
106+
#endif
107+
#endif
108+
109+
if (incx < 0)
110+
#ifdef COMPLEX
111+
x -= (n - 1) * incx * 2;
112+
#else
113+
x -= (n - 1) * incx;
114+
#endif
115+
85116
IDEBUG_START;
86117

87118
FUNCTION_PROFILE_START();

0 commit comments

Comments
 (0)