Fix pivot offset calculation for negative incx
authorMartin Kroeker <martin@ruby.chemie.uni-freiburg.de>
Sun, 16 Jan 2022 23:11:18 +0000 (00:11 +0100)
committerGitHub <noreply@github.com>
Sun, 16 Jan 2022 23:11:18 +0000 (00:11 +0100)
lapack/laswp/generic/zlaswp_k_4.c

index 45e1bf0..cc7e296 100644 (file)
@@ -69,10 +69,9 @@ int CNAME(BLASLONG n, BLASLONG k1, BLASLONG k2, FLOAT dummy1, FLOAT dummy4,
   lda *= 2;
   k1 --;
 
-#ifndef MINUS
  ipiv += k1;
-#else
-  ipiv -= (k2 - 1) * incx;
+#ifdef MINUS
+  ipiv -= (k2 - k1 - 1) * incx;
 #endif
 
   if (n  <= 0) return 0;