From ff5dc3ebc1ad5437ea7849feedf76752b10dfdb2 Mon Sep 17 00:00:00 2001 From: Martin Kroeker Date: Mon, 30 Mar 2026 20:24:31 +0200 Subject: [PATCH] Change loop ordering to improve performance (Reference-LAPACK PR 1023) --- lapack-netlib/SRC/cgetc2.f | 12 +++++------- lapack-netlib/SRC/dgetc2.f | 12 +++++------- lapack-netlib/SRC/sgetc2.f | 12 +++++------- lapack-netlib/SRC/zgetc2.f | 12 +++++------- 4 files changed, 20 insertions(+), 28 deletions(-) diff --git a/lapack-netlib/SRC/cgetc2.f b/lapack-netlib/SRC/cgetc2.f index 94267d767..85e54e20e 100644 --- a/lapack-netlib/SRC/cgetc2.f +++ b/lapack-netlib/SRC/cgetc2.f @@ -5,7 +5,6 @@ * Online html documentation available at * http://www.netlib.org/lapack/explore-html/ * -*> \htmlonly *> Download CGETC2 + dependencies *> *> [TGZ] @@ -13,7 +12,6 @@ *> [ZIP] *> *> [TXT] -*> \endhtmlonly * * Definition: * =========== @@ -98,7 +96,7 @@ *> \author Univ. of Colorado Denver *> \author NAG Ltd. * -*> \ingroup complexGEauxiliary +*> \ingroup getc2 * *> \par Contributors: * ================== @@ -108,6 +106,7 @@ * * ===================================================================== SUBROUTINE CGETC2( N, A, LDA, IPIV, JPIV, INFO ) + IMPLICIT NONE * * -- LAPACK auxiliary routine -- * -- LAPACK is a software package provided by Univ. of Tennessee, -- @@ -132,7 +131,7 @@ REAL BIGNUM, EPS, SMIN, SMLNUM, XMAX * .. * .. External Subroutines .. - EXTERNAL CGERU, CSWAP, SLABAD + EXTERNAL CGERU, CSWAP * .. * .. External Functions .. REAL SLAMCH @@ -155,7 +154,6 @@ EPS = SLAMCH( 'P' ) SMLNUM = SLAMCH( 'S' ) / EPS BIGNUM = ONE / SMLNUM - CALL SLABAD( SMLNUM, BIGNUM ) * * Handle the case N=1 by itself * @@ -177,8 +175,8 @@ * Find max element in matrix A * XMAX = ZERO - DO 20 IP = I, N - DO 10 JP = I, N + DO 20 JP = I, N + DO 10 IP = I, N IF( ABS( A( IP, JP ) ).GE.XMAX ) THEN XMAX = ABS( A( IP, JP ) ) IPV = IP diff --git a/lapack-netlib/SRC/dgetc2.f b/lapack-netlib/SRC/dgetc2.f index d2f0ede82..4f9a289d9 100644 --- a/lapack-netlib/SRC/dgetc2.f +++ b/lapack-netlib/SRC/dgetc2.f @@ -5,7 +5,6 @@ * Online html documentation available at * http://www.netlib.org/lapack/explore-html/ * -*> \htmlonly *> Download DGETC2 + dependencies *> *> [TGZ] @@ -13,7 +12,6 @@ *> [ZIP] *> *> [TXT] -*> \endhtmlonly * * Definition: * =========== @@ -98,7 +96,7 @@ *> \author Univ. of Colorado Denver *> \author NAG Ltd. * -*> \ingroup doubleGEauxiliary +*> \ingroup getc2 * *> \par Contributors: * ================== @@ -108,6 +106,7 @@ * * ===================================================================== SUBROUTINE DGETC2( N, A, LDA, IPIV, JPIV, INFO ) + IMPLICIT NONE * * -- LAPACK auxiliary routine -- * -- LAPACK is a software package provided by Univ. of Tennessee, -- @@ -132,7 +131,7 @@ DOUBLE PRECISION BIGNUM, EPS, SMIN, SMLNUM, XMAX * .. * .. External Subroutines .. - EXTERNAL DGER, DSWAP, DLABAD + EXTERNAL DGER, DSWAP * .. * .. External Functions .. DOUBLE PRECISION DLAMCH @@ -155,7 +154,6 @@ EPS = DLAMCH( 'P' ) SMLNUM = DLAMCH( 'S' ) / EPS BIGNUM = ONE / SMLNUM - CALL DLABAD( SMLNUM, BIGNUM ) * * Handle the case N=1 by itself * @@ -177,8 +175,8 @@ * Find max element in matrix A * XMAX = ZERO - DO 20 IP = I, N - DO 10 JP = I, N + DO 20 JP = I, N + DO 10 IP = I, N IF( ABS( A( IP, JP ) ).GE.XMAX ) THEN XMAX = ABS( A( IP, JP ) ) IPV = IP diff --git a/lapack-netlib/SRC/sgetc2.f b/lapack-netlib/SRC/sgetc2.f index a871a03ff..55511ac71 100644 --- a/lapack-netlib/SRC/sgetc2.f +++ b/lapack-netlib/SRC/sgetc2.f @@ -5,7 +5,6 @@ * Online html documentation available at * http://www.netlib.org/lapack/explore-html/ * -*> \htmlonly *> Download SGETC2 + dependencies *> *> [TGZ] @@ -13,7 +12,6 @@ *> [ZIP] *> *> [TXT] -*> \endhtmlonly * * Definition: * =========== @@ -98,7 +96,7 @@ *> \author Univ. of Colorado Denver *> \author NAG Ltd. * -*> \ingroup realGEauxiliary +*> \ingroup getc2 * *> \par Contributors: * ================== @@ -108,6 +106,7 @@ * * ===================================================================== SUBROUTINE SGETC2( N, A, LDA, IPIV, JPIV, INFO ) + IMPLICIT NONE * * -- LAPACK auxiliary routine -- * -- LAPACK is a software package provided by Univ. of Tennessee, -- @@ -132,7 +131,7 @@ REAL BIGNUM, EPS, SMIN, SMLNUM, XMAX * .. * .. External Subroutines .. - EXTERNAL SGER, SLABAD, SSWAP + EXTERNAL SGER, SSWAP * .. * .. External Functions .. REAL SLAMCH @@ -155,7 +154,6 @@ EPS = SLAMCH( 'P' ) SMLNUM = SLAMCH( 'S' ) / EPS BIGNUM = ONE / SMLNUM - CALL SLABAD( SMLNUM, BIGNUM ) * * Handle the case N=1 by itself * @@ -177,8 +175,8 @@ * Find max element in matrix A * XMAX = ZERO - DO 20 IP = I, N - DO 10 JP = I, N + DO 20 JP = I, N + DO 10 IP = I, N IF( ABS( A( IP, JP ) ).GE.XMAX ) THEN XMAX = ABS( A( IP, JP ) ) IPV = IP diff --git a/lapack-netlib/SRC/zgetc2.f b/lapack-netlib/SRC/zgetc2.f index eb97194f2..2d94e5312 100644 --- a/lapack-netlib/SRC/zgetc2.f +++ b/lapack-netlib/SRC/zgetc2.f @@ -5,7 +5,6 @@ * Online html documentation available at * http://www.netlib.org/lapack/explore-html/ * -*> \htmlonly *> Download ZGETC2 + dependencies *> *> [TGZ] @@ -13,7 +12,6 @@ *> [ZIP] *> *> [TXT] -*> \endhtmlonly * * Definition: * =========== @@ -98,7 +96,7 @@ *> \author Univ. of Colorado Denver *> \author NAG Ltd. * -*> \ingroup complex16GEauxiliary +*> \ingroup getc2 * *> \par Contributors: * ================== @@ -108,6 +106,7 @@ * * ===================================================================== SUBROUTINE ZGETC2( N, A, LDA, IPIV, JPIV, INFO ) + IMPLICIT NONE * * -- LAPACK auxiliary routine -- * -- LAPACK is a software package provided by Univ. of Tennessee, -- @@ -132,7 +131,7 @@ DOUBLE PRECISION BIGNUM, EPS, SMIN, SMLNUM, XMAX * .. * .. External Subroutines .. - EXTERNAL ZGERU, ZSWAP, DLABAD + EXTERNAL ZGERU, ZSWAP * .. * .. External Functions .. DOUBLE PRECISION DLAMCH @@ -155,7 +154,6 @@ EPS = DLAMCH( 'P' ) SMLNUM = DLAMCH( 'S' ) / EPS BIGNUM = ONE / SMLNUM - CALL DLABAD( SMLNUM, BIGNUM ) * * Handle the case N=1 by itself * @@ -177,8 +175,8 @@ * Find max element in matrix A * XMAX = ZERO - DO 20 IP = I, N - DO 10 JP = I, N + DO 20 JP = I, N + DO 10 IP = I, N IF( ABS( A( IP, JP ) ).GE.XMAX ) THEN XMAX = ABS( A( IP, JP ) ) IPV = IP