Fix pivot index for negative increments
authorMartin Kroeker <martin@ruby.chemie.uni-freiburg.de>
Sun, 16 Jan 2022 23:05:33 +0000 (00:05 +0100)
committerGitHub <noreply@github.com>
Sun, 16 Jan 2022 23:05:33 +0000 (00:05 +0100)
lapack/laswp/generic/laswp_k_1.c

index 88648cf..5568892 100644 (file)
@@ -57,10 +57,9 @@ int CNAME(BLASLONG n, BLASLONG k1, BLASLONG k2, FLOAT dummy1, FLOAT *a, BLASLONG
   a--;
   k1 --;
 
-#ifndef MINUS
  ipiv += k1;
-#else
-  ipiv -= (k2 - 1) * incx;
+#ifdef MINUS
+  ipiv -= (k2 - k1 - 1) * incx;
 #endif
 
   if (n  <= 0) return 0;