From eca2f50b48a9941e2f3d2cd75fb699ace070f9cc Mon Sep 17 00:00:00 2001 From: Martin Kroeker Date: Mon, 17 Jan 2022 00:07:33 +0100 Subject: [PATCH] Fix pivot offset calculation for negative incx --- lapack/laswp/generic/laswp_k_4.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lapack/laswp/generic/laswp_k_4.c b/lapack/laswp/generic/laswp_k_4.c index 191a229a9..6520ed799 100644 --- a/lapack/laswp/generic/laswp_k_4.c +++ b/lapack/laswp/generic/laswp_k_4.c @@ -65,10 +65,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;