--- rpl/lapack/lapack/zhetf2.f 2011/11/21 20:43:12 1.9
+++ rpl/lapack/lapack/zhetf2.f 2023/08/07 08:39:24 1.19
@@ -1,25 +1,25 @@
-*> \brief \b ZHETF2
+*> \brief \b ZHETF2 computes the factorization of a complex Hermitian matrix, using the diagonal pivoting method (unblocked algorithm, calling Level 2 BLAS).
*
* =========== DOCUMENTATION ===========
*
-* Online html documentation available at
-* http://www.netlib.org/lapack/explore-html/
+* Online html documentation available at
+* http://www.netlib.org/lapack/explore-html/
*
*> \htmlonly
-*> Download ZHETF2 + dependencies
-*>
-*> [TGZ]
-*>
-*> [ZIP]
-*>
+*> Download ZHETF2 + dependencies
+*>
+*> [TGZ]
+*>
+*> [ZIP]
+*>
*> [TXT]
-*> \endhtmlonly
+*> \endhtmlonly
*
* Definition:
* ===========
*
* SUBROUTINE ZHETF2( UPLO, N, A, LDA, IPIV, INFO )
-*
+*
* .. Scalar Arguments ..
* CHARACTER UPLO
* INTEGER INFO, LDA, N
@@ -28,7 +28,7 @@
* INTEGER IPIV( * )
* COMPLEX*16 A( LDA, * )
* ..
-*
+*
*
*> \par Purpose:
* =============
@@ -90,13 +90,22 @@
*> \verbatim
*> IPIV is INTEGER array, dimension (N)
*> Details of the interchanges and the block structure of D.
-*> If IPIV(k) > 0, then rows and columns k and IPIV(k) were
-*> interchanged and D(k,k) is a 1-by-1 diagonal block.
-*> If UPLO = 'U' and IPIV(k) = IPIV(k-1) < 0, then rows and
-*> columns k-1 and -IPIV(k) were interchanged and D(k-1:k,k-1:k)
-*> is a 2-by-2 diagonal block. If UPLO = 'L' and IPIV(k) =
-*> IPIV(k+1) < 0, then rows and columns k+1 and -IPIV(k) were
-*> interchanged and D(k:k+1,k:k+1) is a 2-by-2 diagonal block.
+*>
+*> If UPLO = 'U':
+*> If IPIV(k) > 0, then rows and columns k and IPIV(k) were
+*> interchanged and D(k,k) is a 1-by-1 diagonal block.
+*>
+*> If IPIV(k) = IPIV(k-1) < 0, then rows and columns
+*> k-1 and -IPIV(k) were interchanged and D(k-1:k,k-1:k)
+*> is a 2-by-2 diagonal block.
+*>
+*> If UPLO = 'L':
+*> If IPIV(k) > 0, then rows and columns k and IPIV(k) were
+*> interchanged and D(k,k) is a 1-by-1 diagonal block.
+*>
+*> If IPIV(k) = IPIV(k+1) < 0, then rows and columns
+*> k+1 and -IPIV(k) were interchanged and D(k:k+1,k:k+1)
+*> is a 2-by-2 diagonal block.
*> \endverbatim
*>
*> \param[out] INFO
@@ -113,12 +122,10 @@
* Authors:
* ========
*
-*> \author Univ. of Tennessee
-*> \author Univ. of California Berkeley
-*> \author Univ. of Colorado Denver
-*> \author NAG Ltd.
-*
-*> \date November 2011
+*> \author Univ. of Tennessee
+*> \author Univ. of California Berkeley
+*> \author Univ. of Colorado Denver
+*> \author NAG Ltd.
*
*> \ingroup complex16HEcomputational
*
@@ -182,10 +189,9 @@
* =====================================================================
SUBROUTINE ZHETF2( UPLO, N, A, LDA, IPIV, INFO )
*
-* -- LAPACK computational routine (version 3.4.0) --
+* -- LAPACK computational routine --
* -- LAPACK is a software package provided by Univ. of Tennessee, --
* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
-* November 2011
*
* .. Scalar Arguments ..
CHARACTER UPLO
@@ -273,7 +279,8 @@
ABSAKK = ABS( DBLE( A( K, K ) ) )
*
* IMAX is the row-index of the largest off-diagonal element in
-* column K, and COLMAX is its absolute value
+* column K, and COLMAX is its absolute value.
+* Determine both COLMAX and IMAX.
*
IF( K.GT.1 ) THEN
IMAX = IZAMAX( K-1, A( 1, K ), 1 )
@@ -284,13 +291,19 @@
*
IF( (MAX( ABSAKK, COLMAX ).EQ.ZERO) .OR. DISNAN(ABSAKK) ) THEN
*
-* Column K is zero or contains a NaN: set INFO and continue
+* Column K is zero or underflow, or contains a NaN:
+* set INFO and continue
*
IF( INFO.EQ.0 )
$ INFO = K
KP = K
A( K, K ) = DBLE( A( K, K ) )
ELSE
+*
+* ============================================================
+*
+* Test for interchange
+*
IF( ABSAKK.GE.ALPHA*COLMAX ) THEN
*
* no interchange, use 1-by-1 pivot block
@@ -299,7 +312,8 @@
ELSE
*
* JMAX is the column-index of the largest off-diagonal
-* element in row IMAX, and ROWMAX is its absolute value
+* element in row IMAX, and ROWMAX is its absolute value.
+* Determine only ROWMAX.
*
JMAX = IMAX + IZAMAX( K-IMAX, A( IMAX, IMAX+1 ), LDA )
ROWMAX = CABS1( A( IMAX, JMAX ) )
@@ -313,6 +327,7 @@
* no interchange, use 1-by-1 pivot block
*
KP = K
+*
ELSE IF( ABS( DBLE( A( IMAX, IMAX ) ) ).GE.ALPHA*ROWMAX )
$ THEN
*
@@ -328,8 +343,11 @@
KP = IMAX
KSTEP = 2
END IF
+*
END IF
*
+* ============================================================
+*
KK = K - KSTEP + 1
IF( KP.NE.KK ) THEN
*
@@ -456,7 +474,8 @@
ABSAKK = ABS( DBLE( A( K, K ) ) )
*
* IMAX is the row-index of the largest off-diagonal element in
-* column K, and COLMAX is its absolute value
+* column K, and COLMAX is its absolute value.
+* Determine both COLMAX and IMAX.
*
IF( K.LT.N ) THEN
IMAX = K + IZAMAX( N-K, A( K+1, K ), 1 )
@@ -467,13 +486,19 @@
*
IF( (MAX( ABSAKK, COLMAX ).EQ.ZERO) .OR. DISNAN(ABSAKK) ) THEN
*
-* Column K is zero or contains a NaN: set INFO and continue
+* Column K is zero or underflow, or contains a NaN:
+* set INFO and continue
*
IF( INFO.EQ.0 )
$ INFO = K
KP = K
A( K, K ) = DBLE( A( K, K ) )
ELSE
+*
+* ============================================================
+*
+* Test for interchange
+*
IF( ABSAKK.GE.ALPHA*COLMAX ) THEN
*
* no interchange, use 1-by-1 pivot block
@@ -482,7 +507,8 @@
ELSE
*
* JMAX is the column-index of the largest off-diagonal
-* element in row IMAX, and ROWMAX is its absolute value
+* element in row IMAX, and ROWMAX is its absolute value.
+* Determine only ROWMAX.
*
JMAX = K - 1 + IZAMAX( IMAX-K, A( IMAX, K ), LDA )
ROWMAX = CABS1( A( IMAX, JMAX ) )
@@ -496,6 +522,7 @@
* no interchange, use 1-by-1 pivot block
*
KP = K
+*
ELSE IF( ABS( DBLE( A( IMAX, IMAX ) ) ).GE.ALPHA*ROWMAX )
$ THEN
*
@@ -511,8 +538,11 @@
KP = IMAX
KSTEP = 2
END IF
+*
END IF
*
+* ============================================================
+*
KK = K + KSTEP - 1
IF( KP.NE.KK ) THEN
*