Update nrm2_vector.c

This commit is contained in:
Martin Kroeker 2024-03-13 11:40:14 +01:00 committed by GitHub
parent 18a6db6862
commit 9baa757905
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 2 deletions

View File

@ -122,7 +122,7 @@ FLOAT CNAME(BLASLONG n, FLOAT *x, BLASLONG inc_x)
unsigned int stride_x = inc_x * sizeof(FLOAT); unsigned int stride_x = inc_x * sizeof(FLOAT);
int idx = 0; int idx = 0;
if( n >= gvl ) // don't pay overheads if we're not doing useful work if( n >= gvl && inc_x > 0) // don't pay overheads if we're not doing useful work
{ {
for(i=0; i<n/gvl; i++){ for(i=0; i<n/gvl; i++){
v0 = VLSEV_FLOAT( &x[idx], stride_x, gvl ); v0 = VLSEV_FLOAT( &x[idx], stride_x, gvl );
@ -193,7 +193,7 @@ FLOAT CNAME(BLASLONG n, FLOAT *x, BLASLONG inc_x)
//finish any tail using scalar ops //finish any tail using scalar ops
i*=gvl*inc_x; i*=gvl*inc_x;
n*=inc_x; n*=inc_x;
while(i< n){ while(abs(i)< abs(n)){
if ( x[i] != 0.0 ){ if ( x[i] != 0.0 ){
FLOAT absxi = ABS( x[i] ); FLOAT absxi = ABS( x[i] );
if ( scale < absxi ){ if ( scale < absxi ){