diff --git a/lapack-netlib/SRC/clahef_aa.f b/lapack-netlib/SRC/clahef_aa.f
index 88bc3d216..934aa92f9 100644
--- a/lapack-netlib/SRC/clahef_aa.f
+++ b/lapack-netlib/SRC/clahef_aa.f
@@ -288,8 +288,9 @@
*
* Swap A(I1, I2+1:N) with A(I2, I2+1:N)
*
- CALL CSWAP( M-I2, A( J1+I1-1, I2+1 ), LDA,
- $ A( J1+I2-1, I2+1 ), LDA )
+ IF( I2.LT.M )
+ $ CALL CSWAP( M-I2, A( J1+I1-1, I2+1 ), LDA,
+ $ A( J1+I2-1, I2+1 ), LDA )
*
* Swap A(I1, I1) with A(I2,I2)
*
@@ -329,13 +330,15 @@
* Compute L(J+2, J+1) = WORK( 3:N ) / T(J, J+1),
* where A(J, J+1) = T(J, J+1) and A(J+2:N, J) = L(J+2:N, J+1)
*
- IF( A( K, J+1 ).NE.ZERO ) THEN
- ALPHA = ONE / A( K, J+1 )
- CALL CCOPY( M-J-1, WORK( 3 ), 1, A( K, J+2 ), LDA )
- CALL CSCAL( M-J-1, ALPHA, A( K, J+2 ), LDA )
- ELSE
- CALL CLASET( 'Full', 1, M-J-1, ZERO, ZERO,
- $ A( K, J+2 ), LDA)
+ IF( J.LT.(M-1) ) THEN
+ IF( A( K, J+1 ).NE.ZERO ) THEN
+ ALPHA = ONE / A( K, J+1 )
+ CALL CCOPY( M-J-1, WORK( 3 ), 1, A( K, J+2 ), LDA )
+ CALL CSCAL( M-J-1, ALPHA, A( K, J+2 ), LDA )
+ ELSE
+ CALL CLASET( 'Full', 1, M-J-1, ZERO, ZERO,
+ $ A( K, J+2 ), LDA)
+ END IF
END IF
END IF
J = J + 1
@@ -440,8 +443,9 @@
*
* Swap A(I2+1:N, I1) with A(I2+1:N, I2)
*
- CALL CSWAP( M-I2, A( I2+1, J1+I1-1 ), 1,
- $ A( I2+1, J1+I2-1 ), 1 )
+ IF( I2.LT.M )
+ $ CALL CSWAP( M-I2, A( I2+1, J1+I1-1 ), 1,
+ $ A( I2+1, J1+I2-1 ), 1 )
*
* Swap A(I1, I1) with A(I2, I2)
*
@@ -481,13 +485,15 @@
* Compute L(J+2, J+1) = WORK( 3:N ) / T(J, J+1),
* where A(J, J+1) = T(J, J+1) and A(J+2:N, J) = L(J+2:N, J+1)
*
- IF( A( J+1, K ).NE.ZERO ) THEN
- ALPHA = ONE / A( J+1, K )
- CALL CCOPY( M-J-1, WORK( 3 ), 1, A( J+2, K ), 1 )
- CALL CSCAL( M-J-1, ALPHA, A( J+2, K ), 1 )
- ELSE
- CALL CLASET( 'Full', M-J-1, 1, ZERO, ZERO,
- $ A( J+2, K ), LDA )
+ IF( J.LT.(M-1) ) THEN
+ IF( A( J+1, K ).NE.ZERO ) THEN
+ ALPHA = ONE / A( J+1, K )
+ CALL CCOPY( M-J-1, WORK( 3 ), 1, A( J+2, K ), 1 )
+ CALL CSCAL( M-J-1, ALPHA, A( J+2, K ), 1 )
+ ELSE
+ CALL CLASET( 'Full', M-J-1, 1, ZERO, ZERO,
+ $ A( J+2, K ), LDA )
+ END IF
END IF
END IF
J = J + 1
diff --git a/lapack-netlib/SRC/clahef_rk.f b/lapack-netlib/SRC/clahef_rk.f
index 4d9dfbe8e..cc4603e9b 100644
--- a/lapack-netlib/SRC/clahef_rk.f
+++ b/lapack-netlib/SRC/clahef_rk.f
@@ -331,7 +331,7 @@
* of A and working backwards, and compute the matrix W = U12*D
* for use in updating A11 (note that conjg(W) is actually stored)
*
-* Initilize the first entry of array E, where superdiagonal
+* Initialize the first entry of array E, where superdiagonal
* elements of D are stored
*
E( 1 ) = CZERO
@@ -789,7 +789,7 @@
* of A and working forwards, and compute the matrix W = L21*D
* for use in updating A22 (note that conjg(W) is actually stored)
*
-* Initilize the unused last entry of the subdiagonal array E.
+* Initialize the unused last entry of the subdiagonal array E.
*
E( N ) = CZERO
*
diff --git a/lapack-netlib/SRC/clahqr.f b/lapack-netlib/SRC/clahqr.f
index de2b3938b..ef50b5a56 100644
--- a/lapack-netlib/SRC/clahqr.f
+++ b/lapack-netlib/SRC/clahqr.f
@@ -138,26 +138,26 @@
*> \param[out] INFO
*> \verbatim
*> INFO is INTEGER
-*> = 0: successful exit
-*> .GT. 0: if INFO = i, CLAHQR failed to compute all the
+*> = 0: successful exit
+*> > 0: if INFO = i, CLAHQR failed to compute all the
*> eigenvalues ILO to IHI in a total of 30 iterations
*> per eigenvalue; elements i+1:ihi of W contain
*> those eigenvalues which have been successfully
*> computed.
*>
-*> If INFO .GT. 0 and WANTT is .FALSE., then on exit,
+*> If INFO > 0 and WANTT is .FALSE., then on exit,
*> the remaining unconverged eigenvalues are the
*> eigenvalues of the upper Hessenberg matrix
-*> rows and columns ILO thorugh INFO of the final,
+*> rows and columns ILO through INFO of the final,
*> output value of H.
*>
-*> If INFO .GT. 0 and WANTT is .TRUE., then on exit
+*> If INFO > 0 and WANTT is .TRUE., then on exit
*> (*) (initial value of H)*U = U*(final value of H)
-*> where U is an orthognal matrix. The final
+*> where U is an orthogonal matrix. The final
*> value of H is upper Hessenberg and triangular in
*> rows and columns INFO+1 through IHI.
*>
-*> If INFO .GT. 0 and WANTZ is .TRUE., then on exit
+*> If INFO > 0 and WANTZ is .TRUE., then on exit
*> (final value of Z) = (initial value of Z)*U
*> where U is the orthogonal matrix in (*)
*> (regardless of the value of WANTT.)
diff --git a/lapack-netlib/SRC/clamswlq.f b/lapack-netlib/SRC/clamswlq.f
index f2f9ab7f9..f6909b666 100644
--- a/lapack-netlib/SRC/clamswlq.f
+++ b/lapack-netlib/SRC/clamswlq.f
@@ -1,3 +1,4 @@
+*> \brief \b CLAMSWLQ
*
* Definition:
* ===========
diff --git a/lapack-netlib/SRC/clamtsqr.f b/lapack-netlib/SRC/clamtsqr.f
index 77d09a573..c71e4aa7d 100644
--- a/lapack-netlib/SRC/clamtsqr.f
+++ b/lapack-netlib/SRC/clamtsqr.f
@@ -1,3 +1,4 @@
+*> \brief \b CLAMTSQR
*
* Definition:
* ===========
diff --git a/lapack-netlib/SRC/clangb.f b/lapack-netlib/SRC/clangb.f
index 14a163ea7..9818360fe 100644
--- a/lapack-netlib/SRC/clangb.f
+++ b/lapack-netlib/SRC/clangb.f
@@ -130,6 +130,7 @@
* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
* December 2016
*
+ IMPLICIT NONE
* .. Scalar Arguments ..
CHARACTER NORM
INTEGER KL, KU, LDAB, N
@@ -147,14 +148,17 @@
* ..
* .. Local Scalars ..
INTEGER I, J, K, L
- REAL SCALE, SUM, VALUE, TEMP
+ REAL SUM, VALUE, TEMP
+* ..
+* .. Local Arrays ..
+ REAL SSQ( 2 ), COLSSQ( 2 )
* ..
* .. External Functions ..
LOGICAL LSAME, SISNAN
EXTERNAL LSAME, SISNAN
* ..
* .. External Subroutines ..
- EXTERNAL CLASSQ
+ EXTERNAL CLASSQ, SCOMBSSQ
* ..
* .. Intrinsic Functions ..
INTRINSIC ABS, MAX, MIN, SQRT
@@ -207,15 +211,22 @@
ELSE IF( ( LSAME( NORM, 'F' ) ) .OR. ( LSAME( NORM, 'E' ) ) ) THEN
*
* Find normF(A).
+* SSQ(1) is scale
+* SSQ(2) is sum-of-squares
+* For better accuracy, sum each column separately.
*
- SCALE = ZERO
- SUM = ONE
+ SSQ( 1 ) = ZERO
+ SSQ( 2 ) = ONE
DO 90 J = 1, N
L = MAX( 1, J-KU )
K = KU + 1 - J + L
- CALL CLASSQ( MIN( N, J+KL )-L+1, AB( K, J ), 1, SCALE, SUM )
+ COLSSQ( 1 ) = ZERO
+ COLSSQ( 2 ) = ONE
+ CALL CLASSQ( MIN( N, J+KL )-L+1, AB( K, J ), 1,
+ $ COLSSQ( 1 ), COLSSQ( 2 ) )
+ CALL SCOMBSSQ( SSQ, COLSSQ )
90 CONTINUE
- VALUE = SCALE*SQRT( SUM )
+ VALUE = SSQ( 1 )*SQRT( SSQ( 2 ) )
END IF
*
CLANGB = VALUE
diff --git a/lapack-netlib/SRC/clange.f b/lapack-netlib/SRC/clange.f
index 50f705a18..00895c8bc 100644
--- a/lapack-netlib/SRC/clange.f
+++ b/lapack-netlib/SRC/clange.f
@@ -120,6 +120,7 @@
* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
* December 2016
*
+ IMPLICIT NONE
* .. Scalar Arguments ..
CHARACTER NORM
INTEGER LDA, M, N
@@ -137,14 +138,17 @@
* ..
* .. Local Scalars ..
INTEGER I, J
- REAL SCALE, SUM, VALUE, TEMP
+ REAL SUM, VALUE, TEMP
+* ..
+* .. Local Arrays ..
+ REAL SSQ( 2 ), COLSSQ( 2 )
* ..
* .. External Functions ..
LOGICAL LSAME, SISNAN
EXTERNAL LSAME, SISNAN
* ..
* .. External Subroutines ..
- EXTERNAL CLASSQ
+ EXTERNAL CLASSQ, SCOMBSSQ
* ..
* .. Intrinsic Functions ..
INTRINSIC ABS, MIN, SQRT
@@ -196,13 +200,19 @@
ELSE IF( ( LSAME( NORM, 'F' ) ) .OR. ( LSAME( NORM, 'E' ) ) ) THEN
*
* Find normF(A).
+* SSQ(1) is scale
+* SSQ(2) is sum-of-squares
+* For better accuracy, sum each column separately.
*
- SCALE = ZERO
- SUM = ONE
+ SSQ( 1 ) = ZERO
+ SSQ( 2 ) = ONE
DO 90 J = 1, N
- CALL CLASSQ( M, A( 1, J ), 1, SCALE, SUM )
+ COLSSQ( 1 ) = ZERO
+ COLSSQ( 2 ) = ONE
+ CALL CLASSQ( M, A( 1, J ), 1, COLSSQ( 1 ), COLSSQ( 2 ) )
+ CALL SCOMBSSQ( SSQ, COLSSQ )
90 CONTINUE
- VALUE = SCALE*SQRT( SUM )
+ VALUE = SSQ( 1 )*SQRT( SSQ( 2 ) )
END IF
*
CLANGE = VALUE
diff --git a/lapack-netlib/SRC/clanhb.f b/lapack-netlib/SRC/clanhb.f
index 2b034b19b..f78de23df 100644
--- a/lapack-netlib/SRC/clanhb.f
+++ b/lapack-netlib/SRC/clanhb.f
@@ -137,6 +137,7 @@
* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
* December 2016
*
+ IMPLICIT NONE
* .. Scalar Arguments ..
CHARACTER NORM, UPLO
INTEGER K, LDAB, N
@@ -154,14 +155,17 @@
* ..
* .. Local Scalars ..
INTEGER I, J, L
- REAL ABSA, SCALE, SUM, VALUE
+ REAL ABSA, SUM, VALUE
+* ..
+* .. Local Arrays ..
+ REAL SSQ( 2 ), COLSSQ( 2 )
* ..
* .. External Functions ..
LOGICAL LSAME, SISNAN
EXTERNAL LSAME, SISNAN
* ..
* .. External Subroutines ..
- EXTERNAL CLASSQ
+ EXTERNAL CLASSQ, SCOMBSSQ
* ..
* .. Intrinsic Functions ..
INTRINSIC ABS, MAX, MIN, REAL, SQRT
@@ -233,39 +237,57 @@
ELSE IF( ( LSAME( NORM, 'F' ) ) .OR. ( LSAME( NORM, 'E' ) ) ) THEN
*
* Find normF(A).
+* SSQ(1) is scale
+* SSQ(2) is sum-of-squares
+* For better accuracy, sum each column separately.
+*
+ SSQ( 1 ) = ZERO
+ SSQ( 2 ) = ONE
+*
+* Sum off-diagonals
*
- SCALE = ZERO
- SUM = ONE
IF( K.GT.0 ) THEN
IF( LSAME( UPLO, 'U' ) ) THEN
DO 110 J = 2, N
+ COLSSQ( 1 ) = ZERO
+ COLSSQ( 2 ) = ONE
CALL CLASSQ( MIN( J-1, K ), AB( MAX( K+2-J, 1 ), J ),
- $ 1, SCALE, SUM )
+ $ 1, COLSSQ( 1 ), COLSSQ( 2 ) )
+ CALL SCOMBSSQ( SSQ, COLSSQ )
110 CONTINUE
L = K + 1
ELSE
DO 120 J = 1, N - 1
- CALL CLASSQ( MIN( N-J, K ), AB( 2, J ), 1, SCALE,
- $ SUM )
+ COLSSQ( 1 ) = ZERO
+ COLSSQ( 2 ) = ONE
+ CALL CLASSQ( MIN( N-J, K ), AB( 2, J ), 1,
+ $ COLSSQ( 1 ), COLSSQ( 2 ) )
+ CALL SCOMBSSQ( SSQ, COLSSQ )
120 CONTINUE
L = 1
END IF
- SUM = 2*SUM
+ SSQ( 2 ) = 2*SSQ( 2 )
ELSE
L = 1
END IF
+*
+* Sum diagonal
+*
+ COLSSQ( 1 ) = ZERO
+ COLSSQ( 2 ) = ONE
DO 130 J = 1, N
IF( REAL( AB( L, J ) ).NE.ZERO ) THEN
ABSA = ABS( REAL( AB( L, J ) ) )
- IF( SCALE.LT.ABSA ) THEN
- SUM = ONE + SUM*( SCALE / ABSA )**2
- SCALE = ABSA
+ IF( COLSSQ( 1 ).LT.ABSA ) THEN
+ COLSSQ( 2 ) = ONE + COLSSQ(2)*( COLSSQ(1) / ABSA )**2
+ COLSSQ( 1 ) = ABSA
ELSE
- SUM = SUM + ( ABSA / SCALE )**2
+ COLSSQ( 2 ) = COLSSQ( 2 ) + ( ABSA / COLSSQ( 1 ) )**2
END IF
END IF
130 CONTINUE
- VALUE = SCALE*SQRT( SUM )
+ CALL SCOMBSSQ( SSQ, COLSSQ )
+ VALUE = SSQ( 1 )*SQRT( SSQ( 2 ) )
END IF
*
CLANHB = VALUE
diff --git a/lapack-netlib/SRC/clanhe.f b/lapack-netlib/SRC/clanhe.f
index 101d778eb..33d6c8b01 100644
--- a/lapack-netlib/SRC/clanhe.f
+++ b/lapack-netlib/SRC/clanhe.f
@@ -129,6 +129,7 @@
* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
* December 2016
*
+ IMPLICIT NONE
* .. Scalar Arguments ..
CHARACTER NORM, UPLO
INTEGER LDA, N
@@ -146,14 +147,17 @@
* ..
* .. Local Scalars ..
INTEGER I, J
- REAL ABSA, SCALE, SUM, VALUE
+ REAL ABSA, SUM, VALUE
+* ..
+* .. Local Arrays ..
+ REAL SSQ( 2 ), COLSSQ( 2 )
* ..
* .. External Functions ..
LOGICAL LSAME, SISNAN
EXTERNAL LSAME, SISNAN
* ..
* .. External Subroutines ..
- EXTERNAL CLASSQ
+ EXTERNAL CLASSQ, SCOMBSSQ
* ..
* .. Intrinsic Functions ..
INTRINSIC ABS, REAL, SQRT
@@ -223,31 +227,48 @@
ELSE IF( ( LSAME( NORM, 'F' ) ) .OR. ( LSAME( NORM, 'E' ) ) ) THEN
*
* Find normF(A).
+* SSQ(1) is scale
+* SSQ(2) is sum-of-squares
+* For better accuracy, sum each column separately.
+*
+ SSQ( 1 ) = ZERO
+ SSQ( 2 ) = ONE
+*
+* Sum off-diagonals
*
- SCALE = ZERO
- SUM = ONE
IF( LSAME( UPLO, 'U' ) ) THEN
DO 110 J = 2, N
- CALL CLASSQ( J-1, A( 1, J ), 1, SCALE, SUM )
+ COLSSQ( 1 ) = ZERO
+ COLSSQ( 2 ) = ONE
+ CALL CLASSQ( J-1, A( 1, J ), 1,
+ $ COLSSQ( 1 ), COLSSQ( 2 ) )
+ CALL SCOMBSSQ( SSQ, COLSSQ )
110 CONTINUE
ELSE
DO 120 J = 1, N - 1
- CALL CLASSQ( N-J, A( J+1, J ), 1, SCALE, SUM )
+ COLSSQ( 1 ) = ZERO
+ COLSSQ( 2 ) = ONE
+ CALL CLASSQ( N-J, A( J+1, J ), 1,
+ $ COLSSQ( 1 ), COLSSQ( 2 ) )
+ CALL SCOMBSSQ( SSQ, COLSSQ )
120 CONTINUE
END IF
- SUM = 2*SUM
+ SSQ( 2 ) = 2*SSQ( 2 )
+*
+* Sum diagonal
+*
DO 130 I = 1, N
IF( REAL( A( I, I ) ).NE.ZERO ) THEN
ABSA = ABS( REAL( A( I, I ) ) )
- IF( SCALE.LT.ABSA ) THEN
- SUM = ONE + SUM*( SCALE / ABSA )**2
- SCALE = ABSA
+ IF( SSQ( 1 ).LT.ABSA ) THEN
+ SSQ( 2 ) = ONE + SSQ( 2 )*( SSQ( 1 ) / ABSA )**2
+ SSQ( 1 ) = ABSA
ELSE
- SUM = SUM + ( ABSA / SCALE )**2
+ SSQ( 2 ) = SSQ( 2 ) + ( ABSA / SSQ( 1 ) )**2
END IF
END IF
130 CONTINUE
- VALUE = SCALE*SQRT( SUM )
+ VALUE = SSQ( 1 )*SQRT( SSQ( 2 ) )
END IF
*
CLANHE = VALUE
diff --git a/lapack-netlib/SRC/clanhp.f b/lapack-netlib/SRC/clanhp.f
index c8927d503..e0e23abc7 100644
--- a/lapack-netlib/SRC/clanhp.f
+++ b/lapack-netlib/SRC/clanhp.f
@@ -122,6 +122,7 @@
* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
* December 2016
*
+ IMPLICIT NONE
* .. Scalar Arguments ..
CHARACTER NORM, UPLO
INTEGER N
@@ -139,14 +140,17 @@
* ..
* .. Local Scalars ..
INTEGER I, J, K
- REAL ABSA, SCALE, SUM, VALUE
+ REAL ABSA, SUM, VALUE
+* ..
+* .. Local Arrays ..
+ REAL SSQ( 2 ), COLSSQ( 2 )
* ..
* .. External Functions ..
LOGICAL LSAME, SISNAN
EXTERNAL LSAME, SISNAN
* ..
* .. External Subroutines ..
- EXTERNAL CLASSQ
+ EXTERNAL CLASSQ, SCOMBSSQ
* ..
* .. Intrinsic Functions ..
INTRINSIC ABS, REAL, SQRT
@@ -225,31 +229,48 @@
ELSE IF( ( LSAME( NORM, 'F' ) ) .OR. ( LSAME( NORM, 'E' ) ) ) THEN
*
* Find normF(A).
+* SSQ(1) is scale
+* SSQ(2) is sum-of-squares
+* For better accuracy, sum each column separately.
+*
+ SSQ( 1 ) = ZERO
+ SSQ( 2 ) = ONE
+*
+* Sum off-diagonals
*
- SCALE = ZERO
- SUM = ONE
K = 2
IF( LSAME( UPLO, 'U' ) ) THEN
DO 110 J = 2, N
- CALL CLASSQ( J-1, AP( K ), 1, SCALE, SUM )
+ COLSSQ( 1 ) = ZERO
+ COLSSQ( 2 ) = ONE
+ CALL CLASSQ( J-1, AP( K ), 1, COLSSQ( 1 ), COLSSQ( 2 ) )
+ CALL SCOMBSSQ( SSQ, COLSSQ )
K = K + J
110 CONTINUE
ELSE
DO 120 J = 1, N - 1
- CALL CLASSQ( N-J, AP( K ), 1, SCALE, SUM )
+ COLSSQ( 1 ) = ZERO
+ COLSSQ( 2 ) = ONE
+ CALL CLASSQ( N-J, AP( K ), 1, COLSSQ( 1 ), COLSSQ( 2 ) )
+ CALL SCOMBSSQ( SSQ, COLSSQ )
K = K + N - J + 1
120 CONTINUE
END IF
- SUM = 2*SUM
+ SSQ( 2 ) = 2*SSQ( 2 )
+*
+* Sum diagonal
+*
K = 1
+ COLSSQ( 1 ) = ZERO
+ COLSSQ( 2 ) = ONE
DO 130 I = 1, N
IF( REAL( AP( K ) ).NE.ZERO ) THEN
ABSA = ABS( REAL( AP( K ) ) )
- IF( SCALE.LT.ABSA ) THEN
- SUM = ONE + SUM*( SCALE / ABSA )**2
- SCALE = ABSA
+ IF( COLSSQ( 1 ).LT.ABSA ) THEN
+ COLSSQ( 2 ) = ONE + COLSSQ(2)*( COLSSQ(1) / ABSA )**2
+ COLSSQ( 1 ) = ABSA
ELSE
- SUM = SUM + ( ABSA / SCALE )**2
+ COLSSQ( 2 ) = COLSSQ( 2 ) + ( ABSA / COLSSQ( 1 ) )**2
END IF
END IF
IF( LSAME( UPLO, 'U' ) ) THEN
@@ -258,7 +279,8 @@
K = K + N - I + 1
END IF
130 CONTINUE
- VALUE = SCALE*SQRT( SUM )
+ CALL SCOMBSSQ( SSQ, COLSSQ )
+ VALUE = SSQ( 1 )*SQRT( SSQ( 2 ) )
END IF
*
CLANHP = VALUE
diff --git a/lapack-netlib/SRC/clanhs.f b/lapack-netlib/SRC/clanhs.f
index 35623b73d..661b4f901 100644
--- a/lapack-netlib/SRC/clanhs.f
+++ b/lapack-netlib/SRC/clanhs.f
@@ -114,6 +114,7 @@
* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
* December 2016
*
+ IMPLICIT NONE
* .. Scalar Arguments ..
CHARACTER NORM
INTEGER LDA, N
@@ -131,14 +132,17 @@
* ..
* .. Local Scalars ..
INTEGER I, J
- REAL SCALE, SUM, VALUE
+ REAL SUM, VALUE
+* ..
+* .. Local Arrays ..
+ REAL SSQ( 2 ), COLSSQ( 2 )
* ..
* .. External Functions ..
LOGICAL LSAME, SISNAN
EXTERNAL LSAME, SISNAN
* ..
* .. External Subroutines ..
- EXTERNAL CLASSQ
+ EXTERNAL CLASSQ, SCOMBSSQ
* ..
* .. Intrinsic Functions ..
INTRINSIC ABS, MIN, SQRT
@@ -190,13 +194,20 @@
ELSE IF( ( LSAME( NORM, 'F' ) ) .OR. ( LSAME( NORM, 'E' ) ) ) THEN
*
* Find normF(A).
+* SSQ(1) is scale
+* SSQ(2) is sum-of-squares
+* For better accuracy, sum each column separately.
*
- SCALE = ZERO
- SUM = ONE
+ SSQ( 1 ) = ZERO
+ SSQ( 2 ) = ONE
DO 90 J = 1, N
- CALL CLASSQ( MIN( N, J+1 ), A( 1, J ), 1, SCALE, SUM )
+ COLSSQ( 1 ) = ZERO
+ COLSSQ( 2 ) = ONE
+ CALL CLASSQ( MIN( N, J+1 ), A( 1, J ), 1,
+ $ COLSSQ( 1 ), COLSSQ( 2 ) )
+ CALL SCOMBSSQ( SSQ, COLSSQ )
90 CONTINUE
- VALUE = SCALE*SQRT( SUM )
+ VALUE = SSQ( 1 )*SQRT( SSQ( 2 ) )
END IF
*
CLANHS = VALUE
diff --git a/lapack-netlib/SRC/clansb.f b/lapack-netlib/SRC/clansb.f
index fbc50674c..1085fd880 100644
--- a/lapack-netlib/SRC/clansb.f
+++ b/lapack-netlib/SRC/clansb.f
@@ -135,6 +135,7 @@
* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
* December 2016
*
+ IMPLICIT NONE
* .. Scalar Arguments ..
CHARACTER NORM, UPLO
INTEGER K, LDAB, N
@@ -152,14 +153,17 @@
* ..
* .. Local Scalars ..
INTEGER I, J, L
- REAL ABSA, SCALE, SUM, VALUE
+ REAL ABSA, SUM, VALUE
+* ..
+* .. Local Arrays ..
+ REAL SSQ( 2 ), COLSSQ( 2 )
* ..
* .. External Functions ..
LOGICAL LSAME, SISNAN
EXTERNAL LSAME, SISNAN
* ..
* .. External Subroutines ..
- EXTERNAL CLASSQ
+ EXTERNAL CLASSQ, SCOMBSSQ
* ..
* .. Intrinsic Functions ..
INTRINSIC ABS, MAX, MIN, SQRT
@@ -227,29 +231,47 @@
ELSE IF( ( LSAME( NORM, 'F' ) ) .OR. ( LSAME( NORM, 'E' ) ) ) THEN
*
* Find normF(A).
+* SSQ(1) is scale
+* SSQ(2) is sum-of-squares
+* For better accuracy, sum each column separately.
+*
+ SSQ( 1 ) = ZERO
+ SSQ( 2 ) = ONE
+*
+* Sum off-diagonals
*
- SCALE = ZERO
- SUM = ONE
IF( K.GT.0 ) THEN
IF( LSAME( UPLO, 'U' ) ) THEN
DO 110 J = 2, N
+ COLSSQ( 1 ) = ZERO
+ COLSSQ( 2 ) = ONE
CALL CLASSQ( MIN( J-1, K ), AB( MAX( K+2-J, 1 ), J ),
- $ 1, SCALE, SUM )
+ $ 1, COLSSQ( 1 ), COLSSQ( 2 ) )
+ CALL SCOMBSSQ( SSQ, COLSSQ )
110 CONTINUE
L = K + 1
ELSE
DO 120 J = 1, N - 1
- CALL CLASSQ( MIN( N-J, K ), AB( 2, J ), 1, SCALE,
- $ SUM )
+ COLSSQ( 1 ) = ZERO
+ COLSSQ( 2 ) = ONE
+ CALL CLASSQ( MIN( N-J, K ), AB( 2, J ), 1,
+ $ COLSSQ( 1 ), COLSSQ( 2 ) )
+ CALL SCOMBSSQ( SSQ, COLSSQ )
120 CONTINUE
L = 1
END IF
- SUM = 2*SUM
+ SSQ( 2 ) = 2*SSQ( 2 )
ELSE
L = 1
END IF
- CALL CLASSQ( N, AB( L, 1 ), LDAB, SCALE, SUM )
- VALUE = SCALE*SQRT( SUM )
+*
+* Sum diagonal
+*
+ COLSSQ( 1 ) = ZERO
+ COLSSQ( 2 ) = ONE
+ CALL CLASSQ( N, AB( L, 1 ), LDAB, COLSSQ( 1 ), COLSSQ( 2 ) )
+ CALL SCOMBSSQ( SSQ, COLSSQ )
+ VALUE = SSQ( 1 )*SQRT( SSQ( 2 ) )
END IF
*
CLANSB = VALUE
diff --git a/lapack-netlib/SRC/clansp.f b/lapack-netlib/SRC/clansp.f
index fd64366c6..628dc0a75 100644
--- a/lapack-netlib/SRC/clansp.f
+++ b/lapack-netlib/SRC/clansp.f
@@ -120,6 +120,7 @@
* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
* December 2016
*
+ IMPLICIT NONE
* .. Scalar Arguments ..
CHARACTER NORM, UPLO
INTEGER N
@@ -137,14 +138,17 @@
* ..
* .. Local Scalars ..
INTEGER I, J, K
- REAL ABSA, SCALE, SUM, VALUE
+ REAL ABSA, SUM, VALUE
+* ..
+* .. Local Arrays ..
+ REAL SSQ( 2 ), COLSSQ( 2 )
* ..
* .. External Functions ..
LOGICAL LSAME, SISNAN
EXTERNAL LSAME, SISNAN
* ..
* .. External Subroutines ..
- EXTERNAL CLASSQ
+ EXTERNAL CLASSQ, SCOMBSSQ
* ..
* .. Intrinsic Functions ..
INTRINSIC ABS, AIMAG, REAL, SQRT
@@ -219,40 +223,57 @@
ELSE IF( ( LSAME( NORM, 'F' ) ) .OR. ( LSAME( NORM, 'E' ) ) ) THEN
*
* Find normF(A).
+* SSQ(1) is scale
+* SSQ(2) is sum-of-squares
+* For better accuracy, sum each column separately.
+*
+ SSQ( 1 ) = ZERO
+ SSQ( 2 ) = ONE
+*
+* Sum off-diagonals
*
- SCALE = ZERO
- SUM = ONE
K = 2
IF( LSAME( UPLO, 'U' ) ) THEN
DO 110 J = 2, N
- CALL CLASSQ( J-1, AP( K ), 1, SCALE, SUM )
+ COLSSQ( 1 ) = ZERO
+ COLSSQ( 2 ) = ONE
+ CALL CLASSQ( J-1, AP( K ), 1, COLSSQ( 1 ), COLSSQ( 2 ) )
+ CALL SCOMBSSQ( SSQ, COLSSQ )
K = K + J
110 CONTINUE
ELSE
DO 120 J = 1, N - 1
- CALL CLASSQ( N-J, AP( K ), 1, SCALE, SUM )
+ COLSSQ( 1 ) = ZERO
+ COLSSQ( 2 ) = ONE
+ CALL CLASSQ( N-J, AP( K ), 1, COLSSQ( 1 ), COLSSQ( 2 ) )
+ CALL SCOMBSSQ( SSQ, COLSSQ )
K = K + N - J + 1
120 CONTINUE
END IF
- SUM = 2*SUM
+ SSQ( 2 ) = 2*SSQ( 2 )
+*
+* Sum diagonal
+*
K = 1
+ COLSSQ( 1 ) = ZERO
+ COLSSQ( 2 ) = ONE
DO 130 I = 1, N
IF( REAL( AP( K ) ).NE.ZERO ) THEN
ABSA = ABS( REAL( AP( K ) ) )
- IF( SCALE.LT.ABSA ) THEN
- SUM = ONE + SUM*( SCALE / ABSA )**2
- SCALE = ABSA
+ IF( COLSSQ( 1 ).LT.ABSA ) THEN
+ COLSSQ( 2 ) = ONE + COLSSQ(2)*( COLSSQ(1) / ABSA )**2
+ COLSSQ( 1 ) = ABSA
ELSE
- SUM = SUM + ( ABSA / SCALE )**2
+ COLSSQ( 2 ) = COLSSQ( 2 ) + ( ABSA / COLSSQ( 1 ) )**2
END IF
END IF
IF( AIMAG( AP( K ) ).NE.ZERO ) THEN
ABSA = ABS( AIMAG( AP( K ) ) )
- IF( SCALE.LT.ABSA ) THEN
- SUM = ONE + SUM*( SCALE / ABSA )**2
- SCALE = ABSA
+ IF( COLSSQ( 1 ).LT.ABSA ) THEN
+ COLSSQ( 2 ) = ONE + COLSSQ(2)*( COLSSQ(1) / ABSA )**2
+ COLSSQ( 1 ) = ABSA
ELSE
- SUM = SUM + ( ABSA / SCALE )**2
+ COLSSQ( 2 ) = COLSSQ( 2 ) + ( ABSA / COLSSQ( 1 ) )**2
END IF
END IF
IF( LSAME( UPLO, 'U' ) ) THEN
@@ -261,7 +282,8 @@
K = K + N - I + 1
END IF
130 CONTINUE
- VALUE = SCALE*SQRT( SUM )
+ CALL SCOMBSSQ( SSQ, COLSSQ )
+ VALUE = SSQ( 1 )*SQRT( SSQ( 2 ) )
END IF
*
CLANSP = VALUE
diff --git a/lapack-netlib/SRC/clansy.f b/lapack-netlib/SRC/clansy.f
index 3aa787410..537fb7ba9 100644
--- a/lapack-netlib/SRC/clansy.f
+++ b/lapack-netlib/SRC/clansy.f
@@ -128,6 +128,7 @@
* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
* December 2016
*
+ IMPLICIT NONE
* .. Scalar Arguments ..
CHARACTER NORM, UPLO
INTEGER LDA, N
@@ -145,14 +146,17 @@
* ..
* .. Local Scalars ..
INTEGER I, J
- REAL ABSA, SCALE, SUM, VALUE
+ REAL ABSA, SUM, VALUE
+* ..
+* .. Local Arrays ..
+ REAL SSQ( 2 ), COLSSQ( 2 )
* ..
* .. External Functions ..
LOGICAL LSAME, SISNAN
EXTERNAL LSAME, SISNAN
* ..
* .. External Subroutines ..
- EXTERNAL CLASSQ
+ EXTERNAL CLASSQ, SCOMBSSQ
* ..
* .. Intrinsic Functions ..
INTRINSIC ABS, SQRT
@@ -218,21 +222,39 @@
ELSE IF( ( LSAME( NORM, 'F' ) ) .OR. ( LSAME( NORM, 'E' ) ) ) THEN
*
* Find normF(A).
+* SSQ(1) is scale
+* SSQ(2) is sum-of-squares
+* For better accuracy, sum each column separately.
+*
+ SSQ( 1 ) = ZERO
+ SSQ( 2 ) = ONE
+*
+* Sum off-diagonals
*
- SCALE = ZERO
- SUM = ONE
IF( LSAME( UPLO, 'U' ) ) THEN
DO 110 J = 2, N
- CALL CLASSQ( J-1, A( 1, J ), 1, SCALE, SUM )
+ COLSSQ( 1 ) = ZERO
+ COLSSQ( 2 ) = ONE
+ CALL CLASSQ( J-1, A( 1, J ), 1, COLSSQ(1), COLSSQ(2) )
+ CALL SCOMBSSQ( SSQ, COLSSQ )
110 CONTINUE
ELSE
DO 120 J = 1, N - 1
- CALL CLASSQ( N-J, A( J+1, J ), 1, SCALE, SUM )
+ COLSSQ( 1 ) = ZERO
+ COLSSQ( 2 ) = ONE
+ CALL CLASSQ( N-J, A( J+1, J ), 1, COLSSQ(1), COLSSQ(2) )
+ CALL SCOMBSSQ( SSQ, COLSSQ )
120 CONTINUE
END IF
- SUM = 2*SUM
- CALL CLASSQ( N, A, LDA+1, SCALE, SUM )
- VALUE = SCALE*SQRT( SUM )
+ SSQ( 2 ) = 2*SSQ( 2 )
+*
+* Sum diagonal
+*
+ COLSSQ( 1 ) = ZERO
+ COLSSQ( 2 ) = ONE
+ CALL CLASSQ( N, A, LDA+1, COLSSQ( 1 ), COLSSQ( 2 ) )
+ CALL SCOMBSSQ( SSQ, COLSSQ )
+ VALUE = SSQ( 1 )*SQRT( SSQ( 2 ) )
END IF
*
CLANSY = VALUE
diff --git a/lapack-netlib/SRC/clantb.f b/lapack-netlib/SRC/clantb.f
index 4b4361c79..8066d0ef6 100644
--- a/lapack-netlib/SRC/clantb.f
+++ b/lapack-netlib/SRC/clantb.f
@@ -146,6 +146,7 @@
* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
* December 2016
*
+ IMPLICIT NONE
* .. Scalar Arguments ..
CHARACTER DIAG, NORM, UPLO
INTEGER K, LDAB, N
@@ -164,14 +165,17 @@
* .. Local Scalars ..
LOGICAL UDIAG
INTEGER I, J, L
- REAL SCALE, SUM, VALUE
+ REAL SUM, VALUE
+* ..
+* .. Local Arrays ..
+ REAL SSQ( 2 ), COLSSQ( 2 )
* ..
* .. External Functions ..
LOGICAL LSAME, SISNAN
EXTERNAL LSAME, SISNAN
* ..
* .. External Subroutines ..
- EXTERNAL CLASSQ
+ EXTERNAL CLASSQ, SCOMBSSQ
* ..
* .. Intrinsic Functions ..
INTRINSIC ABS, MAX, MIN, SQRT
@@ -313,46 +317,61 @@
ELSE IF( ( LSAME( NORM, 'F' ) ) .OR. ( LSAME( NORM, 'E' ) ) ) THEN
*
* Find normF(A).
+* SSQ(1) is scale
+* SSQ(2) is sum-of-squares
+* For better accuracy, sum each column separately.
*
IF( LSAME( UPLO, 'U' ) ) THEN
IF( LSAME( DIAG, 'U' ) ) THEN
- SCALE = ONE
- SUM = N
+ SSQ( 1 ) = ONE
+ SSQ( 2 ) = N
IF( K.GT.0 ) THEN
DO 280 J = 2, N
+ COLSSQ( 1 ) = ZERO
+ COLSSQ( 2 ) = ONE
CALL CLASSQ( MIN( J-1, K ),
- $ AB( MAX( K+2-J, 1 ), J ), 1, SCALE,
- $ SUM )
+ $ AB( MAX( K+2-J, 1 ), J ), 1,
+ $ COLSSQ( 1 ), COLSSQ( 2 ) )
+ CALL SCOMBSSQ( SSQ, COLSSQ )
280 CONTINUE
END IF
ELSE
- SCALE = ZERO
- SUM = ONE
+ SSQ( 1 ) = ZERO
+ SSQ( 2 ) = ONE
DO 290 J = 1, N
+ COLSSQ( 1 ) = ZERO
+ COLSSQ( 2 ) = ONE
CALL CLASSQ( MIN( J, K+1 ), AB( MAX( K+2-J, 1 ), J ),
- $ 1, SCALE, SUM )
+ $ 1, COLSSQ( 1 ), COLSSQ( 2 ) )
+ CALL SCOMBSSQ( SSQ, COLSSQ )
290 CONTINUE
END IF
ELSE
IF( LSAME( DIAG, 'U' ) ) THEN
- SCALE = ONE
- SUM = N
+ SSQ( 1 ) = ONE
+ SSQ( 2 ) = N
IF( K.GT.0 ) THEN
DO 300 J = 1, N - 1
- CALL CLASSQ( MIN( N-J, K ), AB( 2, J ), 1, SCALE,
- $ SUM )
+ COLSSQ( 1 ) = ZERO
+ COLSSQ( 2 ) = ONE
+ CALL CLASSQ( MIN( N-J, K ), AB( 2, J ), 1,
+ $ COLSSQ( 1 ), COLSSQ( 2 ) )
+ CALL SCOMBSSQ( SSQ, COLSSQ )
300 CONTINUE
END IF
ELSE
- SCALE = ZERO
- SUM = ONE
+ SSQ( 1 ) = ZERO
+ SSQ( 2 ) = ONE
DO 310 J = 1, N
- CALL CLASSQ( MIN( N-J+1, K+1 ), AB( 1, J ), 1, SCALE,
- $ SUM )
+ COLSSQ( 1 ) = ZERO
+ COLSSQ( 2 ) = ONE
+ CALL CLASSQ( MIN( N-J+1, K+1 ), AB( 1, J ), 1,
+ $ COLSSQ( 1 ), COLSSQ( 2 ) )
+ CALL SCOMBSSQ( SSQ, COLSSQ )
310 CONTINUE
END IF
END IF
- VALUE = SCALE*SQRT( SUM )
+ VALUE = SSQ( 1 )*SQRT( SSQ( 2 ) )
END IF
*
CLANTB = VALUE
diff --git a/lapack-netlib/SRC/clantp.f b/lapack-netlib/SRC/clantp.f
index 148ac5436..b0c48eb46 100644
--- a/lapack-netlib/SRC/clantp.f
+++ b/lapack-netlib/SRC/clantp.f
@@ -130,6 +130,7 @@
* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
* December 2016
*
+ IMPLICIT NONE
* .. Scalar Arguments ..
CHARACTER DIAG, NORM, UPLO
INTEGER N
@@ -148,14 +149,17 @@
* .. Local Scalars ..
LOGICAL UDIAG
INTEGER I, J, K
- REAL SCALE, SUM, VALUE
+ REAL SUM, VALUE
+* ..
+* .. Local Arrays ..
+ REAL SSQ( 2 ), COLSSQ( 2 )
* ..
* .. External Functions ..
LOGICAL LSAME, SISNAN
EXTERNAL LSAME, SISNAN
* ..
* .. External Subroutines ..
- EXTERNAL CLASSQ
+ EXTERNAL CLASSQ, SCOMBSSQ
* ..
* .. Intrinsic Functions ..
INTRINSIC ABS, SQRT
@@ -308,45 +312,64 @@
ELSE IF( ( LSAME( NORM, 'F' ) ) .OR. ( LSAME( NORM, 'E' ) ) ) THEN
*
* Find normF(A).
+* SSQ(1) is scale
+* SSQ(2) is sum-of-squares
+* For better accuracy, sum each column separately.
*
IF( LSAME( UPLO, 'U' ) ) THEN
IF( LSAME( DIAG, 'U' ) ) THEN
- SCALE = ONE
- SUM = N
+ SSQ( 1 ) = ONE
+ SSQ( 2 ) = N
K = 2
DO 280 J = 2, N
- CALL CLASSQ( J-1, AP( K ), 1, SCALE, SUM )
+ COLSSQ( 1 ) = ZERO
+ COLSSQ( 2 ) = ONE
+ CALL CLASSQ( J-1, AP( K ), 1,
+ $ COLSSQ( 1 ), COLSSQ( 2 ) )
+ CALL SCOMBSSQ( SSQ, COLSSQ )
K = K + J
280 CONTINUE
ELSE
- SCALE = ZERO
- SUM = ONE
+ SSQ( 1 ) = ZERO
+ SSQ( 2 ) = ONE
K = 1
DO 290 J = 1, N
- CALL CLASSQ( J, AP( K ), 1, SCALE, SUM )
+ COLSSQ( 1 ) = ZERO
+ COLSSQ( 2 ) = ONE
+ CALL CLASSQ( J, AP( K ), 1,
+ $ COLSSQ( 1 ), COLSSQ( 2 ) )
+ CALL SCOMBSSQ( SSQ, COLSSQ )
K = K + J
290 CONTINUE
END IF
ELSE
IF( LSAME( DIAG, 'U' ) ) THEN
- SCALE = ONE
- SUM = N
+ SSQ( 1 ) = ONE
+ SSQ( 2 ) = N
K = 2
DO 300 J = 1, N - 1
- CALL CLASSQ( N-J, AP( K ), 1, SCALE, SUM )
+ COLSSQ( 1 ) = ZERO
+ COLSSQ( 2 ) = ONE
+ CALL CLASSQ( N-J, AP( K ), 1,
+ $ COLSSQ( 1 ), COLSSQ( 2 ) )
+ CALL SCOMBSSQ( SSQ, COLSSQ )
K = K + N - J + 1
300 CONTINUE
ELSE
- SCALE = ZERO
- SUM = ONE
+ SSQ( 1 ) = ZERO
+ SSQ( 2 ) = ONE
K = 1
DO 310 J = 1, N
- CALL CLASSQ( N-J+1, AP( K ), 1, SCALE, SUM )
+ COLSSQ( 1 ) = ZERO
+ COLSSQ( 2 ) = ONE
+ CALL CLASSQ( N-J+1, AP( K ), 1,
+ $ COLSSQ( 1 ), COLSSQ( 2 ) )
+ CALL SCOMBSSQ( SSQ, COLSSQ )
K = K + N - J + 1
310 CONTINUE
END IF
END IF
- VALUE = SCALE*SQRT( SUM )
+ VALUE = SSQ( 1 )*SQRT( SSQ( 2 ) )
END IF
*
CLANTP = VALUE
diff --git a/lapack-netlib/SRC/clantr.f b/lapack-netlib/SRC/clantr.f
index 4e1843d3d..3b361cc97 100644
--- a/lapack-netlib/SRC/clantr.f
+++ b/lapack-netlib/SRC/clantr.f
@@ -147,6 +147,7 @@
* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
* December 2016
*
+ IMPLICIT NONE
* .. Scalar Arguments ..
CHARACTER DIAG, NORM, UPLO
INTEGER LDA, M, N
@@ -165,14 +166,17 @@
* .. Local Scalars ..
LOGICAL UDIAG
INTEGER I, J
- REAL SCALE, SUM, VALUE
+ REAL SUM, VALUE
+* ..
+* .. Local Arrays ..
+ REAL SSQ( 2 ), COLSSQ( 2 )
* ..
* .. External Functions ..
LOGICAL LSAME, SISNAN
EXTERNAL LSAME, SISNAN
* ..
* .. External Subroutines ..
- EXTERNAL CLASSQ
+ EXTERNAL CLASSQ, SCOMBSSQ
* ..
* .. Intrinsic Functions ..
INTRINSIC ABS, MIN, SQRT
@@ -283,7 +287,7 @@
END IF
ELSE
IF( LSAME( DIAG, 'U' ) ) THEN
- DO 210 I = 1, N
+ DO 210 I = 1, MIN( M, N )
WORK( I ) = ONE
210 CONTINUE
DO 220 I = N + 1, M
@@ -313,38 +317,56 @@
ELSE IF( ( LSAME( NORM, 'F' ) ) .OR. ( LSAME( NORM, 'E' ) ) ) THEN
*
* Find normF(A).
+* SSQ(1) is scale
+* SSQ(2) is sum-of-squares
+* For better accuracy, sum each column separately.
*
IF( LSAME( UPLO, 'U' ) ) THEN
IF( LSAME( DIAG, 'U' ) ) THEN
- SCALE = ONE
- SUM = MIN( M, N )
+ SSQ( 1 ) = ONE
+ SSQ( 2 ) = MIN( M, N )
DO 290 J = 2, N
- CALL CLASSQ( MIN( M, J-1 ), A( 1, J ), 1, SCALE, SUM )
+ COLSSQ( 1 ) = ZERO
+ COLSSQ( 2 ) = ONE
+ CALL CLASSQ( MIN( M, J-1 ), A( 1, J ), 1,
+ $ COLSSQ( 1 ), COLSSQ( 2 ) )
+ CALL SCOMBSSQ( SSQ, COLSSQ )
290 CONTINUE
ELSE
- SCALE = ZERO
- SUM = ONE
+ SSQ( 1 ) = ZERO
+ SSQ( 2 ) = ONE
DO 300 J = 1, N
- CALL CLASSQ( MIN( M, J ), A( 1, J ), 1, SCALE, SUM )
+ COLSSQ( 1 ) = ZERO
+ COLSSQ( 2 ) = ONE
+ CALL CLASSQ( MIN( M, J ), A( 1, J ), 1,
+ $ COLSSQ( 1 ), COLSSQ( 2 ) )
+ CALL SCOMBSSQ( SSQ, COLSSQ )
300 CONTINUE
END IF
ELSE
IF( LSAME( DIAG, 'U' ) ) THEN
- SCALE = ONE
- SUM = MIN( M, N )
+ SSQ( 1 ) = ONE
+ SSQ( 2 ) = MIN( M, N )
DO 310 J = 1, N
- CALL CLASSQ( M-J, A( MIN( M, J+1 ), J ), 1, SCALE,
- $ SUM )
+ COLSSQ( 1 ) = ZERO
+ COLSSQ( 2 ) = ONE
+ CALL CLASSQ( M-J, A( MIN( M, J+1 ), J ), 1,
+ $ COLSSQ( 1 ), COLSSQ( 2 ) )
+ CALL SCOMBSSQ( SSQ, COLSSQ )
310 CONTINUE
ELSE
- SCALE = ZERO
- SUM = ONE
+ SSQ( 1 ) = ZERO
+ SSQ( 2 ) = ONE
DO 320 J = 1, N
- CALL CLASSQ( M-J+1, A( J, J ), 1, SCALE, SUM )
+ COLSSQ( 1 ) = ZERO
+ COLSSQ( 2 ) = ONE
+ CALL CLASSQ( M-J+1, A( J, J ), 1,
+ $ COLSSQ( 1 ), COLSSQ( 2 ) )
+ CALL SCOMBSSQ( SSQ, COLSSQ )
320 CONTINUE
END IF
END IF
- VALUE = SCALE*SQRT( SUM )
+ VALUE = SSQ( 1 )*SQRT( SSQ( 2 ) )
END IF
*
CLANTR = VALUE
diff --git a/lapack-netlib/SRC/claqps.f b/lapack-netlib/SRC/claqps.f
index f47e852a0..d0b7efcd5 100644
--- a/lapack-netlib/SRC/claqps.f
+++ b/lapack-netlib/SRC/claqps.f
@@ -127,7 +127,7 @@
*> \param[in,out] AUXV
*> \verbatim
*> AUXV is COMPLEX array, dimension (NB)
-*> Auxiliar vector.
+*> Auxiliary vector.
*> \endverbatim
*>
*> \param[in,out] F
diff --git a/lapack-netlib/SRC/claqr0.f b/lapack-netlib/SRC/claqr0.f
index b61c9f1e9..2f0ea20db 100644
--- a/lapack-netlib/SRC/claqr0.f
+++ b/lapack-netlib/SRC/claqr0.f
@@ -66,7 +66,7 @@
*> \param[in] N
*> \verbatim
*> N is INTEGER
-*> The order of the matrix H. N .GE. 0.
+*> The order of the matrix H. N >= 0.
*> \endverbatim
*>
*> \param[in] ILO
@@ -78,12 +78,12 @@
*> \verbatim
*> IHI is INTEGER
*> It is assumed that H is already upper triangular in rows
-*> and columns 1:ILO-1 and IHI+1:N and, if ILO.GT.1,
+*> and columns 1:ILO-1 and IHI+1:N and, if ILO > 1,
*> H(ILO,ILO-1) is zero. ILO and IHI are normally set by a
*> previous call to CGEBAL, and then passed to CGEHRD when the
*> matrix output by CGEBAL is reduced to Hessenberg form.
*> Otherwise, ILO and IHI should be set to 1 and N,
-*> respectively. If N.GT.0, then 1.LE.ILO.LE.IHI.LE.N.
+*> respectively. If N > 0, then 1 <= ILO <= IHI <= N.
*> If N = 0, then ILO = 1 and IHI = 0.
*> \endverbatim
*>
@@ -95,17 +95,17 @@
*> contains the upper triangular matrix T from the Schur
*> decomposition (the Schur form). If INFO = 0 and WANT is
*> .FALSE., then the contents of H are unspecified on exit.
-*> (The output value of H when INFO.GT.0 is given under the
+*> (The output value of H when INFO > 0 is given under the
*> description of INFO below.)
*>
-*> This subroutine may explicitly set H(i,j) = 0 for i.GT.j and
+*> This subroutine may explicitly set H(i,j) = 0 for i > j and
*> j = 1, 2, ... ILO-1 or j = IHI+1, IHI+2, ... N.
*> \endverbatim
*>
*> \param[in] LDH
*> \verbatim
*> LDH is INTEGER
-*> The leading dimension of the array H. LDH .GE. max(1,N).
+*> The leading dimension of the array H. LDH >= max(1,N).
*> \endverbatim
*>
*> \param[out] W
@@ -127,7 +127,7 @@
*> IHIZ is INTEGER
*> Specify the rows of Z to which transformations must be
*> applied if WANTZ is .TRUE..
-*> 1 .LE. ILOZ .LE. ILO; IHI .LE. IHIZ .LE. N.
+*> 1 <= ILOZ <= ILO; IHI <= IHIZ <= N.
*> \endverbatim
*>
*> \param[in,out] Z
@@ -137,7 +137,7 @@
*> If WANTZ is .TRUE., then Z(ILO:IHI,ILOZ:IHIZ) is
*> replaced by Z(ILO:IHI,ILOZ:IHIZ)*U where U is the
*> orthogonal Schur factor of H(ILO:IHI,ILO:IHI).
-*> (The output value of Z when INFO.GT.0 is given under
+*> (The output value of Z when INFO > 0 is given under
*> the description of INFO below.)
*> \endverbatim
*>
@@ -145,7 +145,7 @@
*> \verbatim
*> LDZ is INTEGER
*> The leading dimension of the array Z. if WANTZ is .TRUE.
-*> then LDZ.GE.MAX(1,IHIZ). Otherwize, LDZ.GE.1.
+*> then LDZ >= MAX(1,IHIZ). Otherwise, LDZ >= 1.
*> \endverbatim
*>
*> \param[out] WORK
@@ -158,7 +158,7 @@
*> \param[in] LWORK
*> \verbatim
*> LWORK is INTEGER
-*> The dimension of the array WORK. LWORK .GE. max(1,N)
+*> The dimension of the array WORK. LWORK >= max(1,N)
*> is sufficient, but LWORK typically as large as 6*N may
*> be required for optimal performance. A workspace query
*> to determine the optimal workspace size is recommended.
@@ -174,19 +174,19 @@
*> \param[out] INFO
*> \verbatim
*> INFO is INTEGER
-*> = 0: successful exit
-*> .GT. 0: if INFO = i, CLAQR0 failed to compute all of
+*> = 0: successful exit
+*> > 0: if INFO = i, CLAQR0 failed to compute all of
*> the eigenvalues. Elements 1:ilo-1 and i+1:n of WR
*> and WI contain those eigenvalues which have been
*> successfully computed. (Failures are rare.)
*>
-*> If INFO .GT. 0 and WANT is .FALSE., then on exit,
+*> If INFO > 0 and WANT is .FALSE., then on exit,
*> the remaining unconverged eigenvalues are the eigen-
*> values of the upper Hessenberg matrix rows and
*> columns ILO through INFO of the final, output
*> value of H.
*>
-*> If INFO .GT. 0 and WANTT is .TRUE., then on exit
+*> If INFO > 0 and WANTT is .TRUE., then on exit
*>
*> (*) (initial value of H)*U = U*(final value of H)
*>
@@ -194,7 +194,7 @@
*> value of H is upper Hessenberg and triangular in
*> rows and columns INFO+1 through IHI.
*>
-*> If INFO .GT. 0 and WANTZ is .TRUE., then on exit
+*> If INFO > 0 and WANTZ is .TRUE., then on exit
*>
*> (final value of Z(ILO:IHI,ILOZ:IHIZ)
*> = (initial value of Z(ILO:IHI,ILOZ:IHIZ)*U
@@ -202,7 +202,7 @@
*> where U is the unitary matrix in (*) (regard-
*> less of the value of WANTT.)
*>
-*> If INFO .GT. 0 and WANTZ is .FALSE., then Z is not
+*> If INFO > 0 and WANTZ is .FALSE., then Z is not
*> accessed.
*> \endverbatim
*
@@ -639,7 +639,7 @@
END IF
END IF
*
-* ==== Use up to NS of the the smallest magnatiude
+* ==== Use up to NS of the the smallest magnitude
* . shifts. If there aren't NS shifts available,
* . then use them all, possibly dropping one to
* . make the number of shifts even. ====
diff --git a/lapack-netlib/SRC/claqr1.f b/lapack-netlib/SRC/claqr1.f
index 977947196..87d53871a 100644
--- a/lapack-netlib/SRC/claqr1.f
+++ b/lapack-netlib/SRC/claqr1.f
@@ -64,7 +64,7 @@
*> \verbatim
*> LDH is INTEGER
*> The leading dimension of H as declared in
-*> the calling procedure. LDH.GE.N
+*> the calling procedure. LDH >= N
*> \endverbatim
*>
*> \param[in] S1
diff --git a/lapack-netlib/SRC/claqr2.f b/lapack-netlib/SRC/claqr2.f
index 03e9760cf..fc282b2d6 100644
--- a/lapack-netlib/SRC/claqr2.f
+++ b/lapack-netlib/SRC/claqr2.f
@@ -102,7 +102,7 @@
*> \param[in] NW
*> \verbatim
*> NW is INTEGER
-*> Deflation window size. 1 .LE. NW .LE. (KBOT-KTOP+1).
+*> Deflation window size. 1 <= NW <= (KBOT-KTOP+1).
*> \endverbatim
*>
*> \param[in,out] H
@@ -120,7 +120,7 @@
*> \verbatim
*> LDH is INTEGER
*> Leading dimension of H just as declared in the calling
-*> subroutine. N .LE. LDH
+*> subroutine. N <= LDH
*> \endverbatim
*>
*> \param[in] ILOZ
@@ -132,7 +132,7 @@
*> \verbatim
*> IHIZ is INTEGER
*> Specify the rows of Z to which transformations must be
-*> applied if WANTZ is .TRUE.. 1 .LE. ILOZ .LE. IHIZ .LE. N.
+*> applied if WANTZ is .TRUE.. 1 <= ILOZ <= IHIZ <= N.
*> \endverbatim
*>
*> \param[in,out] Z
@@ -148,7 +148,7 @@
*> \verbatim
*> LDZ is INTEGER
*> The leading dimension of Z just as declared in the
-*> calling subroutine. 1 .LE. LDZ.
+*> calling subroutine. 1 <= LDZ.
*> \endverbatim
*>
*> \param[out] NS
@@ -185,13 +185,13 @@
*> \verbatim
*> LDV is INTEGER
*> The leading dimension of V just as declared in the
-*> calling subroutine. NW .LE. LDV
+*> calling subroutine. NW <= LDV
*> \endverbatim
*>
*> \param[in] NH
*> \verbatim
*> NH is INTEGER
-*> The number of columns of T. NH.GE.NW.
+*> The number of columns of T. NH >= NW.
*> \endverbatim
*>
*> \param[out] T
@@ -203,14 +203,14 @@
*> \verbatim
*> LDT is INTEGER
*> The leading dimension of T just as declared in the
-*> calling subroutine. NW .LE. LDT
+*> calling subroutine. NW <= LDT
*> \endverbatim
*>
*> \param[in] NV
*> \verbatim
*> NV is INTEGER
*> The number of rows of work array WV available for
-*> workspace. NV.GE.NW.
+*> workspace. NV >= NW.
*> \endverbatim
*>
*> \param[out] WV
@@ -222,7 +222,7 @@
*> \verbatim
*> LDWV is INTEGER
*> The leading dimension of W just as declared in the
-*> calling subroutine. NW .LE. LDV
+*> calling subroutine. NW <= LDV
*> \endverbatim
*>
*> \param[out] WORK
diff --git a/lapack-netlib/SRC/claqr3.f b/lapack-netlib/SRC/claqr3.f
index 660a58376..84d57d4d6 100644
--- a/lapack-netlib/SRC/claqr3.f
+++ b/lapack-netlib/SRC/claqr3.f
@@ -99,7 +99,7 @@
*> \param[in] NW
*> \verbatim
*> NW is INTEGER
-*> Deflation window size. 1 .LE. NW .LE. (KBOT-KTOP+1).
+*> Deflation window size. 1 <= NW <= (KBOT-KTOP+1).
*> \endverbatim
*>
*> \param[in,out] H
@@ -117,7 +117,7 @@
*> \verbatim
*> LDH is INTEGER
*> Leading dimension of H just as declared in the calling
-*> subroutine. N .LE. LDH
+*> subroutine. N <= LDH
*> \endverbatim
*>
*> \param[in] ILOZ
@@ -129,7 +129,7 @@
*> \verbatim
*> IHIZ is INTEGER
*> Specify the rows of Z to which transformations must be
-*> applied if WANTZ is .TRUE.. 1 .LE. ILOZ .LE. IHIZ .LE. N.
+*> applied if WANTZ is .TRUE.. 1 <= ILOZ <= IHIZ <= N.
*> \endverbatim
*>
*> \param[in,out] Z
@@ -145,7 +145,7 @@
*> \verbatim
*> LDZ is INTEGER
*> The leading dimension of Z just as declared in the
-*> calling subroutine. 1 .LE. LDZ.
+*> calling subroutine. 1 <= LDZ.
*> \endverbatim
*>
*> \param[out] NS
@@ -182,13 +182,13 @@
*> \verbatim
*> LDV is INTEGER
*> The leading dimension of V just as declared in the
-*> calling subroutine. NW .LE. LDV
+*> calling subroutine. NW <= LDV
*> \endverbatim
*>
*> \param[in] NH
*> \verbatim
*> NH is INTEGER
-*> The number of columns of T. NH.GE.NW.
+*> The number of columns of T. NH >= NW.
*> \endverbatim
*>
*> \param[out] T
@@ -200,14 +200,14 @@
*> \verbatim
*> LDT is INTEGER
*> The leading dimension of T just as declared in the
-*> calling subroutine. NW .LE. LDT
+*> calling subroutine. NW <= LDT
*> \endverbatim
*>
*> \param[in] NV
*> \verbatim
*> NV is INTEGER
*> The number of rows of work array WV available for
-*> workspace. NV.GE.NW.
+*> workspace. NV >= NW.
*> \endverbatim
*>
*> \param[out] WV
@@ -219,7 +219,7 @@
*> \verbatim
*> LDWV is INTEGER
*> The leading dimension of W just as declared in the
-*> calling subroutine. NW .LE. LDV
+*> calling subroutine. NW <= LDV
*> \endverbatim
*>
*> \param[out] WORK
diff --git a/lapack-netlib/SRC/claqr4.f b/lapack-netlib/SRC/claqr4.f
index 647fa6774..fba286df7 100644
--- a/lapack-netlib/SRC/claqr4.f
+++ b/lapack-netlib/SRC/claqr4.f
@@ -74,7 +74,7 @@
*> \param[in] N
*> \verbatim
*> N is INTEGER
-*> The order of the matrix H. N .GE. 0.
+*> The order of the matrix H. N >= 0.
*> \endverbatim
*>
*> \param[in] ILO
@@ -86,12 +86,12 @@
*> \verbatim
*> IHI is INTEGER
*> It is assumed that H is already upper triangular in rows
-*> and columns 1:ILO-1 and IHI+1:N and, if ILO.GT.1,
+*> and columns 1:ILO-1 and IHI+1:N and, if ILO > 1,
*> H(ILO,ILO-1) is zero. ILO and IHI are normally set by a
*> previous call to CGEBAL, and then passed to CGEHRD when the
*> matrix output by CGEBAL is reduced to Hessenberg form.
*> Otherwise, ILO and IHI should be set to 1 and N,
-*> respectively. If N.GT.0, then 1.LE.ILO.LE.IHI.LE.N.
+*> respectively. If N > 0, then 1 <= ILO <= IHI <= N.
*> If N = 0, then ILO = 1 and IHI = 0.
*> \endverbatim
*>
@@ -103,17 +103,17 @@
*> contains the upper triangular matrix T from the Schur
*> decomposition (the Schur form). If INFO = 0 and WANT is
*> .FALSE., then the contents of H are unspecified on exit.
-*> (The output value of H when INFO.GT.0 is given under the
+*> (The output value of H when INFO > 0 is given under the
*> description of INFO below.)
*>
-*> This subroutine may explicitly set H(i,j) = 0 for i.GT.j and
+*> This subroutine may explicitly set H(i,j) = 0 for i > j and
*> j = 1, 2, ... ILO-1 or j = IHI+1, IHI+2, ... N.
*> \endverbatim
*>
*> \param[in] LDH
*> \verbatim
*> LDH is INTEGER
-*> The leading dimension of the array H. LDH .GE. max(1,N).
+*> The leading dimension of the array H. LDH >= max(1,N).
*> \endverbatim
*>
*> \param[out] W
@@ -135,7 +135,7 @@
*> IHIZ is INTEGER
*> Specify the rows of Z to which transformations must be
*> applied if WANTZ is .TRUE..
-*> 1 .LE. ILOZ .LE. ILO; IHI .LE. IHIZ .LE. N.
+*> 1 <= ILOZ <= ILO; IHI <= IHIZ <= N.
*> \endverbatim
*>
*> \param[in,out] Z
@@ -145,7 +145,7 @@
*> If WANTZ is .TRUE., then Z(ILO:IHI,ILOZ:IHIZ) is
*> replaced by Z(ILO:IHI,ILOZ:IHIZ)*U where U is the
*> orthogonal Schur factor of H(ILO:IHI,ILO:IHI).
-*> (The output value of Z when INFO.GT.0 is given under
+*> (The output value of Z when INFO > 0 is given under
*> the description of INFO below.)
*> \endverbatim
*>
@@ -153,7 +153,7 @@
*> \verbatim
*> LDZ is INTEGER
*> The leading dimension of the array Z. if WANTZ is .TRUE.
-*> then LDZ.GE.MAX(1,IHIZ). Otherwize, LDZ.GE.1.
+*> then LDZ >= MAX(1,IHIZ). Otherwise, LDZ >= 1.
*> \endverbatim
*>
*> \param[out] WORK
@@ -166,7 +166,7 @@
*> \param[in] LWORK
*> \verbatim
*> LWORK is INTEGER
-*> The dimension of the array WORK. LWORK .GE. max(1,N)
+*> The dimension of the array WORK. LWORK >= max(1,N)
*> is sufficient, but LWORK typically as large as 6*N may
*> be required for optimal performance. A workspace query
*> to determine the optimal workspace size is recommended.
@@ -182,19 +182,19 @@
*> \param[out] INFO
*> \verbatim
*> INFO is INTEGER
-*> = 0: successful exit
-*> .GT. 0: if INFO = i, CLAQR4 failed to compute all of
+*> = 0: successful exit
+*> > 0: if INFO = i, CLAQR4 failed to compute all of
*> the eigenvalues. Elements 1:ilo-1 and i+1:n of WR
*> and WI contain those eigenvalues which have been
*> successfully computed. (Failures are rare.)
*>
-*> If INFO .GT. 0 and WANT is .FALSE., then on exit,
+*> If INFO > 0 and WANT is .FALSE., then on exit,
*> the remaining unconverged eigenvalues are the eigen-
*> values of the upper Hessenberg matrix rows and
*> columns ILO through INFO of the final, output
*> value of H.
*>
-*> If INFO .GT. 0 and WANTT is .TRUE., then on exit
+*> If INFO > 0 and WANTT is .TRUE., then on exit
*>
*> (*) (initial value of H)*U = U*(final value of H)
*>
@@ -202,7 +202,7 @@
*> value of H is upper Hessenberg and triangular in
*> rows and columns INFO+1 through IHI.
*>
-*> If INFO .GT. 0 and WANTZ is .TRUE., then on exit
+*> If INFO > 0 and WANTZ is .TRUE., then on exit
*>
*> (final value of Z(ILO:IHI,ILOZ:IHIZ)
*> = (initial value of Z(ILO:IHI,ILOZ:IHIZ)*U
@@ -210,7 +210,7 @@
*> where U is the unitary matrix in (*) (regard-
*> less of the value of WANTT.)
*>
-*> If INFO .GT. 0 and WANTZ is .FALSE., then Z is not
+*> If INFO > 0 and WANTZ is .FALSE., then Z is not
*> accessed.
*> \endverbatim
*
@@ -643,7 +643,7 @@
END IF
END IF
*
-* ==== Use up to NS of the the smallest magnatiude
+* ==== Use up to NS of the the smallest magnitude
* . shifts. If there aren't NS shifts available,
* . then use them all, possibly dropping one to
* . make the number of shifts even. ====
diff --git a/lapack-netlib/SRC/claqr5.f b/lapack-netlib/SRC/claqr5.f
index 4c897895d..e4317a3ad 100644
--- a/lapack-netlib/SRC/claqr5.f
+++ b/lapack-netlib/SRC/claqr5.f
@@ -125,7 +125,7 @@
*> \verbatim
*> LDH is INTEGER
*> LDH is the leading dimension of H just as declared in the
-*> calling procedure. LDH.GE.MAX(1,N).
+*> calling procedure. LDH >= MAX(1,N).
*> \endverbatim
*>
*> \param[in] ILOZ
@@ -137,7 +137,7 @@
*> \verbatim
*> IHIZ is INTEGER
*> Specify the rows of Z to which transformations must be
-*> applied if WANTZ is .TRUE.. 1 .LE. ILOZ .LE. IHIZ .LE. N
+*> applied if WANTZ is .TRUE.. 1 <= ILOZ <= IHIZ <= N
*> \endverbatim
*>
*> \param[in,out] Z
@@ -153,7 +153,7 @@
*> \verbatim
*> LDZ is INTEGER
*> LDA is the leading dimension of Z just as declared in
-*> the calling procedure. LDZ.GE.N.
+*> the calling procedure. LDZ >= N.
*> \endverbatim
*>
*> \param[out] V
@@ -165,7 +165,7 @@
*> \verbatim
*> LDV is INTEGER
*> LDV is the leading dimension of V as declared in the
-*> calling procedure. LDV.GE.3.
+*> calling procedure. LDV >= 3.
*> \endverbatim
*>
*> \param[out] U
@@ -177,33 +177,14 @@
*> \verbatim
*> LDU is INTEGER
*> LDU is the leading dimension of U just as declared in the
-*> in the calling subroutine. LDU.GE.3*NSHFTS-3.
-*> \endverbatim
-*>
-*> \param[in] NH
-*> \verbatim
-*> NH is INTEGER
-*> NH is the number of columns in array WH available for
-*> workspace. NH.GE.1.
-*> \endverbatim
-*>
-*> \param[out] WH
-*> \verbatim
-*> WH is COMPLEX array, dimension (LDWH,NH)
-*> \endverbatim
-*>
-*> \param[in] LDWH
-*> \verbatim
-*> LDWH is INTEGER
-*> Leading dimension of WH just as declared in the
-*> calling procedure. LDWH.GE.3*NSHFTS-3.
+*> in the calling subroutine. LDU >= 3*NSHFTS-3.
*> \endverbatim
*>
*> \param[in] NV
*> \verbatim
*> NV is INTEGER
*> NV is the number of rows in WV agailable for workspace.
-*> NV.GE.1.
+*> NV >= 1.
*> \endverbatim
*>
*> \param[out] WV
@@ -215,9 +196,28 @@
*> \verbatim
*> LDWV is INTEGER
*> LDWV is the leading dimension of WV as declared in the
-*> in the calling subroutine. LDWV.GE.NV.
+*> in the calling subroutine. LDWV >= NV.
*> \endverbatim
*
+*> \param[in] NH
+*> \verbatim
+*> NH is INTEGER
+*> NH is the number of columns in array WH available for
+*> workspace. NH >= 1.
+*> \endverbatim
+*>
+*> \param[out] WH
+*> \verbatim
+*> WH is COMPLEX array, dimension (LDWH,NH)
+*> \endverbatim
+*>
+*> \param[in] LDWH
+*> \verbatim
+*> LDWH is INTEGER
+*> Leading dimension of WH just as declared in the
+*> calling procedure. LDWH >= 3*NSHFTS-3.
+*> \endverbatim
+*>
* Authors:
* ========
*
diff --git a/lapack-netlib/SRC/clarfb.f b/lapack-netlib/SRC/clarfb.f
index 8fdd5c89c..a4d429c09 100644
--- a/lapack-netlib/SRC/clarfb.f
+++ b/lapack-netlib/SRC/clarfb.f
@@ -92,6 +92,8 @@
*> K is INTEGER
*> The order of the matrix T (= the number of elementary
*> reflectors whose product defines the block reflector).
+*> If SIDE = 'L', M >= K >= 0;
+*> if SIDE = 'R', N >= K >= 0.
*> \endverbatim
*>
*> \param[in] V
diff --git a/lapack-netlib/SRC/clarfx.f b/lapack-netlib/SRC/clarfx.f
index 1111c80f7..ad284883d 100644
--- a/lapack-netlib/SRC/clarfx.f
+++ b/lapack-netlib/SRC/clarfx.f
@@ -94,7 +94,7 @@
*> \param[in] LDC
*> \verbatim
*> LDC is INTEGER
-*> The leading dimension of the array C. LDA >= max(1,M).
+*> The leading dimension of the array C. LDC >= max(1,M).
*> \endverbatim
*>
*> \param[out] WORK
diff --git a/lapack-netlib/SRC/clarfy.f b/lapack-netlib/SRC/clarfy.f
index a5743858c..fccd136a8 100644
--- a/lapack-netlib/SRC/clarfy.f
+++ b/lapack-netlib/SRC/clarfy.f
@@ -103,7 +103,7 @@
*
*> \date December 2016
*
-*> \ingroup complex_eig
+*> \ingroup complexOTHERauxiliary
*
* =====================================================================
SUBROUTINE CLARFY( UPLO, N, V, INCV, TAU, C, LDC, WORK )
diff --git a/lapack-netlib/SRC/clarrv.f b/lapack-netlib/SRC/clarrv.f
index 72fe1f948..a45f55ac3 100644
--- a/lapack-netlib/SRC/clarrv.f
+++ b/lapack-netlib/SRC/clarrv.f
@@ -143,7 +143,7 @@
*> RTOL2 is REAL
*> Parameters for bisection.
*> An interval [LEFT,RIGHT] has converged if
-*> RIGHT-LEFT.LT.MAX( RTOL1*GAP, RTOL2*MAX(|LEFT|,|RIGHT|) )
+*> RIGHT-LEFT < MAX( RTOL1*GAP, RTOL2*MAX(|LEFT|,|RIGHT|) )
*> \endverbatim
*>
*> \param[in,out] W
diff --git a/lapack-netlib/SRC/classq.f b/lapack-netlib/SRC/classq.f
index 28398596f..92e407ff3 100644
--- a/lapack-netlib/SRC/classq.f
+++ b/lapack-netlib/SRC/classq.f
@@ -41,7 +41,7 @@
*> where x( i ) = abs( X( 1 + ( i - 1 )*INCX ) ). The value of sumsq is
*> assumed to be at least unity and the value of ssq will then satisfy
*>
-*> 1.0 .le. ssq .le. ( sumsq + 2*n ).
+*> 1.0 <= ssq <= ( sumsq + 2*n ).
*>
*> scale is assumed to be non-negative and scl returns the value
*>
@@ -65,7 +65,7 @@
*>
*> \param[in] X
*> \verbatim
-*> X is COMPLEX array, dimension (N)
+*> X is COMPLEX array, dimension (1+(N-1)*INCX)
*> The vector x as described above.
*> x( i ) = X( 1 + ( i - 1 )*INCX ), 1 <= i <= n.
*> \endverbatim
diff --git a/lapack-netlib/SRC/claswlq.f b/lapack-netlib/SRC/claswlq.f
index 5fa2276e8..dcbdc0d52 100644
--- a/lapack-netlib/SRC/claswlq.f
+++ b/lapack-netlib/SRC/claswlq.f
@@ -1,3 +1,4 @@
+*> \brief \b CLASWLQ
*
* Definition:
* ===========
@@ -18,9 +19,20 @@
*>
*> \verbatim
*>
-*> CLASWLQ computes a blocked Short-Wide LQ factorization of a
-*> M-by-N matrix A, where N >= M:
-*> A = L * Q
+*> CLASWLQ computes a blocked Tall-Skinny LQ factorization of
+*> a complex M-by-N matrix A for M <= N:
+*>
+*> A = ( L 0 ) * Q,
+*>
+*> where:
+*>
+*> Q is a n-by-N orthogonal matrix, stored on exit in an implicit
+*> form in the elements above the digonal of the array A and in
+*> the elemenst of the array T;
+*> L is an lower-triangular M-by-M matrix stored on exit in
+*> the elements on and below the diagonal of the array A.
+*> 0 is a M-by-(N-M) zero matrix, if M < N, and is not stored.
+*>
*> \endverbatim
*
* Arguments:
@@ -150,7 +162,7 @@
SUBROUTINE CLASWLQ( M, N, MB, NB, A, LDA, T, LDT, WORK, LWORK,
$ INFO)
*
-* -- LAPACK computational routine (version 3.7.1) --
+* -- LAPACK computational routine (version 3.9.0) --
* -- LAPACK is a software package provided by Univ. of Tennessee, --
* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd. --
* June 2017
diff --git a/lapack-netlib/SRC/clasyf_aa.f b/lapack-netlib/SRC/clasyf_aa.f
index 1bc96ee1b..a44a8f5b1 100644
--- a/lapack-netlib/SRC/clasyf_aa.f
+++ b/lapack-netlib/SRC/clasyf_aa.f
@@ -84,7 +84,7 @@
*>
*> \param[in,out] A
*> \verbatim
-*> A is REAL array, dimension (LDA,M) for
+*> A is COMPLEX array, dimension (LDA,M) for
*> the first panel, while dimension (LDA,M+1) for the
*> remaining panels.
*>
@@ -112,7 +112,7 @@
*>
*> \param[in,out] H
*> \verbatim
-*> H is REAL workspace, dimension (LDH,NB).
+*> H is COMPLEX workspace, dimension (LDH,NB).
*>
*> \endverbatim
*>
@@ -124,7 +124,7 @@
*>
*> \param[out] WORK
*> \verbatim
-*> WORK is REAL workspace, dimension (M).
+*> WORK is COMPLEX workspace, dimension (M).
*> \endverbatim
*>
*
@@ -284,8 +284,9 @@
*
* Swap A(I1, I2+1:M) with A(I2, I2+1:M)
*
- CALL CSWAP( M-I2, A( J1+I1-1, I2+1 ), LDA,
- $ A( J1+I2-1, I2+1 ), LDA )
+ IF( I2.LT.M )
+ $ CALL CSWAP( M-I2, A( J1+I1-1, I2+1 ), LDA,
+ $ A( J1+I2-1, I2+1 ), LDA )
*
* Swap A(I1, I1) with A(I2,I2)
*
@@ -325,13 +326,15 @@
* Compute L(J+2, J+1) = WORK( 3:M ) / T(J, J+1),
* where A(J, J+1) = T(J, J+1) and A(J+2:M, J) = L(J+2:M, J+1)
*
- IF( A( K, J+1 ).NE.ZERO ) THEN
- ALPHA = ONE / A( K, J+1 )
- CALL CCOPY( M-J-1, WORK( 3 ), 1, A( K, J+2 ), LDA )
- CALL CSCAL( M-J-1, ALPHA, A( K, J+2 ), LDA )
- ELSE
- CALL CLASET( 'Full', 1, M-J-1, ZERO, ZERO,
- $ A( K, J+2 ), LDA)
+ IF( J.LT.(M-1) ) THEN
+ IF( A( K, J+1 ).NE.ZERO ) THEN
+ ALPHA = ONE / A( K, J+1 )
+ CALL CCOPY( M-J-1, WORK( 3 ), 1, A( K, J+2 ), LDA )
+ CALL CSCAL( M-J-1, ALPHA, A( K, J+2 ), LDA )
+ ELSE
+ CALL CLASET( 'Full', 1, M-J-1, ZERO, ZERO,
+ $ A( K, J+2 ), LDA)
+ END IF
END IF
END IF
J = J + 1
@@ -432,8 +435,9 @@
*
* Swap A(I2+1:M, I1) with A(I2+1:M, I2)
*
- CALL CSWAP( M-I2, A( I2+1, J1+I1-1 ), 1,
- $ A( I2+1, J1+I2-1 ), 1 )
+ IF( I2.LT.M )
+ $ CALL CSWAP( M-I2, A( I2+1, J1+I1-1 ), 1,
+ $ A( I2+1, J1+I2-1 ), 1 )
*
* Swap A(I1, I1) with A(I2, I2)
*
@@ -473,13 +477,15 @@
* Compute L(J+2, J+1) = WORK( 3:M ) / T(J, J+1),
* where A(J, J+1) = T(J, J+1) and A(J+2:M, J) = L(J+2:M, J+1)
*
- IF( A( J+1, K ).NE.ZERO ) THEN
- ALPHA = ONE / A( J+1, K )
- CALL CCOPY( M-J-1, WORK( 3 ), 1, A( J+2, K ), 1 )
- CALL CSCAL( M-J-1, ALPHA, A( J+2, K ), 1 )
- ELSE
- CALL CLASET( 'Full', M-J-1, 1, ZERO, ZERO,
- $ A( J+2, K ), LDA )
+ IF( J.LT.(M-1) ) THEN
+ IF( A( J+1, K ).NE.ZERO ) THEN
+ ALPHA = ONE / A( J+1, K )
+ CALL CCOPY( M-J-1, WORK( 3 ), 1, A( J+2, K ), 1 )
+ CALL CSCAL( M-J-1, ALPHA, A( J+2, K ), 1 )
+ ELSE
+ CALL CLASET( 'Full', M-J-1, 1, ZERO, ZERO,
+ $ A( J+2, K ), LDA )
+ END IF
END IF
END IF
J = J + 1
diff --git a/lapack-netlib/SRC/clasyf_rk.f b/lapack-netlib/SRC/clasyf_rk.f
index 0700c5cc2..bd7a0fb45 100644
--- a/lapack-netlib/SRC/clasyf_rk.f
+++ b/lapack-netlib/SRC/clasyf_rk.f
@@ -330,7 +330,7 @@
* of A and working backwards, and compute the matrix W = U12*D
* for use in updating A11
*
-* Initilize the first entry of array E, where superdiagonal
+* Initialize the first entry of array E, where superdiagonal
* elements of D are stored
*
E( 1 ) = CZERO
@@ -658,7 +658,7 @@
* of A and working forwards, and compute the matrix W = L21*D
* for use in updating A22
*
-* Initilize the unused last entry of the subdiagonal array E.
+* Initialize the unused last entry of the subdiagonal array E.
*
E( N ) = CZERO
*
diff --git a/lapack-netlib/SRC/clatdf.f b/lapack-netlib/SRC/clatdf.f
index 357f66422..557830d1c 100644
--- a/lapack-netlib/SRC/clatdf.f
+++ b/lapack-netlib/SRC/clatdf.f
@@ -261,7 +261,7 @@
*
* Solve for U- part, lockahead for RHS(N) = +-1. This is not done
* In BSOLVE and will hopefully give us a better estimate because
-* any ill-conditioning of the original matrix is transfered to U
+* any ill-conditioning of the original matrix is transferred to U
* and not to L. U(N, N) is an approximation to sigma_min(LU).
*
CALL CCOPY( N-1, RHS, 1, WORK, 1 )
diff --git a/lapack-netlib/SRC/clatsqr.f b/lapack-netlib/SRC/clatsqr.f
index dab5774c1..e9c6d77c2 100644
--- a/lapack-netlib/SRC/clatsqr.f
+++ b/lapack-netlib/SRC/clatsqr.f
@@ -1,3 +1,4 @@
+*> \brief \b CLATSQR
*
* Definition:
* ===========
@@ -18,9 +19,23 @@
*>
*> \verbatim
*>
-*> SLATSQR computes a blocked Tall-Skinny QR factorization of
-*> an M-by-N matrix A, where M >= N:
-*> A = Q * R .
+*> CLATSQR computes a blocked Tall-Skinny QR factorization of
+*> a complex M-by-N matrix A for M >= N:
+*>
+*> A = Q * ( R ),
+*> ( 0 )
+*>
+*> where:
+*>
+*> Q is a M-by-M orthogonal matrix, stored on exit in an implicit
+*> form in the elements below the digonal of the array A and in
+*> the elemenst of the array T;
+*>
+*> R is an upper-triangular N-by-N matrix, stored on exit in
+*> the elements on and above the diagonal of the array A.
+*>
+*> 0 is a (M-N)-by-N zero matrix, and is not stored.
+*>
*> \endverbatim
*
* Arguments:
@@ -149,10 +164,10 @@
SUBROUTINE CLATSQR( M, N, MB, NB, A, LDA, T, LDT, WORK,
$ LWORK, INFO)
*
-* -- LAPACK computational routine (version 3.7.0) --
+* -- LAPACK computational routine (version 3.9.0) --
* -- LAPACK is a software package provided by Univ. of Tennessee, --
* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd. --
-* December 2016
+* November 2019
*
* .. Scalar Arguments ..
INTEGER INFO, LDA, M, N, MB, NB, LDT, LWORK
diff --git a/lapack-netlib/SRC/claunhr_col_getrfnp.f b/lapack-netlib/SRC/claunhr_col_getrfnp.f
new file mode 100644
index 000000000..66b9c0407
--- /dev/null
+++ b/lapack-netlib/SRC/claunhr_col_getrfnp.f
@@ -0,0 +1,248 @@
+*> \brief \b CLAUNHR_COL_GETRFNP
+*
+* =========== DOCUMENTATION ===========
+*
+* Online html documentation available at
+* http://www.netlib.org/lapack/explore-html/
+*
+*> \htmlonly
+*> Download CLAUNHR_COL_GETRFNP + dependencies
+*>
+*> [TGZ]
+*>
+*> [ZIP]
+*>
+*> [TXT]
+*> \endhtmlonly
+*
+* Definition:
+* ===========
+*
+* SUBROUTINE CLAUNHR_COL_GETRFNP( M, N, A, LDA, D, INFO )
+*
+* .. Scalar Arguments ..
+* INTEGER INFO, LDA, M, N
+* ..
+* .. Array Arguments ..
+* COMPLEX A( LDA, * ), D( * )
+* ..
+*
+*
+*> \par Purpose:
+* =============
+*>
+*> \verbatim
+*>
+*> CLAUNHR_COL_GETRFNP computes the modified LU factorization without
+*> pivoting of a complex general M-by-N matrix A. The factorization has
+*> the form:
+*>
+*> A - S = L * U,
+*>
+*> where:
+*> S is a m-by-n diagonal sign matrix with the diagonal D, so that
+*> D(i) = S(i,i), 1 <= i <= min(M,N). The diagonal D is constructed
+*> as D(i)=-SIGN(A(i,i)), where A(i,i) is the value after performing
+*> i-1 steps of Gaussian elimination. This means that the diagonal
+*> element at each step of "modified" Gaussian elimination is
+*> at least one in absolute value (so that division-by-zero not
+*> not possible during the division by the diagonal element);
+*>
+*> L is a M-by-N lower triangular matrix with unit diagonal elements
+*> (lower trapezoidal if M > N);
+*>
+*> and U is a M-by-N upper triangular matrix
+*> (upper trapezoidal if M < N).
+*>
+*> This routine is an auxiliary routine used in the Householder
+*> reconstruction routine CUNHR_COL. In CUNHR_COL, this routine is
+*> applied to an M-by-N matrix A with orthonormal columns, where each
+*> element is bounded by one in absolute value. With the choice of
+*> the matrix S above, one can show that the diagonal element at each
+*> step of Gaussian elimination is the largest (in absolute value) in
+*> the column on or below the diagonal, so that no pivoting is required
+*> for numerical stability [1].
+*>
+*> For more details on the Householder reconstruction algorithm,
+*> including the modified LU factorization, see [1].
+*>
+*> This is the blocked right-looking version of the algorithm,
+*> calling Level 3 BLAS to update the submatrix. To factorize a block,
+*> this routine calls the recursive routine CLAUNHR_COL_GETRFNP2.
+*>
+*> [1] "Reconstructing Householder vectors from tall-skinny QR",
+*> G. Ballard, J. Demmel, L. Grigori, M. Jacquelin, H.D. Nguyen,
+*> E. Solomonik, J. Parallel Distrib. Comput.,
+*> vol. 85, pp. 3-31, 2015.
+*> \endverbatim
+*
+* Arguments:
+* ==========
+*
+*> \param[in] M
+*> \verbatim
+*> M is INTEGER
+*> The number of rows of the matrix A. M >= 0.
+*> \endverbatim
+*>
+*> \param[in] N
+*> \verbatim
+*> N is INTEGER
+*> The number of columns of the matrix A. N >= 0.
+*> \endverbatim
+*>
+*> \param[in,out] A
+*> \verbatim
+*> A is COMPLEX array, dimension (LDA,N)
+*> On entry, the M-by-N matrix to be factored.
+*> On exit, the factors L and U from the factorization
+*> A-S=L*U; the unit diagonal elements of L are not stored.
+*> \endverbatim
+*>
+*> \param[in] LDA
+*> \verbatim
+*> LDA is INTEGER
+*> The leading dimension of the array A. LDA >= max(1,M).
+*> \endverbatim
+*>
+*> \param[out] D
+*> \verbatim
+*> D is COMPLEX array, dimension min(M,N)
+*> The diagonal elements of the diagonal M-by-N sign matrix S,
+*> D(i) = S(i,i), where 1 <= i <= min(M,N). The elements can be
+*> only ( +1.0, 0.0 ) or (-1.0, 0.0 ).
+*> \endverbatim
+*>
+*> \param[out] INFO
+*> \verbatim
+*> INFO is INTEGER
+*> = 0: successful exit
+*> < 0: if INFO = -i, the i-th argument had an illegal value
+*> \endverbatim
+*>
+* Authors:
+* ========
+*
+*> \author Univ. of Tennessee
+*> \author Univ. of California Berkeley
+*> \author Univ. of Colorado Denver
+*> \author NAG Ltd.
+*
+*> \date November 2019
+*
+*> \ingroup complexGEcomputational
+*
+*> \par Contributors:
+* ==================
+*>
+*> \verbatim
+*>
+*> November 2019, Igor Kozachenko,
+*> Computer Science Division,
+*> University of California, Berkeley
+*>
+*> \endverbatim
+*
+* =====================================================================
+ SUBROUTINE CLAUNHR_COL_GETRFNP( M, N, A, LDA, D, INFO )
+ IMPLICIT NONE
+*
+* -- LAPACK computational routine (version 3.9.0) --
+* -- LAPACK is a software package provided by Univ. of Tennessee, --
+* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
+* November 2019
+*
+* .. Scalar Arguments ..
+ INTEGER INFO, LDA, M, N
+* ..
+* .. Array Arguments ..
+ COMPLEX A( LDA, * ), D( * )
+* ..
+*
+* =====================================================================
+*
+* .. Parameters ..
+ COMPLEX CONE
+ PARAMETER ( CONE = ( 1.0E+0, 0.0E+0 ) )
+* ..
+* .. Local Scalars ..
+ INTEGER IINFO, J, JB, NB
+* ..
+* .. External Subroutines ..
+ EXTERNAL CGEMM, CLAUNHR_COL_GETRFNP2, CTRSM, XERBLA
+* ..
+* .. External Functions ..
+ INTEGER ILAENV
+ EXTERNAL ILAENV
+* ..
+* .. Intrinsic Functions ..
+ INTRINSIC MAX, MIN
+* ..
+* .. Executable Statements ..
+*
+* Test the input parameters.
+*
+ INFO = 0
+ IF( M.LT.0 ) THEN
+ INFO = -1
+ ELSE IF( N.LT.0 ) THEN
+ INFO = -2
+ ELSE IF( LDA.LT.MAX( 1, M ) ) THEN
+ INFO = -4
+ END IF
+ IF( INFO.NE.0 ) THEN
+ CALL XERBLA( 'CLAUNHR_COL_GETRFNP', -INFO )
+ RETURN
+ END IF
+*
+* Quick return if possible
+*
+ IF( MIN( M, N ).EQ.0 )
+ $ RETURN
+*
+* Determine the block size for this environment.
+*
+
+ NB = ILAENV( 1, 'CLAUNHR_COL_GETRFNP', ' ', M, N, -1, -1 )
+
+ IF( NB.LE.1 .OR. NB.GE.MIN( M, N ) ) THEN
+*
+* Use unblocked code.
+*
+ CALL CLAUNHR_COL_GETRFNP2( M, N, A, LDA, D, INFO )
+ ELSE
+*
+* Use blocked code.
+*
+ DO J = 1, MIN( M, N ), NB
+ JB = MIN( MIN( M, N )-J+1, NB )
+*
+* Factor diagonal and subdiagonal blocks.
+*
+ CALL CLAUNHR_COL_GETRFNP2( M-J+1, JB, A( J, J ), LDA,
+ $ D( J ), IINFO )
+*
+ IF( J+JB.LE.N ) THEN
+*
+* Compute block row of U.
+*
+ CALL CTRSM( 'Left', 'Lower', 'No transpose', 'Unit', JB,
+ $ N-J-JB+1, CONE, A( J, J ), LDA, A( J, J+JB ),
+ $ LDA )
+ IF( J+JB.LE.M ) THEN
+*
+* Update trailing submatrix.
+*
+ CALL CGEMM( 'No transpose', 'No transpose', M-J-JB+1,
+ $ N-J-JB+1, JB, -CONE, A( J+JB, J ), LDA,
+ $ A( J, J+JB ), LDA, CONE, A( J+JB, J+JB ),
+ $ LDA )
+ END IF
+ END IF
+ END DO
+ END IF
+ RETURN
+*
+* End of CLAUNHR_COL_GETRFNP
+*
+ END
diff --git a/lapack-netlib/SRC/claunhr_col_getrfnp2.f b/lapack-netlib/SRC/claunhr_col_getrfnp2.f
new file mode 100644
index 000000000..82fc329ee
--- /dev/null
+++ b/lapack-netlib/SRC/claunhr_col_getrfnp2.f
@@ -0,0 +1,314 @@
+*> \brief \b CLAUNHR_COL_GETRFNP2
+*
+* =========== DOCUMENTATION ===========
+*
+* Online html documentation available at
+* http://www.netlib.org/lapack/explore-html/
+*
+*> \htmlonly
+*> Download CLAUNHR_COL_GETRFNP2 + dependencies
+*>
+*> [TGZ]
+*>
+*> [ZIP]
+*>
+*> [TXT]
+*> \endhtmlonly
+*
+* Definition:
+* ===========
+*
+* RECURSIVE SUBROUTINE CLAUNHR_COL_GETRFNP2( M, N, A, LDA, D, INFO )
+*
+* .. Scalar Arguments ..
+* INTEGER INFO, LDA, M, N
+* ..
+* .. Array Arguments ..
+* COMPLEX A( LDA, * ), D( * )
+* ..
+*
+*
+*> \par Purpose:
+* =============
+*>
+*> \verbatim
+*>
+*> CLAUNHR_COL_GETRFNP2 computes the modified LU factorization without
+*> pivoting of a complex general M-by-N matrix A. The factorization has
+*> the form:
+*>
+*> A - S = L * U,
+*>
+*> where:
+*> S is a m-by-n diagonal sign matrix with the diagonal D, so that
+*> D(i) = S(i,i), 1 <= i <= min(M,N). The diagonal D is constructed
+*> as D(i)=-SIGN(A(i,i)), where A(i,i) is the value after performing
+*> i-1 steps of Gaussian elimination. This means that the diagonal
+*> element at each step of "modified" Gaussian elimination is at
+*> least one in absolute value (so that division-by-zero not
+*> possible during the division by the diagonal element);
+*>
+*> L is a M-by-N lower triangular matrix with unit diagonal elements
+*> (lower trapezoidal if M > N);
+*>
+*> and U is a M-by-N upper triangular matrix
+*> (upper trapezoidal if M < N).
+*>
+*> This routine is an auxiliary routine used in the Householder
+*> reconstruction routine CUNHR_COL. In CUNHR_COL, this routine is
+*> applied to an M-by-N matrix A with orthonormal columns, where each
+*> element is bounded by one in absolute value. With the choice of
+*> the matrix S above, one can show that the diagonal element at each
+*> step of Gaussian elimination is the largest (in absolute value) in
+*> the column on or below the diagonal, so that no pivoting is required
+*> for numerical stability [1].
+*>
+*> For more details on the Householder reconstruction algorithm,
+*> including the modified LU factorization, see [1].
+*>
+*> This is the recursive version of the LU factorization algorithm.
+*> Denote A - S by B. The algorithm divides the matrix B into four
+*> submatrices:
+*>
+*> [ B11 | B12 ] where B11 is n1 by n1,
+*> B = [ -----|----- ] B21 is (m-n1) by n1,
+*> [ B21 | B22 ] B12 is n1 by n2,
+*> B22 is (m-n1) by n2,
+*> with n1 = min(m,n)/2, n2 = n-n1.
+*>
+*>
+*> The subroutine calls itself to factor B11, solves for B21,
+*> solves for B12, updates B22, then calls itself to factor B22.
+*>
+*> For more details on the recursive LU algorithm, see [2].
+*>
+*> CLAUNHR_COL_GETRFNP2 is called to factorize a block by the blocked
+*> routine CLAUNHR_COL_GETRFNP, which uses blocked code calling
+*. Level 3 BLAS to update the submatrix. However, CLAUNHR_COL_GETRFNP2
+*> is self-sufficient and can be used without CLAUNHR_COL_GETRFNP.
+*>
+*> [1] "Reconstructing Householder vectors from tall-skinny QR",
+*> G. Ballard, J. Demmel, L. Grigori, M. Jacquelin, H.D. Nguyen,
+*> E. Solomonik, J. Parallel Distrib. Comput.,
+*> vol. 85, pp. 3-31, 2015.
+*>
+*> [2] "Recursion leads to automatic variable blocking for dense linear
+*> algebra algorithms", F. Gustavson, IBM J. of Res. and Dev.,
+*> vol. 41, no. 6, pp. 737-755, 1997.
+*> \endverbatim
+*
+* Arguments:
+* ==========
+*
+*> \param[in] M
+*> \verbatim
+*> M is INTEGER
+*> The number of rows of the matrix A. M >= 0.
+*> \endverbatim
+*>
+*> \param[in] N
+*> \verbatim
+*> N is INTEGER
+*> The number of columns of the matrix A. N >= 0.
+*> \endverbatim
+*>
+*> \param[in,out] A
+*> \verbatim
+*> A is COMPLEX array, dimension (LDA,N)
+*> On entry, the M-by-N matrix to be factored.
+*> On exit, the factors L and U from the factorization
+*> A-S=L*U; the unit diagonal elements of L are not stored.
+*> \endverbatim
+*>
+*> \param[in] LDA
+*> \verbatim
+*> LDA is INTEGER
+*> The leading dimension of the array A. LDA >= max(1,M).
+*> \endverbatim
+*>
+*> \param[out] D
+*> \verbatim
+*> D is COMPLEX array, dimension min(M,N)
+*> The diagonal elements of the diagonal M-by-N sign matrix S,
+*> D(i) = S(i,i), where 1 <= i <= min(M,N). The elements can be
+*> only ( +1.0, 0.0 ) or (-1.0, 0.0 ).
+*> \endverbatim
+*>
+*> \param[out] INFO
+*> \verbatim
+*> INFO is INTEGER
+*> = 0: successful exit
+*> < 0: if INFO = -i, the i-th argument had an illegal value
+*> \endverbatim
+*>
+* Authors:
+* ========
+*
+*> \author Univ. of Tennessee
+*> \author Univ. of California Berkeley
+*> \author Univ. of Colorado Denver
+*> \author NAG Ltd.
+*
+*> \date November 2019
+*
+*> \ingroup complexGEcomputational
+*
+*> \par Contributors:
+* ==================
+*>
+*> \verbatim
+*>
+*> November 2019, Igor Kozachenko,
+*> Computer Science Division,
+*> University of California, Berkeley
+*>
+*> \endverbatim
+*
+* =====================================================================
+ RECURSIVE SUBROUTINE CLAUNHR_COL_GETRFNP2( M, N, A, LDA, D, INFO )
+ IMPLICIT NONE
+*
+* -- LAPACK computational routine (version 3.9.0) --
+* -- LAPACK is a software package provided by Univ. of Tennessee, --
+* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
+* November 2019
+*
+* .. Scalar Arguments ..
+ INTEGER INFO, LDA, M, N
+* ..
+* .. Array Arguments ..
+ COMPLEX A( LDA, * ), D( * )
+* ..
+*
+* =====================================================================
+*
+* .. Parameters ..
+ REAL ONE
+ PARAMETER ( ONE = 1.0E+0 )
+ COMPLEX CONE
+ PARAMETER ( CONE = ( 1.0E+0, 0.0E+0 ) )
+* ..
+* .. Local Scalars ..
+ REAL SFMIN
+ INTEGER I, IINFO, N1, N2
+ COMPLEX Z
+* ..
+* .. External Functions ..
+ REAL SLAMCH
+ EXTERNAL SLAMCH
+* ..
+* .. External Subroutines ..
+ EXTERNAL CGEMM, CSCAL, CTRSM, XERBLA
+* ..
+* .. Intrinsic Functions ..
+ INTRINSIC ABS, REAL, CMPLX, AIMAG, SIGN, MAX, MIN
+* ..
+* .. Statement Functions ..
+ DOUBLE PRECISION CABS1
+* ..
+* .. Statement Function definitions ..
+ CABS1( Z ) = ABS( REAL( Z ) ) + ABS( AIMAG( Z ) )
+* ..
+* .. Executable Statements ..
+*
+* Test the input parameters
+*
+ INFO = 0
+ IF( M.LT.0 ) THEN
+ INFO = -1
+ ELSE IF( N.LT.0 ) THEN
+ INFO = -2
+ ELSE IF( LDA.LT.MAX( 1, M ) ) THEN
+ INFO = -4
+ END IF
+ IF( INFO.NE.0 ) THEN
+ CALL XERBLA( 'CLAUNHR_COL_GETRFNP2', -INFO )
+ RETURN
+ END IF
+*
+* Quick return if possible
+*
+ IF( MIN( M, N ).EQ.0 )
+ $ RETURN
+
+ IF ( M.EQ.1 ) THEN
+*
+* One row case, (also recursion termination case),
+* use unblocked code
+*
+* Transfer the sign
+*
+ D( 1 ) = CMPLX( -SIGN( ONE, REAL( A( 1, 1 ) ) ) )
+*
+* Construct the row of U
+*
+ A( 1, 1 ) = A( 1, 1 ) - D( 1 )
+*
+ ELSE IF( N.EQ.1 ) THEN
+*
+* One column case, (also recursion termination case),
+* use unblocked code
+*
+* Transfer the sign
+*
+ D( 1 ) = CMPLX( -SIGN( ONE, REAL( A( 1, 1 ) ) ) )
+*
+* Construct the row of U
+*
+ A( 1, 1 ) = A( 1, 1 ) - D( 1 )
+*
+* Scale the elements 2:M of the column
+*
+* Determine machine safe minimum
+*
+ SFMIN = SLAMCH('S')
+*
+* Construct the subdiagonal elements of L
+*
+ IF( CABS1( A( 1, 1 ) ) .GE. SFMIN ) THEN
+ CALL CSCAL( M-1, CONE / A( 1, 1 ), A( 2, 1 ), 1 )
+ ELSE
+ DO I = 2, M
+ A( I, 1 ) = A( I, 1 ) / A( 1, 1 )
+ END DO
+ END IF
+*
+ ELSE
+*
+* Divide the matrix B into four submatrices
+*
+ N1 = MIN( M, N ) / 2
+ N2 = N-N1
+
+*
+* Factor B11, recursive call
+*
+ CALL CLAUNHR_COL_GETRFNP2( N1, N1, A, LDA, D, IINFO )
+*
+* Solve for B21
+*
+ CALL CTRSM( 'R', 'U', 'N', 'N', M-N1, N1, CONE, A, LDA,
+ $ A( N1+1, 1 ), LDA )
+*
+* Solve for B12
+*
+ CALL CTRSM( 'L', 'L', 'N', 'U', N1, N2, CONE, A, LDA,
+ $ A( 1, N1+1 ), LDA )
+*
+* Update B22, i.e. compute the Schur complement
+* B22 := B22 - B21*B12
+*
+ CALL CGEMM( 'N', 'N', M-N1, N2, N1, -CONE, A( N1+1, 1 ), LDA,
+ $ A( 1, N1+1 ), LDA, CONE, A( N1+1, N1+1 ), LDA )
+*
+* Factor B22, recursive call
+*
+ CALL CLAUNHR_COL_GETRFNP2( M-N1, N2, A( N1+1, N1+1 ), LDA,
+ $ D( N1+1 ), IINFO )
+*
+ END IF
+ RETURN
+*
+* End of CLAUNHR_COL_GETRFNP2
+*
+ END
diff --git a/lapack-netlib/SRC/cporfsx.f b/lapack-netlib/SRC/cporfsx.f
index 872bad36c..3a2db7135 100644
--- a/lapack-netlib/SRC/cporfsx.f
+++ b/lapack-netlib/SRC/cporfsx.f
@@ -44,7 +44,7 @@
*> \verbatim
*>
*> CPORFSX improves the computed solution to a system of linear
-*> equations when the coefficient matrix is symmetric positive
+*> equations when the coefficient matrix is Hermitian positive
*> definite, and provides error bounds and backward error estimates
*> for the solution. In addition to normwise error bound, the code
*> provides maximum componentwise error bound if possible. See
@@ -103,7 +103,7 @@
*> \param[in] A
*> \verbatim
*> A is COMPLEX array, dimension (LDA,N)
-*> The symmetric matrix A. If UPLO = 'U', the leading N-by-N
+*> The Hermitian matrix A. If UPLO = 'U', the leading N-by-N
*> upper triangular part of A contains the upper triangular part
*> of the matrix A, and the strictly lower triangular part of A
*> is not referenced. If UPLO = 'L', the leading N-by-N lower
@@ -134,7 +134,7 @@
*> \param[in,out] S
*> \verbatim
*> S is REAL array, dimension (N)
-*> The row scale factors for A. If EQUED = 'Y', A is multiplied on
+*> The scale factors for A. If EQUED = 'Y', A is multiplied on
*> the left and right by diag(S). S is an input argument if FACT =
*> 'F'; otherwise, S is an output argument. If FACT = 'F' and EQUED
*> = 'Y', each element of S must be positive. If S is output, each
@@ -262,7 +262,7 @@
*> information as described below. There currently are up to three
*> pieces of information returned for each right-hand side. If
*> componentwise accuracy is not requested (PARAMS(3) = 0.0), then
-*> ERR_BNDS_COMP is not accessed. If N_ERR_BNDS .LT. 3, then at most
+*> ERR_BNDS_COMP is not accessed. If N_ERR_BNDS < 3, then at most
*> the first (:,N_ERR_BNDS) entries are returned.
*>
*> The first index in ERR_BNDS_COMP(i,:) corresponds to the ith
@@ -298,14 +298,14 @@
*> \param[in] NPARAMS
*> \verbatim
*> NPARAMS is INTEGER
-*> Specifies the number of parameters set in PARAMS. If .LE. 0, the
+*> Specifies the number of parameters set in PARAMS. If <= 0, the
*> PARAMS array is never referenced and default values are used.
*> \endverbatim
*>
*> \param[in,out] PARAMS
*> \verbatim
*> PARAMS is REAL array, dimension NPARAMS
-*> Specifies algorithm parameters. If an entry is .LT. 0.0, then
+*> Specifies algorithm parameters. If an entry is < 0.0, then
*> that entry will be filled with default value used for that
*> parameter. Only positions up to NPARAMS are accessed; defaults
*> are used for higher-numbered parameters.
@@ -313,9 +313,9 @@
*> PARAMS(LA_LINRX_ITREF_I = 1) : Whether to perform iterative
*> refinement or not.
*> Default: 1.0
-*> = 0.0 : No refinement is performed, and no error bounds are
+*> = 0.0: No refinement is performed, and no error bounds are
*> computed.
-*> = 1.0 : Use the double-precision refinement algorithm,
+*> = 1.0: Use the double-precision refinement algorithm,
*> possibly with doubled-single computations if the
*> compilation environment does not support DOUBLE
*> PRECISION.
diff --git a/lapack-netlib/SRC/cposvxx.f b/lapack-netlib/SRC/cposvxx.f
index 64d1b67fa..57c2d3feb 100644
--- a/lapack-netlib/SRC/cposvxx.f
+++ b/lapack-netlib/SRC/cposvxx.f
@@ -45,7 +45,7 @@
*>
*> CPOSVXX uses the Cholesky factorization A = U**T*U or A = L*L**T
*> to compute the solution to a complex system of linear equations
-*> A * X = B, where A is an N-by-N symmetric positive definite matrix
+*> A * X = B, where A is an N-by-N Hermitian positive definite matrix
*> and X and B are N-by-NRHS matrices.
*>
*> If requested, both normwise and maximum componentwise error bounds
@@ -157,7 +157,7 @@
*> \param[in,out] A
*> \verbatim
*> A is COMPLEX array, dimension (LDA,N)
-*> On entry, the symmetric matrix A, except if FACT = 'F' and EQUED =
+*> On entry, the Hermitian matrix A, except if FACT = 'F' and EQUED =
*> 'Y', then A must contain the equilibrated matrix
*> diag(S)*A*diag(S). If UPLO = 'U', the leading N-by-N upper
*> triangular part of A contains the upper triangular part of the
@@ -365,7 +365,7 @@
*> information as described below. There currently are up to three
*> pieces of information returned for each right-hand side. If
*> componentwise accuracy is not requested (PARAMS(3) = 0.0), then
-*> ERR_BNDS_COMP is not accessed. If N_ERR_BNDS .LT. 3, then at most
+*> ERR_BNDS_COMP is not accessed. If N_ERR_BNDS < 3, then at most
*> the first (:,N_ERR_BNDS) entries are returned.
*>
*> The first index in ERR_BNDS_COMP(i,:) corresponds to the ith
@@ -401,14 +401,14 @@
*> \param[in] NPARAMS
*> \verbatim
*> NPARAMS is INTEGER
-*> Specifies the number of parameters set in PARAMS. If .LE. 0, the
+*> Specifies the number of parameters set in PARAMS. If <= 0, the
*> PARAMS array is never referenced and default values are used.
*> \endverbatim
*>
*> \param[in,out] PARAMS
*> \verbatim
*> PARAMS is REAL array, dimension NPARAMS
-*> Specifies algorithm parameters. If an entry is .LT. 0.0, then
+*> Specifies algorithm parameters. If an entry is < 0.0, then
*> that entry will be filled with default value used for that
*> parameter. Only positions up to NPARAMS are accessed; defaults
*> are used for higher-numbered parameters.
@@ -416,9 +416,9 @@
*> PARAMS(LA_LINRX_ITREF_I = 1) : Whether to perform iterative
*> refinement or not.
*> Default: 1.0
-*> = 0.0 : No refinement is performed, and no error bounds are
+*> = 0.0: No refinement is performed, and no error bounds are
*> computed.
-*> = 1.0 : Use the double-precision refinement algorithm,
+*> = 1.0: Use the double-precision refinement algorithm,
*> possibly with doubled-single computations if the
*> compilation environment does not support DOUBLE
*> PRECISION.
diff --git a/lapack-netlib/SRC/cpotrf2.f b/lapack-netlib/SRC/cpotrf2.f
index 789843c41..ed4f12cba 100644
--- a/lapack-netlib/SRC/cpotrf2.f
+++ b/lapack-netlib/SRC/cpotrf2.f
@@ -24,7 +24,7 @@
*>
*> \verbatim
*>
-*> CPOTRF2 computes the Cholesky factorization of a real symmetric
+*> CPOTRF2 computes the Cholesky factorization of a Hermitian
*> positive definite matrix A using the recursive algorithm.
*>
*> The factorization has the form
@@ -63,7 +63,7 @@
*> \param[in,out] A
*> \verbatim
*> A is COMPLEX array, dimension (LDA,N)
-*> On entry, the symmetric matrix A. If UPLO = 'U', the leading
+*> On entry, the Hermitian matrix A. If UPLO = 'U', the leading
*> N-by-N upper triangular part of A contains the upper
*> triangular part of the matrix A, and the strictly lower
*> triangular part of A is not referenced. If UPLO = 'L', the
diff --git a/lapack-netlib/SRC/cstemr.f b/lapack-netlib/SRC/cstemr.f
index 22ac842c9..8fb8131d8 100644
--- a/lapack-netlib/SRC/cstemr.f
+++ b/lapack-netlib/SRC/cstemr.f
@@ -250,13 +250,13 @@
*> \param[in,out] TRYRAC
*> \verbatim
*> TRYRAC is LOGICAL
-*> If TRYRAC.EQ..TRUE., indicates that the code should check whether
+*> If TRYRAC = .TRUE., indicates that the code should check whether
*> the tridiagonal matrix defines its eigenvalues to high relative
*> accuracy. If so, the code uses relative-accuracy preserving
*> algorithms that might be (a bit) slower depending on the matrix.
*> If the matrix does not define its eigenvalues to high relative
*> accuracy, the code can uses possibly faster algorithms.
-*> If TRYRAC.EQ..FALSE., the code is not required to guarantee
+*> If TRYRAC = .FALSE., the code is not required to guarantee
*> relatively accurate eigenvalues and can use the fastest possible
*> techniques.
*> On exit, a .TRUE. TRYRAC will be set to .FALSE. if the matrix
diff --git a/lapack-netlib/SRC/csycon_3.f b/lapack-netlib/SRC/csycon_3.f
index 47d52dd15..5c1cb0491 100644
--- a/lapack-netlib/SRC/csycon_3.f
+++ b/lapack-netlib/SRC/csycon_3.f
@@ -19,7 +19,7 @@
* ===========
*
* SUBROUTINE CSYCON_3( UPLO, N, A, LDA, E, IPIV, ANORM, RCOND,
-* WORK, IWORK, INFO )
+* WORK, INFO )
*
* .. Scalar Arguments ..
* CHARACTER UPLO
@@ -27,7 +27,7 @@
* REAL ANORM, RCOND
* ..
* .. Array Arguments ..
-* INTEGER IPIV( * ), IWORK( * )
+* INTEGER IPIV( * )
* COMPLEX A( LDA, * ), E ( * ), WORK( * )
* ..
*
@@ -129,11 +129,6 @@
*> WORK is COMPLEX array, dimension (2*N)
*> \endverbatim
*>
-*> \param[out] IWORK
-*> \verbatim
-*> IWORK is INTEGER array, dimension (N)
-*> \endverbatim
-*>
*> \param[out] INFO
*> \verbatim
*> INFO is INTEGER
diff --git a/lapack-netlib/SRC/csyconvf.f b/lapack-netlib/SRC/csyconvf.f
index 77ecf46b5..fd5a5e47f 100644
--- a/lapack-netlib/SRC/csyconvf.f
+++ b/lapack-netlib/SRC/csyconvf.f
@@ -294,7 +294,7 @@
*
* Convert PERMUTATIONS and IPIV
*
-* Apply permutaions to submatrices of upper part of A
+* Apply permutations to submatrices of upper part of A
* in factorization order where i decreases from N to 1
*
I = N
@@ -347,7 +347,7 @@
*
* Revert PERMUTATIONS and IPIV
*
-* Apply permutaions to submatrices of upper part of A
+* Apply permutations to submatrices of upper part of A
* in reverse factorization order where i increases from 1 to N
*
I = 1
@@ -438,7 +438,7 @@
*
* Convert PERMUTATIONS and IPIV
*
-* Apply permutaions to submatrices of lower part of A
+* Apply permutations to submatrices of lower part of A
* in factorization order where k increases from 1 to N
*
I = 1
@@ -491,7 +491,7 @@
*
* Revert PERMUTATIONS and IPIV
*
-* Apply permutaions to submatrices of lower part of A
+* Apply permutations to submatrices of lower part of A
* in reverse factorization order where i decreases from N to 1
*
I = N
diff --git a/lapack-netlib/SRC/csyconvf_rook.f b/lapack-netlib/SRC/csyconvf_rook.f
index 1146a97c5..7ede26863 100644
--- a/lapack-netlib/SRC/csyconvf_rook.f
+++ b/lapack-netlib/SRC/csyconvf_rook.f
@@ -285,7 +285,7 @@
*
* Convert PERMUTATIONS
*
-* Apply permutaions to submatrices of upper part of A
+* Apply permutations to submatrices of upper part of A
* in factorization order where i decreases from N to 1
*
I = N
@@ -336,7 +336,7 @@
*
* Revert PERMUTATIONS
*
-* Apply permutaions to submatrices of upper part of A
+* Apply permutations to submatrices of upper part of A
* in reverse factorization order where i increases from 1 to N
*
I = 1
@@ -426,7 +426,7 @@
*
* Convert PERMUTATIONS
*
-* Apply permutaions to submatrices of lower part of A
+* Apply permutations to submatrices of lower part of A
* in factorization order where i increases from 1 to N
*
I = 1
@@ -477,7 +477,7 @@
*
* Revert PERMUTATIONS
*
-* Apply permutaions to submatrices of lower part of A
+* Apply permutations to submatrices of lower part of A
* in reverse factorization order where i decreases from N to 1
*
I = N
diff --git a/lapack-netlib/SRC/csyrfsx.f b/lapack-netlib/SRC/csyrfsx.f
index 7323ba8eb..4d1bc3ccc 100644
--- a/lapack-netlib/SRC/csyrfsx.f
+++ b/lapack-netlib/SRC/csyrfsx.f
@@ -271,7 +271,7 @@
*> information as described below. There currently are up to three
*> pieces of information returned for each right-hand side. If
*> componentwise accuracy is not requested (PARAMS(3) = 0.0), then
-*> ERR_BNDS_COMP is not accessed. If N_ERR_BNDS .LT. 3, then at most
+*> ERR_BNDS_COMP is not accessed. If N_ERR_BNDS < 3, then at most
*> the first (:,N_ERR_BNDS) entries are returned.
*>
*> The first index in ERR_BNDS_COMP(i,:) corresponds to the ith
@@ -307,14 +307,14 @@
*> \param[in] NPARAMS
*> \verbatim
*> NPARAMS is INTEGER
-*> Specifies the number of parameters set in PARAMS. If .LE. 0, the
+*> Specifies the number of parameters set in PARAMS. If <= 0, the
*> PARAMS array is never referenced and default values are used.
*> \endverbatim
*>
*> \param[in,out] PARAMS
*> \verbatim
*> PARAMS is REAL array, dimension NPARAMS
-*> Specifies algorithm parameters. If an entry is .LT. 0.0, then
+*> Specifies algorithm parameters. If an entry is < 0.0, then
*> that entry will be filled with default value used for that
*> parameter. Only positions up to NPARAMS are accessed; defaults
*> are used for higher-numbered parameters.
@@ -322,9 +322,9 @@
*> PARAMS(LA_LINRX_ITREF_I = 1) : Whether to perform iterative
*> refinement or not.
*> Default: 1.0
-*> = 0.0 : No refinement is performed, and no error bounds are
+*> = 0.0: No refinement is performed, and no error bounds are
*> computed.
-*> = 1.0 : Use the double-precision refinement algorithm,
+*> = 1.0: Use the double-precision refinement algorithm,
*> possibly with doubled-single computations if the
*> compilation environment does not support DOUBLE
*> PRECISION.
diff --git a/lapack-netlib/SRC/csysv_aa.f b/lapack-netlib/SRC/csysv_aa.f
index 87be734cc..2081644b1 100644
--- a/lapack-netlib/SRC/csysv_aa.f
+++ b/lapack-netlib/SRC/csysv_aa.f
@@ -42,7 +42,7 @@
*> matrices.
*>
*> Aasen's algorithm is used to factor A as
-*> A = U * T * U**T, if UPLO = 'U', or
+*> A = U**T * T * U, if UPLO = 'U', or
*> A = L * T * L**T, if UPLO = 'L',
*> where U (or L) is a product of permutation and unit upper (lower)
*> triangular matrices, and T is symmetric tridiagonal. The factored
@@ -75,7 +75,7 @@
*>
*> \param[in,out] A
*> \verbatim
-*> A is REAL array, dimension (LDA,N)
+*> A is COMPLEX array, dimension (LDA,N)
*> On entry, the symmetric matrix A. If UPLO = 'U', the leading
*> N-by-N upper triangular part of A contains the upper
*> triangular part of the matrix A, and the strictly lower
@@ -86,7 +86,7 @@
*>
*> On exit, if INFO = 0, the tridiagonal matrix T and the
*> multipliers used to obtain the factor U or L from the
-*> factorization A = U*T*U**T or A = L*T*L**T as computed by
+*> factorization A = U**T*T*U or A = L*T*L**T as computed by
*> CSYTRF.
*> \endverbatim
*>
@@ -106,7 +106,7 @@
*>
*> \param[in,out] B
*> \verbatim
-*> B is REAL array, dimension (LDB,NRHS)
+*> B is COMPLEX array, dimension (LDB,NRHS)
*> On entry, the N-by-NRHS right hand side matrix B.
*> On exit, if INFO = 0, the N-by-NRHS solution matrix X.
*> \endverbatim
@@ -119,7 +119,7 @@
*>
*> \param[out] WORK
*> \verbatim
-*> WORK is REAL array, dimension (MAX(1,LWORK))
+*> WORK is COMPLEX array, dimension (MAX(1,LWORK))
*> On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
*> \endverbatim
*>
@@ -230,7 +230,7 @@
RETURN
END IF
*
-* Compute the factorization A = U*T*U**T or A = L*T*L**T.
+* Compute the factorization A = U**T*T*U or A = L*T*L**T.
*
CALL CSYTRF_AA( UPLO, N, A, LDA, IPIV, WORK, LWORK, INFO )
IF( INFO.EQ.0 ) THEN
diff --git a/lapack-netlib/SRC/csysv_aa_2stage.f b/lapack-netlib/SRC/csysv_aa_2stage.f
index a13349824..c5c328c63 100644
--- a/lapack-netlib/SRC/csysv_aa_2stage.f
+++ b/lapack-netlib/SRC/csysv_aa_2stage.f
@@ -43,8 +43,8 @@
*> matrices.
*>
*> Aasen's 2-stage algorithm is used to factor A as
-*> A = U * T * U**H, if UPLO = 'U', or
-*> A = L * T * L**H, if UPLO = 'L',
+*> A = U**T * T * U, if UPLO = 'U', or
+*> A = L * T * L**T, if UPLO = 'L',
*> where U (or L) is a product of permutation and unit upper (lower)
*> triangular matrices, and T is symmetric and band. The matrix T is
*> then LU-factored with partial pivoting. The factored form of A
@@ -257,7 +257,7 @@
END IF
*
*
-* Compute the factorization A = U*T*U**H or A = L*T*L**H.
+* Compute the factorization A = U**T*T*U or A = L*T*L**T.
*
CALL CSYTRF_AA_2STAGE( UPLO, N, A, LDA, TB, LTB, IPIV, IPIV2,
$ WORK, LWORK, INFO )
diff --git a/lapack-netlib/SRC/csysvxx.f b/lapack-netlib/SRC/csysvxx.f
index 2fd2c8771..7a9aee105 100644
--- a/lapack-netlib/SRC/csysvxx.f
+++ b/lapack-netlib/SRC/csysvxx.f
@@ -378,7 +378,7 @@
*> information as described below. There currently are up to three
*> pieces of information returned for each right-hand side. If
*> componentwise accuracy is not requested (PARAMS(3) = 0.0), then
-*> ERR_BNDS_COMP is not accessed. If N_ERR_BNDS .LT. 3, then at most
+*> ERR_BNDS_COMP is not accessed. If N_ERR_BNDS < 3, then at most
*> the first (:,N_ERR_BNDS) entries are returned.
*>
*> The first index in ERR_BNDS_COMP(i,:) corresponds to the ith
@@ -414,14 +414,14 @@
*> \param[in] NPARAMS
*> \verbatim
*> NPARAMS is INTEGER
-*> Specifies the number of parameters set in PARAMS. If .LE. 0, the
+*> Specifies the number of parameters set in PARAMS. If <= 0, the
*> PARAMS array is never referenced and default values are used.
*> \endverbatim
*>
*> \param[in,out] PARAMS
*> \verbatim
*> PARAMS is REAL array, dimension NPARAMS
-*> Specifies algorithm parameters. If an entry is .LT. 0.0, then
+*> Specifies algorithm parameters. If an entry is < 0.0, then
*> that entry will be filled with default value used for that
*> parameter. Only positions up to NPARAMS are accessed; defaults
*> are used for higher-numbered parameters.
@@ -429,9 +429,9 @@
*> PARAMS(LA_LINRX_ITREF_I = 1) : Whether to perform iterative
*> refinement or not.
*> Default: 1.0
-*> = 0.0 : No refinement is performed, and no error bounds are
+*> = 0.0: No refinement is performed, and no error bounds are
*> computed.
-*> = 1.0 : Use the double-precision refinement algorithm,
+*> = 1.0: Use the double-precision refinement algorithm,
*> possibly with doubled-single computations if the
*> compilation environment does not support DOUBLE
*> PRECISION.
diff --git a/lapack-netlib/SRC/csytf2_rk.f b/lapack-netlib/SRC/csytf2_rk.f
index 3b5e53a03..7e39c2dfd 100644
--- a/lapack-netlib/SRC/csytf2_rk.f
+++ b/lapack-netlib/SRC/csytf2_rk.f
@@ -321,7 +321,7 @@
*
* Factorize A as U*D*U**T using the upper triangle of A
*
-* Initilize the first entry of array E, where superdiagonal
+* Initialize the first entry of array E, where superdiagonal
* elements of D are stored
*
E( 1 ) = CZERO
@@ -632,7 +632,7 @@
*
* Factorize A as L*D*L**T using the lower triangle of A
*
-* Initilize the unused last entry of the subdiagonal array E.
+* Initialize the unused last entry of the subdiagonal array E.
*
E( N ) = CZERO
*
diff --git a/lapack-netlib/SRC/csytrf.f b/lapack-netlib/SRC/csytrf.f
index c389725e9..af913b8f4 100644
--- a/lapack-netlib/SRC/csytrf.f
+++ b/lapack-netlib/SRC/csytrf.f
@@ -43,7 +43,7 @@
*>
*> where U (or L) is a product of permutation and unit upper (lower)
*> triangular matrices, and D is symmetric and block diagonal with
-*> with 1-by-1 and 2-by-2 diagonal blocks.
+*> 1-by-1 and 2-by-2 diagonal blocks.
*>
*> This is the blocked version of the algorithm, calling Level 3 BLAS.
*> \endverbatim
diff --git a/lapack-netlib/SRC/csytrf_aa.f b/lapack-netlib/SRC/csytrf_aa.f
index 2f185b0c7..427235bda 100644
--- a/lapack-netlib/SRC/csytrf_aa.f
+++ b/lapack-netlib/SRC/csytrf_aa.f
@@ -37,7 +37,7 @@
*> CSYTRF_AA computes the factorization of a complex symmetric matrix A
*> using the Aasen's algorithm. The form of the factorization is
*>
-*> A = U*T*U**T or A = L*T*L**T
+*> A = U**T*T*U or A = L*T*L**T
*>
*> where U (or L) is a product of permutation and unit upper (lower)
*> triangular matrices, and T is a complex symmetric tridiagonal matrix.
@@ -63,7 +63,7 @@
*>
*> \param[in,out] A
*> \verbatim
-*> A is REAL array, dimension (LDA,N)
+*> A is COMPLEX array, dimension (LDA,N)
*> On entry, the symmetric matrix A. If UPLO = 'U', the leading
*> N-by-N upper triangular part of A contains the upper
*> triangular part of the matrix A, and the strictly lower
@@ -94,7 +94,7 @@
*>
*> \param[out] WORK
*> \verbatim
-*> WORK is REAL array, dimension (MAX(1,LWORK))
+*> WORK is COMPLEX array, dimension (MAX(1,LWORK))
*> On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
*> \endverbatim
*>
@@ -223,7 +223,7 @@
IF( UPPER ) THEN
*
* .....................................................
-* Factorize A as L*D*L**T using the upper triangle of A
+* Factorize A as U**T*D*U using the upper triangle of A
* .....................................................
*
* Copy first row A(1, 1:N) into H(1:n) (stored in WORK(1:N))
@@ -256,7 +256,7 @@
$ A( MAX(1, J), J+1 ), LDA,
$ IPIV( J+1 ), WORK, N, WORK( N*NB+1 ) )
*
-* Ajust IPIV and apply it back (J-th step picks (J+1)-th pivot)
+* Adjust IPIV and apply it back (J-th step picks (J+1)-th pivot)
*
DO J2 = J+2, MIN(N, J+JB+1)
IPIV( J2 ) = IPIV( J2 ) + J
@@ -375,7 +375,7 @@
$ A( J+1, MAX(1, J) ), LDA,
$ IPIV( J+1 ), WORK, N, WORK( N*NB+1 ) )
*
-* Ajust IPIV and apply it back (J-th step picks (J+1)-th pivot)
+* Adjust IPIV and apply it back (J-th step picks (J+1)-th pivot)
*
DO J2 = J+2, MIN(N, J+JB+1)
IPIV( J2 ) = IPIV( J2 ) + J
diff --git a/lapack-netlib/SRC/csytrf_aa_2stage.f b/lapack-netlib/SRC/csytrf_aa_2stage.f
index 0d0bd156c..0946d61b0 100644
--- a/lapack-netlib/SRC/csytrf_aa_2stage.f
+++ b/lapack-netlib/SRC/csytrf_aa_2stage.f
@@ -38,7 +38,7 @@
*> CSYTRF_AA_2STAGE computes the factorization of a complex symmetric matrix A
*> using the Aasen's algorithm. The form of the factorization is
*>
-*> A = U*T*U**T or A = L*T*L**T
+*> A = U**T*T*U or A = L*T*L**T
*>
*> where U (or L) is a product of permutation and unit upper (lower)
*> triangular matrices, and T is a complex symmetric band matrix with the
@@ -275,7 +275,7 @@
IF( UPPER ) THEN
*
* .....................................................
-* Factorize A as L*D*L**T using the upper triangle of A
+* Factorize A as U**T*D*U using the upper triangle of A
* .....................................................
*
DO J = 0, NT-1
@@ -448,12 +448,14 @@ c END IF
* > Apply pivots to previous columns of L
CALL CSWAP( K-1, A( (J+1)*NB+1, I1 ), 1,
$ A( (J+1)*NB+1, I2 ), 1 )
-* > Swap A(I1+1:M, I1) with A(I2, I1+1:M)
- CALL CSWAP( I2-I1-1, A( I1, I1+1 ), LDA,
- $ A( I1+1, I2 ), 1 )
+* > Swap A(I1+1:M, I1) with A(I2, I1+1:M)
+ IF( I2.GT.(I1+1) )
+ $ CALL CSWAP( I2-I1-1, A( I1, I1+1 ), LDA,
+ $ A( I1+1, I2 ), 1 )
* > Swap A(I2+1:M, I1) with A(I2+1:M, I2)
- CALL CSWAP( N-I2, A( I1, I2+1 ), LDA,
- $ A( I2, I2+1 ), LDA )
+ IF( I2.LT.N )
+ $ CALL CSWAP( N-I2, A( I1, I2+1 ), LDA,
+ $ A( I2, I2+1 ), LDA )
* > Swap A(I1, I1) with A(I2, I2)
PIV = A( I1, I1 )
A( I1, I1 ) = A( I2, I2 )
@@ -637,11 +639,13 @@ c END IF
CALL CSWAP( K-1, A( I1, (J+1)*NB+1 ), LDA,
$ A( I2, (J+1)*NB+1 ), LDA )
* > Swap A(I1+1:M, I1) with A(I2, I1+1:M)
- CALL CSWAP( I2-I1-1, A( I1+1, I1 ), 1,
- $ A( I2, I1+1 ), LDA )
+ IF( I2.GT.(I1+1) )
+ $ CALL CSWAP( I2-I1-1, A( I1+1, I1 ), 1,
+ $ A( I2, I1+1 ), LDA )
* > Swap A(I2+1:M, I1) with A(I2+1:M, I2)
- CALL CSWAP( N-I2, A( I2+1, I1 ), 1,
- $ A( I2+1, I2 ), 1 )
+ IF( I2.LT.N )
+ $ CALL CSWAP( N-I2, A( I2+1, I1 ), 1,
+ $ A( I2+1, I2 ), 1 )
* > Swap A(I1, I1) with A(I2, I2)
PIV = A( I1, I1 )
A( I1, I1 ) = A( I2, I2 )
diff --git a/lapack-netlib/SRC/csytri2.f b/lapack-netlib/SRC/csytri2.f
index 4bd8e4f99..8bee149c4 100644
--- a/lapack-netlib/SRC/csytri2.f
+++ b/lapack-netlib/SRC/csytri2.f
@@ -62,7 +62,7 @@
*> \param[in,out] A
*> \verbatim
*> A is COMPLEX array, dimension (LDA,N)
-*> On entry, the NB diagonal matrix D and the multipliers
+*> On entry, the block diagonal matrix D and the multipliers
*> used to obtain the factor U or L as computed by CSYTRF.
*>
*> On exit, if INFO = 0, the (symmetric) inverse of the original
@@ -82,7 +82,7 @@
*> \param[in] IPIV
*> \verbatim
*> IPIV is INTEGER array, dimension (N)
-*> Details of the interchanges and the NB structure of D
+*> Details of the interchanges and the block structure of D
*> as determined by CSYTRF.
*> \endverbatim
*>
diff --git a/lapack-netlib/SRC/csytrs2.f b/lapack-netlib/SRC/csytrs2.f
index 1002b5461..93f2d6a1b 100644
--- a/lapack-netlib/SRC/csytrs2.f
+++ b/lapack-netlib/SRC/csytrs2.f
@@ -36,7 +36,7 @@
*>
*> \verbatim
*>
-*> CSYTRS2 solves a system of linear equations A*X = B with a COMPLEX
+*> CSYTRS2 solves a system of linear equations A*X = B with a complex
*> symmetric matrix A using the factorization A = U*D*U**T or
*> A = L*D*L**T computed by CSYTRF and converted by CSYCONV.
*> \endverbatim
diff --git a/lapack-netlib/SRC/csytrs_aa.f b/lapack-netlib/SRC/csytrs_aa.f
index 7cf950492..981f8722a 100644
--- a/lapack-netlib/SRC/csytrs_aa.f
+++ b/lapack-netlib/SRC/csytrs_aa.f
@@ -37,7 +37,7 @@
*> \verbatim
*>
*> CSYTRS_AA solves a system of linear equations A*X = B with a complex
-*> symmetric matrix A using the factorization A = U*T*U**T or
+*> symmetric matrix A using the factorization A = U**T*T*U or
*> A = L*T*L**T computed by CSYTRF_AA.
*> \endverbatim
*
@@ -49,7 +49,7 @@
*> UPLO is CHARACTER*1
*> Specifies whether the details of the factorization are stored
*> as an upper or lower triangular matrix.
-*> = 'U': Upper triangular, form is A = U*T*U**T;
+*> = 'U': Upper triangular, form is A = U**T*T*U;
*> = 'L': Lower triangular, form is A = L*T*L**T.
*> \endverbatim
*>
@@ -68,7 +68,7 @@
*>
*> \param[in] A
*> \verbatim
-*> A is REAL array, dimension (LDA,N)
+*> A is COMPLEX array, dimension (LDA,N)
*> Details of factors computed by CSYTRF_AA.
*> \endverbatim
*>
@@ -86,7 +86,7 @@
*>
*> \param[in,out] B
*> \verbatim
-*> B is REAL array, dimension (LDB,NRHS)
+*> B is COMPLEX array, dimension (LDB,NRHS)
*> On entry, the right hand side matrix B.
*> On exit, the solution matrix X.
*> \endverbatim
@@ -97,14 +97,16 @@
*> The leading dimension of the array B. LDB >= max(1,N).
*> \endverbatim
*>
-*> \param[in] WORK
+*> \param[out] WORK
*> \verbatim
-*> WORK is DOUBLE array, dimension (MAX(1,LWORK))
+*> WORK is COMPLEX array, dimension (MAX(1,LWORK))
*> \endverbatim
*>
*> \param[in] LWORK
*> \verbatim
-*> LWORK is INTEGER, LWORK >= MAX(1,3*N-2).
+*> LWORK is INTEGER
+*> The dimension of the array WORK. LWORK >= max(1,3*N-2).
+*> \endverbatim
*>
*> \param[out] INFO
*> \verbatim
@@ -198,22 +200,29 @@
*
IF( UPPER ) THEN
*
-* Solve A*X = B, where A = U*T*U**T.
+* Solve A*X = B, where A = U**T*T*U.
*
-* Pivot, P**T * B
+* 1) Forward substitution with U**T
*
- DO K = 1, N
- KP = IPIV( K )
- IF( KP.NE.K )
- $ CALL CSWAP( NRHS, B( K, 1 ), LDB, B( KP, 1 ), LDB )
- END DO
+ IF( N.GT.1 ) THEN
*
-* Compute (U \P**T * B) -> B [ (U \P**T * B) ]
+* Pivot, P**T * B -> B
*
- CALL CTRSM('L', 'U', 'T', 'U', N-1, NRHS, ONE, A( 1, 2 ), LDA,
- $ B( 2, 1 ), LDB)
+ DO K = 1, N
+ KP = IPIV( K )
+ IF( KP.NE.K )
+ $ CALL CSWAP( NRHS, B( K, 1 ), LDB, B( KP, 1 ), LDB )
+ END DO
*
-* Compute T \ B -> B [ T \ (U \P**T * B) ]
+* Compute U**T \ B -> B [ (U**T \P**T * B) ]
+*
+ CALL CTRSM( 'L', 'U', 'T', 'U', N-1, NRHS, ONE, A( 1, 2 ),
+ $ LDA, B( 2, 1 ), LDB)
+ END IF
+*
+* 2) Solve with triangular matrix T
+*
+* Compute T \ B -> B [ T \ (U**T \P**T * B) ]
*
CALL CLACPY( 'F', 1, N, A( 1, 1 ), LDA+1, WORK( N ), 1)
IF( N.GT.1 ) THEN
@@ -223,35 +232,48 @@
CALL CGTSV( N, NRHS, WORK( 1 ), WORK( N ), WORK( 2*N ), B, LDB,
$ INFO )
*
-* Compute (U**T \ B) -> B [ U**T \ (T \ (U \P**T * B) ) ]
+* 3) Backward substitution with U
*
- CALL CTRSM( 'L', 'U', 'N', 'U', N-1, NRHS, ONE, A( 1, 2 ), LDA,
- $ B( 2, 1 ), LDB)
+ IF( N.GT.1 ) THEN
*
-* Pivot, P * B [ P * (U**T \ (T \ (U \P**T * B) )) ]
+* Compute U \ B -> B [ U \ (T \ (U**T \P**T * B) ) ]
*
- DO K = N, 1, -1
- KP = IPIV( K )
- IF( KP.NE.K )
- $ CALL CSWAP( NRHS, B( K, 1 ), LDB, B( KP, 1 ), LDB )
- END DO
+ CALL CTRSM( 'L', 'U', 'N', 'U', N-1, NRHS, ONE, A( 1, 2 ),
+ $ LDA, B( 2, 1 ), LDB)
+*
+* Pivot, P * B -> B [ P * (U**T \ (T \ (U \P**T * B) )) ]
+*
+ DO K = N, 1, -1
+ KP = IPIV( K )
+ IF( KP.NE.K )
+ $ CALL CSWAP( NRHS, B( K, 1 ), LDB, B( KP, 1 ), LDB )
+ END DO
+ END IF
*
ELSE
*
* Solve A*X = B, where A = L*T*L**T.
*
-* Pivot, P**T * B
+* 1) Forward substitution with L
*
- DO K = 1, N
- KP = IPIV( K )
- IF( KP.NE.K )
- $ CALL CSWAP( NRHS, B( K, 1 ), LDB, B( KP, 1 ), LDB )
- END DO
+ IF( N.GT.1 ) THEN
*
-* Compute (L \P**T * B) -> B [ (L \P**T * B) ]
+* Pivot, P**T * B -> B
+*
+ DO K = 1, N
+ KP = IPIV( K )
+ IF( KP.NE.K )
+ $ CALL CSWAP( NRHS, B( K, 1 ), LDB, B( KP, 1 ), LDB )
+ END DO
+*
+* Compute L \ B -> B [ (L \P**T * B) ]
+*
+ CALL CTRSM( 'L', 'L', 'N', 'U', N-1, NRHS, ONE, A( 2, 1 ),
+ $ LDA, B( 2, 1 ), LDB)
+ END IF
+*
+* 2) Solve with triangular matrix T
*
- CALL CTRSM( 'L', 'L', 'N', 'U', N-1, NRHS, ONE, A( 2, 1 ), LDA,
- $ B( 2, 1 ), LDB)
*
* Compute T \ B -> B [ T \ (L \P**T * B) ]
*
@@ -263,18 +285,23 @@
CALL CGTSV( N, NRHS, WORK( 1 ), WORK(N), WORK( 2*N ), B, LDB,
$ INFO)
*
-* Compute (L**T \ B) -> B [ L**T \ (T \ (L \P**T * B) ) ]
+* 3) Backward substitution with L**T
*
- CALL CTRSM( 'L', 'L', 'T', 'U', N-1, NRHS, ONE, A( 2, 1 ), LDA,
- $ B( 2, 1 ), LDB)
+ IF( N.GT.1 ) THEN
*
-* Pivot, P * B [ P * (L**T \ (T \ (L \P**T * B) )) ]
+* Compute (L**T \ B) -> B [ L**T \ (T \ (L \P**T * B) ) ]
*
- DO K = N, 1, -1
- KP = IPIV( K )
- IF( KP.NE.K )
- $ CALL CSWAP( NRHS, B( K, 1 ), LDB, B( KP, 1 ), LDB )
- END DO
+ CALL CTRSM( 'L', 'L', 'T', 'U', N-1, NRHS, ONE, A( 2, 1 ),
+ $ LDA, B( 2, 1 ), LDB)
+*
+* Pivot, P * B -> B [ P * (L**T \ (T \ (L \P**T * B) )) ]
+*
+ DO K = N, 1, -1
+ KP = IPIV( K )
+ IF( KP.NE.K )
+ $ CALL CSWAP( NRHS, B( K, 1 ), LDB, B( KP, 1 ), LDB )
+ END DO
+ END IF
*
END IF
*
diff --git a/lapack-netlib/SRC/csytrs_aa_2stage.f b/lapack-netlib/SRC/csytrs_aa_2stage.f
index d025c08fe..581910933 100644
--- a/lapack-netlib/SRC/csytrs_aa_2stage.f
+++ b/lapack-netlib/SRC/csytrs_aa_2stage.f
@@ -36,7 +36,7 @@
*> \verbatim
*>
*> CSYTRS_AA_2STAGE solves a system of linear equations A*X = B with a complex
-*> symmetric matrix A using the factorization A = U*T*U**T or
+*> symmetric matrix A using the factorization A = U**T*T*U or
*> A = L*T*L**T computed by CSYTRF_AA_2STAGE.
*> \endverbatim
*
@@ -48,7 +48,7 @@
*> UPLO is CHARACTER*1
*> Specifies whether the details of the factorization are stored
*> as an upper or lower triangular matrix.
-*> = 'U': Upper triangular, form is A = U*T*U**T;
+*> = 'U': Upper triangular, form is A = U**T*T*U;
*> = 'L': Lower triangular, form is A = L*T*L**T.
*> \endverbatim
*>
@@ -208,15 +208,15 @@
*
IF( UPPER ) THEN
*
-* Solve A*X = B, where A = U*T*U**T.
+* Solve A*X = B, where A = U**T*T*U.
*
IF( N.GT.NB ) THEN
*
-* Pivot, P**T * B
+* Pivot, P**T * B -> B
*
CALL CLASWP( NRHS, B, LDB, NB+1, N, IPIV, 1 )
*
-* Compute (U**T \P**T * B) -> B [ (U**T \P**T * B) ]
+* Compute (U**T \ B) -> B [ (U**T \P**T * B) ]
*
CALL CTRSM( 'L', 'U', 'T', 'U', N-NB, NRHS, ONE, A(1, NB+1),
$ LDA, B(NB+1, 1), LDB)
@@ -234,7 +234,7 @@
CALL CTRSM( 'L', 'U', 'N', 'U', N-NB, NRHS, ONE, A(1, NB+1),
$ LDA, B(NB+1, 1), LDB)
*
-* Pivot, P * B [ P * (U \ (T \ (U**T \P**T * B) )) ]
+* Pivot, P * B -> B [ P * (U \ (T \ (U**T \P**T * B) )) ]
*
CALL CLASWP( NRHS, B, LDB, NB+1, N, IPIV, -1 )
*
@@ -246,11 +246,11 @@
*
IF( N.GT.NB ) THEN
*
-* Pivot, P**T * B
+* Pivot, P**T * B -> B
*
CALL CLASWP( NRHS, B, LDB, NB+1, N, IPIV, 1 )
*
-* Compute (L \P**T * B) -> B [ (L \P**T * B) ]
+* Compute (L \ B) -> B [ (L \P**T * B) ]
*
CALL CTRSM( 'L', 'L', 'N', 'U', N-NB, NRHS, ONE, A(NB+1, 1),
$ LDA, B(NB+1, 1), LDB)
@@ -268,7 +268,7 @@
CALL CTRSM( 'L', 'L', 'T', 'U', N-NB, NRHS, ONE, A(NB+1, 1),
$ LDA, B(NB+1, 1), LDB)
*
-* Pivot, P * B [ P * (L**T \ (T \ (L \P**T * B) )) ]
+* Pivot, P * B -> B [ P * (L**T \ (T \ (L \P**T * B) )) ]
*
CALL CLASWP( NRHS, B, LDB, NB+1, N, IPIV, -1 )
*
diff --git a/lapack-netlib/SRC/ctgsy2.f b/lapack-netlib/SRC/ctgsy2.f
index 66a8980d0..5ccdfb1e1 100644
--- a/lapack-netlib/SRC/ctgsy2.f
+++ b/lapack-netlib/SRC/ctgsy2.f
@@ -67,7 +67,7 @@
*> R * B**H + L * E**H = scale * -F
*>
*> This case is used to compute an estimate of Dif[(A, D), (B, E)] =
-*> = sigma_min(Z) using reverse communicaton with CLACON.
+*> = sigma_min(Z) using reverse communication with CLACON.
*>
*> CTGSY2 also (IJOB >= 1) contributes to the computation in CTGSYL
*> of an upper bound on the separation between to matrix pairs. Then
@@ -81,7 +81,7 @@
*> \param[in] TRANS
*> \verbatim
*> TRANS is CHARACTER*1
-*> = 'N', solve the generalized Sylvester equation (1).
+*> = 'N': solve the generalized Sylvester equation (1).
*> = 'T': solve the 'transposed' system (3).
*> \endverbatim
*>
@@ -89,13 +89,13 @@
*> \verbatim
*> IJOB is INTEGER
*> Specifies what kind of functionality to be performed.
-*> =0: solve (1) only.
-*> =1: A contribution from this subsystem to a Frobenius
-*> norm-based estimate of the separation between two matrix
-*> pairs is computed. (look ahead strategy is used).
-*> =2: A contribution from this subsystem to a Frobenius
-*> norm-based estimate of the separation between two matrix
-*> pairs is computed. (SGECON on sub-systems is used.)
+*> = 0: solve (1) only.
+*> = 1: A contribution from this subsystem to a Frobenius
+*> norm-based estimate of the separation between two matrix
+*> pairs is computed. (look ahead strategy is used).
+*> = 2: A contribution from this subsystem to a Frobenius
+*> norm-based estimate of the separation between two matrix
+*> pairs is computed. (SGECON on sub-systems is used.)
*> Not referenced if TRANS = 'T'.
*> \endverbatim
*>
diff --git a/lapack-netlib/SRC/ctplqt.f b/lapack-netlib/SRC/ctplqt.f
index cb4d419b9..39893df48 100644
--- a/lapack-netlib/SRC/ctplqt.f
+++ b/lapack-netlib/SRC/ctplqt.f
@@ -1,3 +1,5 @@
+*> \brief \b CTPLQT
+*
* Definition:
* ===========
*
diff --git a/lapack-netlib/SRC/ctplqt2.f b/lapack-netlib/SRC/ctplqt2.f
index b16d6149a..d18452aec 100644
--- a/lapack-netlib/SRC/ctplqt2.f
+++ b/lapack-netlib/SRC/ctplqt2.f
@@ -1,3 +1,5 @@
+*> \brief \b CTPLQT2
+*
* Definition:
* ===========
*
diff --git a/lapack-netlib/SRC/ctpmlqt.f b/lapack-netlib/SRC/ctpmlqt.f
index cb5f033ca..5899a5335 100644
--- a/lapack-netlib/SRC/ctpmlqt.f
+++ b/lapack-netlib/SRC/ctpmlqt.f
@@ -1,3 +1,5 @@
+*> \brief \b CTPMLQT
+*
* Definition:
* ===========
*
@@ -77,7 +79,7 @@
*>
*> \param[in] V
*> \verbatim
-*> V is COMPLEX array, dimension (LDA,K)
+*> V is COMPLEX array, dimension (LDV,K)
*> The i-th row must contain the vector which defines the
*> elementary reflector H(i), for i = 1,2,...,k, as returned by
*> DTPLQT in B. See Further Details.
diff --git a/lapack-netlib/SRC/ctpmqrt.f b/lapack-netlib/SRC/ctpmqrt.f
index fd3d1b109..8d4a36ca8 100644
--- a/lapack-netlib/SRC/ctpmqrt.f
+++ b/lapack-netlib/SRC/ctpmqrt.f
@@ -94,7 +94,7 @@
*>
*> \param[in] V
*> \verbatim
-*> V is COMPLEX array, dimension (LDA,K)
+*> V is COMPLEX array, dimension (LDV,K)
*> The i-th column must contain the vector which defines the
*> elementary reflector H(i), for i = 1,2,...,k, as returned by
*> CTPQRT in B. See Further Details.
diff --git a/lapack-netlib/SRC/ctprfb.f b/lapack-netlib/SRC/ctprfb.f
index 1538deb56..0f45edaf8 100644
--- a/lapack-netlib/SRC/ctprfb.f
+++ b/lapack-netlib/SRC/ctprfb.f
@@ -152,8 +152,8 @@
*> \verbatim
*> LDA is INTEGER
*> The leading dimension of the array A.
-*> If SIDE = 'L', LDC >= max(1,K);
-*> If SIDE = 'R', LDC >= max(1,M).
+*> If SIDE = 'L', LDA >= max(1,K);
+*> If SIDE = 'R', LDA >= max(1,M).
*> \endverbatim
*>
*> \param[in,out] B
diff --git a/lapack-netlib/SRC/cungtsqr.f b/lapack-netlib/SRC/cungtsqr.f
new file mode 100644
index 000000000..bc5305cf9
--- /dev/null
+++ b/lapack-netlib/SRC/cungtsqr.f
@@ -0,0 +1,307 @@
+*> \brief \b CUNGTSQR
+*
+* =========== DOCUMENTATION ===========
+*
+* Online html documentation available at
+* http://www.netlib.org/lapack/explore-html/
+*
+*> \htmlonly
+*> Download CUNGTSQR + dependencies
+*>
+*> [TGZ]
+*>
+*> [ZIP]
+*>
+*> [TXT]
+*>
+* Definition:
+* ===========
+*
+* SUBROUTINE CUNGTSQR( M, N, MB, NB, A, LDA, T, LDT, WORK, LWORK,
+* $ INFO )
+*
+* .. Scalar Arguments ..
+* INTEGER INFO, LDA, LDT, LWORK, M, N, MB, NB
+* ..
+* .. Array Arguments ..
+* COMPLEX A( LDA, * ), T( LDT, * ), WORK( * )
+* ..
+*
+*> \par Purpose:
+* =============
+*>
+*> \verbatim
+*>
+*> CUNGTSQR generates an M-by-N complex matrix Q_out with orthonormal
+*> columns, which are the first N columns of a product of comlpex unitary
+*> matrices of order M which are returned by CLATSQR
+*>
+*> Q_out = first_N_columns_of( Q(1)_in * Q(2)_in * ... * Q(k)_in ).
+*>
+*> See the documentation for CLATSQR.
+*> \endverbatim
+*
+* Arguments:
+* ==========
+*
+*> \param[in] M
+*> \verbatim
+*> M is INTEGER
+*> The number of rows of the matrix A. M >= 0.
+*> \endverbatim
+*>
+*> \param[in] N
+*> \verbatim
+*> N is INTEGER
+*> The number of columns of the matrix A. M >= N >= 0.
+*> \endverbatim
+*>
+*> \param[in] MB
+*> \verbatim
+*> MB is INTEGER
+*> The row block size used by DLATSQR to return
+*> arrays A and T. MB > N.
+*> (Note that if MB > M, then M is used instead of MB
+*> as the row block size).
+*> \endverbatim
+*>
+*> \param[in] NB
+*> \verbatim
+*> NB is INTEGER
+*> The column block size used by CLATSQR to return
+*> arrays A and T. NB >= 1.
+*> (Note that if NB > N, then N is used instead of NB
+*> as the column block size).
+*> \endverbatim
+*>
+*> \param[in,out] A
+*> \verbatim
+*> A is COMPLEX array, dimension (LDA,N)
+*>
+*> On entry:
+*>
+*> The elements on and above the diagonal are not accessed.
+*> The elements below the diagonal represent the unit
+*> lower-trapezoidal blocked matrix V computed by CLATSQR
+*> that defines the input matrices Q_in(k) (ones on the
+*> diagonal are not stored) (same format as the output A
+*> below the diagonal in CLATSQR).
+*>
+*> On exit:
+*>
+*> The array A contains an M-by-N orthonormal matrix Q_out,
+*> i.e the columns of A are orthogonal unit vectors.
+*> \endverbatim
+*>
+*> \param[in] LDA
+*> \verbatim
+*> LDA is INTEGER
+*> The leading dimension of the array A. LDA >= max(1,M).
+*> \endverbatim
+*>
+*> \param[in] T
+*> \verbatim
+*> T is COMPLEX array,
+*> dimension (LDT, N * NIRB)
+*> where NIRB = Number_of_input_row_blocks
+*> = MAX( 1, CEIL((M-N)/(MB-N)) )
+*> Let NICB = Number_of_input_col_blocks
+*> = CEIL(N/NB)
+*>
+*> The upper-triangular block reflectors used to define the
+*> input matrices Q_in(k), k=(1:NIRB*NICB). The block
+*> reflectors are stored in compact form in NIRB block
+*> reflector sequences. Each of NIRB block reflector sequences
+*> is stored in a larger NB-by-N column block of T and consists
+*> of NICB smaller NB-by-NB upper-triangular column blocks.
+*> (same format as the output T in CLATSQR).
+*> \endverbatim
+*>
+*> \param[in] LDT
+*> \verbatim
+*> LDT is INTEGER
+*> The leading dimension of the array T.
+*> LDT >= max(1,min(NB1,N)).
+*> \endverbatim
+*>
+*> \param[out] WORK
+*> \verbatim
+*> (workspace) COMPLEX array, dimension (MAX(2,LWORK))
+*> On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
+*> \endverbatim
+*>
+*> \param[in] LWORK
+*> \verbatim
+*> The dimension of the array WORK. LWORK >= (M+NB)*N.
+*> If LWORK = -1, then a workspace query is assumed.
+*> The routine only calculates the optimal size of the WORK
+*> array, returns this value as the first entry of the WORK
+*> array, and no error message related to LWORK is issued
+*> by XERBLA.
+*> \endverbatim
+*>
+*> \param[out] INFO
+*> \verbatim
+*> INFO is INTEGER
+*> = 0: successful exit
+*> < 0: if INFO = -i, the i-th argument had an illegal value
+*> \endverbatim
+*>
+* Authors:
+* ========
+*
+*> \author Univ. of Tennessee
+*> \author Univ. of California Berkeley
+*> \author Univ. of Colorado Denver
+*> \author NAG Ltd.
+*
+*> \date November 2019
+*
+*> \ingroup comlexOTHERcomputational
+*
+*> \par Contributors:
+* ==================
+*>
+*> \verbatim
+*>
+*> November 2019, Igor Kozachenko,
+*> Computer Science Division,
+*> University of California, Berkeley
+*>
+*> \endverbatim
+*
+* =====================================================================
+ SUBROUTINE CUNGTSQR( M, N, MB, NB, A, LDA, T, LDT, WORK, LWORK,
+ $ INFO )
+ IMPLICIT NONE
+*
+* -- LAPACK computational routine (version 3.9.0) --
+* -- LAPACK is a software package provided by Univ. of Tennessee, --
+* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
+* November 2019
+*
+* .. Scalar Arguments ..
+ INTEGER INFO, LDA, LDT, LWORK, M, N, MB, NB
+* ..
+* .. Array Arguments ..
+ COMPLEX A( LDA, * ), T( LDT, * ), WORK( * )
+* ..
+*
+* =====================================================================
+*
+* .. Parameters ..
+ COMPLEX CONE, CZERO
+ PARAMETER ( CONE = ( 1.0E+0, 0.0E+0 ),
+ $ CZERO = ( 0.0E+0, 0.0E+0 ) )
+* ..
+* .. Local Scalars ..
+ LOGICAL LQUERY
+ INTEGER IINFO, LDC, LWORKOPT, LC, LW, NBLOCAL, J
+* ..
+* .. External Subroutines ..
+ EXTERNAL CCOPY, CLAMTSQR, CLASET, XERBLA
+* ..
+* .. Intrinsic Functions ..
+ INTRINSIC CMPLX, MAX, MIN
+* ..
+* .. Executable Statements ..
+*
+* Test the input parameters
+*
+ LQUERY = LWORK.EQ.-1
+ INFO = 0
+ IF( M.LT.0 ) THEN
+ INFO = -1
+ ELSE IF( N.LT.0 .OR. M.LT.N ) THEN
+ INFO = -2
+ ELSE IF( MB.LE.N ) THEN
+ INFO = -3
+ ELSE IF( NB.LT.1 ) THEN
+ INFO = -4
+ ELSE IF( LDA.LT.MAX( 1, M ) ) THEN
+ INFO = -6
+ ELSE IF( LDT.LT.MAX( 1, MIN( NB, N ) ) ) THEN
+ INFO = -8
+ ELSE
+*
+* Test the input LWORK for the dimension of the array WORK.
+* This workspace is used to store array C(LDC, N) and WORK(LWORK)
+* in the call to CLAMTSQR. See the documentation for CLAMTSQR.
+*
+ IF( LWORK.LT.2 .AND. (.NOT.LQUERY) ) THEN
+ INFO = -10
+ ELSE
+*
+* Set block size for column blocks
+*
+ NBLOCAL = MIN( NB, N )
+*
+* LWORK = -1, then set the size for the array C(LDC,N)
+* in CLAMTSQR call and set the optimal size of the work array
+* WORK(LWORK) in CLAMTSQR call.
+*
+ LDC = M
+ LC = LDC*N
+ LW = N * NBLOCAL
+*
+ LWORKOPT = LC+LW
+*
+ IF( ( LWORK.LT.MAX( 1, LWORKOPT ) ).AND.(.NOT.LQUERY) ) THEN
+ INFO = -10
+ END IF
+ END IF
+*
+ END IF
+*
+* Handle error in the input parameters and return workspace query.
+*
+ IF( INFO.NE.0 ) THEN
+ CALL XERBLA( 'CUNGTSQR', -INFO )
+ RETURN
+ ELSE IF ( LQUERY ) THEN
+ WORK( 1 ) = CMPLX( LWORKOPT )
+ RETURN
+ END IF
+*
+* Quick return if possible
+*
+ IF( MIN( M, N ).EQ.0 ) THEN
+ WORK( 1 ) = CMPLX( LWORKOPT )
+ RETURN
+ END IF
+*
+* (1) Form explicitly the tall-skinny M-by-N left submatrix Q1_in
+* of M-by-M orthogonal matrix Q_in, which is implicitly stored in
+* the subdiagonal part of input array A and in the input array T.
+* Perform by the following operation using the routine CLAMTSQR.
+*
+* Q1_in = Q_in * ( I ), where I is a N-by-N identity matrix,
+* ( 0 ) 0 is a (M-N)-by-N zero matrix.
+*
+* (1a) Form M-by-N matrix in the array WORK(1:LDC*N) with ones
+* on the diagonal and zeros elsewhere.
+*
+ CALL CLASET( 'F', M, N, CZERO, CONE, WORK, LDC )
+*
+* (1b) On input, WORK(1:LDC*N) stores ( I );
+* ( 0 )
+*
+* On output, WORK(1:LDC*N) stores Q1_in.
+*
+ CALL CLAMTSQR( 'L', 'N', M, N, N, MB, NBLOCAL, A, LDA, T, LDT,
+ $ WORK, LDC, WORK( LC+1 ), LW, IINFO )
+*
+* (2) Copy the result from the part of the work array (1:M,1:N)
+* with the leading dimension LDC that starts at WORK(1) into
+* the output array A(1:M,1:N) column-by-column.
+*
+ DO J = 1, N
+ CALL CCOPY( M, WORK( (J-1)*LDC + 1 ), 1, A( 1, J ), 1 )
+ END DO
+*
+ WORK( 1 ) = CMPLX( LWORKOPT )
+ RETURN
+*
+* End of CUNGTSQR
+*
+ END
\ No newline at end of file
diff --git a/lapack-netlib/SRC/cunhr_col.f b/lapack-netlib/SRC/cunhr_col.f
new file mode 100644
index 000000000..15c31491e
--- /dev/null
+++ b/lapack-netlib/SRC/cunhr_col.f
@@ -0,0 +1,441 @@
+*> \brief \b CUNHR_COL
+*
+* =========== DOCUMENTATION ===========
+*
+* Online html documentation available at
+* http://www.netlib.org/lapack/explore-html/
+*
+*> \htmlonly
+*> Download CUNHR_COL + dependencies
+*>
+*> [TGZ]
+*>
+*> [ZIP]
+*>
+*> [TXT]
+*>
+* Definition:
+* ===========
+*
+* SUBROUTINE CUNHR_COL( M, N, NB, A, LDA, T, LDT, D, INFO )
+*
+* .. Scalar Arguments ..
+* INTEGER INFO, LDA, LDT, M, N, NB
+* ..
+* .. Array Arguments ..
+* COMPLEX A( LDA, * ), D( * ), T( LDT, * )
+* ..
+*
+*> \par Purpose:
+* =============
+*>
+*> \verbatim
+*>
+*> CUNHR_COL takes an M-by-N complex matrix Q_in with orthonormal columns
+*> as input, stored in A, and performs Householder Reconstruction (HR),
+*> i.e. reconstructs Householder vectors V(i) implicitly representing
+*> another M-by-N matrix Q_out, with the property that Q_in = Q_out*S,
+*> where S is an N-by-N diagonal matrix with diagonal entries
+*> equal to +1 or -1. The Householder vectors (columns V(i) of V) are
+*> stored in A on output, and the diagonal entries of S are stored in D.
+*> Block reflectors are also returned in T
+*> (same output format as CGEQRT).
+*> \endverbatim
+*
+* Arguments:
+* ==========
+*
+*> \param[in] M
+*> \verbatim
+*> M is INTEGER
+*> The number of rows of the matrix A. M >= 0.
+*> \endverbatim
+*>
+*> \param[in] N
+*> \verbatim
+*> N is INTEGER
+*> The number of columns of the matrix A. M >= N >= 0.
+*> \endverbatim
+*>
+*> \param[in] NB
+*> \verbatim
+*> NB is INTEGER
+*> The column block size to be used in the reconstruction
+*> of Householder column vector blocks in the array A and
+*> corresponding block reflectors in the array T. NB >= 1.
+*> (Note that if NB > N, then N is used instead of NB
+*> as the column block size.)
+*> \endverbatim
+*>
+*> \param[in,out] A
+*> \verbatim
+*> A is COMPLEX array, dimension (LDA,N)
+*>
+*> On entry:
+*>
+*> The array A contains an M-by-N orthonormal matrix Q_in,
+*> i.e the columns of A are orthogonal unit vectors.
+*>
+*> On exit:
+*>
+*> The elements below the diagonal of A represent the unit
+*> lower-trapezoidal matrix V of Householder column vectors
+*> V(i). The unit diagonal entries of V are not stored
+*> (same format as the output below the diagonal in A from
+*> CGEQRT). The matrix T and the matrix V stored on output
+*> in A implicitly define Q_out.
+*>
+*> The elements above the diagonal contain the factor U
+*> of the "modified" LU-decomposition:
+*> Q_in - ( S ) = V * U
+*> ( 0 )
+*> where 0 is a (M-N)-by-(M-N) zero matrix.
+*> \endverbatim
+*>
+*> \param[in] LDA
+*> \verbatim
+*> LDA is INTEGER
+*> The leading dimension of the array A. LDA >= max(1,M).
+*> \endverbatim
+*>
+*> \param[out] T
+*> \verbatim
+*> T is COMPLEX array,
+*> dimension (LDT, N)
+*>
+*> Let NOCB = Number_of_output_col_blocks
+*> = CEIL(N/NB)
+*>
+*> On exit, T(1:NB, 1:N) contains NOCB upper-triangular
+*> block reflectors used to define Q_out stored in compact
+*> form as a sequence of upper-triangular NB-by-NB column
+*> blocks (same format as the output T in CGEQRT).
+*> The matrix T and the matrix V stored on output in A
+*> implicitly define Q_out. NOTE: The lower triangles
+*> below the upper-triangular blcoks will be filled with
+*> zeros. See Further Details.
+*> \endverbatim
+*>
+*> \param[in] LDT
+*> \verbatim
+*> LDT is INTEGER
+*> The leading dimension of the array T.
+*> LDT >= max(1,min(NB,N)).
+*> \endverbatim
+*>
+*> \param[out] D
+*> \verbatim
+*> D is COMPLEX array, dimension min(M,N).
+*> The elements can be only plus or minus one.
+*>
+*> D(i) is constructed as D(i) = -SIGN(Q_in_i(i,i)), where
+*> 1 <= i <= min(M,N), and Q_in_i is Q_in after performing
+*> i-1 steps of “modified” Gaussian elimination.
+*> See Further Details.
+*> \endverbatim
+*>
+*> \param[out] INFO
+*> \verbatim
+*> INFO is INTEGER
+*> = 0: successful exit
+*> < 0: if INFO = -i, the i-th argument had an illegal value
+*> \endverbatim
+*>
+*> \par Further Details:
+* =====================
+*>
+*> \verbatim
+*>
+*> The computed M-by-M unitary factor Q_out is defined implicitly as
+*> a product of unitary matrices Q_out(i). Each Q_out(i) is stored in
+*> the compact WY-representation format in the corresponding blocks of
+*> matrices V (stored in A) and T.
+*>
+*> The M-by-N unit lower-trapezoidal matrix V stored in the M-by-N
+*> matrix A contains the column vectors V(i) in NB-size column
+*> blocks VB(j). For example, VB(1) contains the columns
+*> V(1), V(2), ... V(NB). NOTE: The unit entries on
+*> the diagonal of Y are not stored in A.
+*>
+*> The number of column blocks is
+*>
+*> NOCB = Number_of_output_col_blocks = CEIL(N/NB)
+*>
+*> where each block is of order NB except for the last block, which
+*> is of order LAST_NB = N - (NOCB-1)*NB.
+*>
+*> For example, if M=6, N=5 and NB=2, the matrix V is
+*>
+*>
+*> V = ( VB(1), VB(2), VB(3) ) =
+*>
+*> = ( 1 )
+*> ( v21 1 )
+*> ( v31 v32 1 )
+*> ( v41 v42 v43 1 )
+*> ( v51 v52 v53 v54 1 )
+*> ( v61 v62 v63 v54 v65 )
+*>
+*>
+*> For each of the column blocks VB(i), an upper-triangular block
+*> reflector TB(i) is computed. These blocks are stored as
+*> a sequence of upper-triangular column blocks in the NB-by-N
+*> matrix T. The size of each TB(i) block is NB-by-NB, except
+*> for the last block, whose size is LAST_NB-by-LAST_NB.
+*>
+*> For example, if M=6, N=5 and NB=2, the matrix T is
+*>
+*> T = ( TB(1), TB(2), TB(3) ) =
+*>
+*> = ( t11 t12 t13 t14 t15 )
+*> ( t22 t24 )
+*>
+*>
+*> The M-by-M factor Q_out is given as a product of NOCB
+*> unitary M-by-M matrices Q_out(i).
+*>
+*> Q_out = Q_out(1) * Q_out(2) * ... * Q_out(NOCB),
+*>
+*> where each matrix Q_out(i) is given by the WY-representation
+*> using corresponding blocks from the matrices V and T:
+*>
+*> Q_out(i) = I - VB(i) * TB(i) * (VB(i))**T,
+*>
+*> where I is the identity matrix. Here is the formula with matrix
+*> dimensions:
+*>
+*> Q(i){M-by-M} = I{M-by-M} -
+*> VB(i){M-by-INB} * TB(i){INB-by-INB} * (VB(i))**T {INB-by-M},
+*>
+*> where INB = NB, except for the last block NOCB
+*> for which INB=LAST_NB.
+*>
+*> =====
+*> NOTE:
+*> =====
+*>
+*> If Q_in is the result of doing a QR factorization
+*> B = Q_in * R_in, then:
+*>
+*> B = (Q_out*S) * R_in = Q_out * (S * R_in) = O_out * R_out.
+*>
+*> So if one wants to interpret Q_out as the result
+*> of the QR factorization of B, then corresponding R_out
+*> should be obtained by R_out = S * R_in, i.e. some rows of R_in
+*> should be multiplied by -1.
+*>
+*> For the details of the algorithm, see [1].
+*>
+*> [1] "Reconstructing Householder vectors from tall-skinny QR",
+*> G. Ballard, J. Demmel, L. Grigori, M. Jacquelin, H.D. Nguyen,
+*> E. Solomonik, J. Parallel Distrib. Comput.,
+*> vol. 85, pp. 3-31, 2015.
+*> \endverbatim
+*>
+* Authors:
+* ========
+*
+*> \author Univ. of Tennessee
+*> \author Univ. of California Berkeley
+*> \author Univ. of Colorado Denver
+*> \author NAG Ltd.
+*
+*> \date November 2019
+*
+*> \ingroup complexOTHERcomputational
+*
+*> \par Contributors:
+* ==================
+*>
+*> \verbatim
+*>
+*> November 2019, Igor Kozachenko,
+*> Computer Science Division,
+*> University of California, Berkeley
+*>
+*> \endverbatim
+*
+* =====================================================================
+ SUBROUTINE CUNHR_COL( M, N, NB, A, LDA, T, LDT, D, INFO )
+ IMPLICIT NONE
+*
+* -- LAPACK computational routine (version 3.9.0) --
+* -- LAPACK is a software package provided by Univ. of Tennessee, --
+* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
+* November 2019
+*
+* .. Scalar Arguments ..
+ INTEGER INFO, LDA, LDT, M, N, NB
+* ..
+* .. Array Arguments ..
+ COMPLEX A( LDA, * ), D( * ), T( LDT, * )
+* ..
+*
+* =====================================================================
+*
+* .. Parameters ..
+ COMPLEX CONE, CZERO
+ PARAMETER ( CONE = ( 1.0E+0, 0.0E+0 ),
+ $ CZERO = ( 0.0E+0, 0.0E+0 ) )
+* ..
+* .. Local Scalars ..
+ INTEGER I, IINFO, J, JB, JBTEMP1, JBTEMP2, JNB,
+ $ NPLUSONE
+* ..
+* .. External Subroutines ..
+ EXTERNAL CCOPY, CLAUNHR_COL_GETRFNP, CSCAL, CTRSM,
+ $ XERBLA
+* ..
+* .. Intrinsic Functions ..
+ INTRINSIC MAX, MIN
+* ..
+* .. Executable Statements ..
+*
+* Test the input parameters
+*
+ INFO = 0
+ IF( M.LT.0 ) THEN
+ INFO = -1
+ ELSE IF( N.LT.0 .OR. N.GT.M ) THEN
+ INFO = -2
+ ELSE IF( NB.LT.1 ) THEN
+ INFO = -3
+ ELSE IF( LDA.LT.MAX( 1, M ) ) THEN
+ INFO = -5
+ ELSE IF( LDT.LT.MAX( 1, MIN( NB, N ) ) ) THEN
+ INFO = -7
+ END IF
+*
+* Handle error in the input parameters.
+*
+ IF( INFO.NE.0 ) THEN
+ CALL XERBLA( 'CUNHR_COL', -INFO )
+ RETURN
+ END IF
+*
+* Quick return if possible
+*
+ IF( MIN( M, N ).EQ.0 ) THEN
+ RETURN
+ END IF
+*
+* On input, the M-by-N matrix A contains the unitary
+* M-by-N matrix Q_in.
+*
+* (1) Compute the unit lower-trapezoidal V (ones on the diagonal
+* are not stored) by performing the "modified" LU-decomposition.
+*
+* Q_in - ( S ) = V * U = ( V1 ) * U,
+* ( 0 ) ( V2 )
+*
+* where 0 is an (M-N)-by-N zero matrix.
+*
+* (1-1) Factor V1 and U.
+
+ CALL CLAUNHR_COL_GETRFNP( N, N, A, LDA, D, IINFO )
+*
+* (1-2) Solve for V2.
+*
+ IF( M.GT.N ) THEN
+ CALL CTRSM( 'R', 'U', 'N', 'N', M-N, N, CONE, A, LDA,
+ $ A( N+1, 1 ), LDA )
+ END IF
+*
+* (2) Reconstruct the block reflector T stored in T(1:NB, 1:N)
+* as a sequence of upper-triangular blocks with NB-size column
+* blocking.
+*
+* Loop over the column blocks of size NB of the array A(1:M,1:N)
+* and the array T(1:NB,1:N), JB is the column index of a column
+* block, JNB is the column block size at each step JB.
+*
+ NPLUSONE = N + 1
+ DO JB = 1, N, NB
+*
+* (2-0) Determine the column block size JNB.
+*
+ JNB = MIN( NPLUSONE-JB, NB )
+*
+* (2-1) Copy the upper-triangular part of the current JNB-by-JNB
+* diagonal block U(JB) (of the N-by-N matrix U) stored
+* in A(JB:JB+JNB-1,JB:JB+JNB-1) into the upper-triangular part
+* of the current JNB-by-JNB block T(1:JNB,JB:JB+JNB-1)
+* column-by-column, total JNB*(JNB+1)/2 elements.
+*
+ JBTEMP1 = JB - 1
+ DO J = JB, JB+JNB-1
+ CALL CCOPY( J-JBTEMP1, A( JB, J ), 1, T( 1, J ), 1 )
+ END DO
+*
+* (2-2) Perform on the upper-triangular part of the current
+* JNB-by-JNB diagonal block U(JB) (of the N-by-N matrix U) stored
+* in T(1:JNB,JB:JB+JNB-1) the following operation in place:
+* (-1)*U(JB)*S(JB), i.e the result will be stored in the upper-
+* triangular part of T(1:JNB,JB:JB+JNB-1). This multiplication
+* of the JNB-by-JNB diagonal block U(JB) by the JNB-by-JNB
+* diagonal block S(JB) of the N-by-N sign matrix S from the
+* right means changing the sign of each J-th column of the block
+* U(JB) according to the sign of the diagonal element of the block
+* S(JB), i.e. S(J,J) that is stored in the array element D(J).
+*
+ DO J = JB, JB+JNB-1
+ IF( D( J ).EQ.CONE ) THEN
+ CALL CSCAL( J-JBTEMP1, -CONE, T( 1, J ), 1 )
+ END IF
+ END DO
+*
+* (2-3) Perform the triangular solve for the current block
+* matrix X(JB):
+*
+* X(JB) * (A(JB)**T) = B(JB), where:
+*
+* A(JB)**T is a JNB-by-JNB unit upper-triangular
+* coefficient block, and A(JB)=V1(JB), which
+* is a JNB-by-JNB unit lower-triangular block
+* stored in A(JB:JB+JNB-1,JB:JB+JNB-1).
+* The N-by-N matrix V1 is the upper part
+* of the M-by-N lower-trapezoidal matrix V
+* stored in A(1:M,1:N);
+*
+* B(JB) is a JNB-by-JNB upper-triangular right-hand
+* side block, B(JB) = (-1)*U(JB)*S(JB), and
+* B(JB) is stored in T(1:JNB,JB:JB+JNB-1);
+*
+* X(JB) is a JNB-by-JNB upper-triangular solution
+* block, X(JB) is the upper-triangular block
+* reflector T(JB), and X(JB) is stored
+* in T(1:JNB,JB:JB+JNB-1).
+*
+* In other words, we perform the triangular solve for the
+* upper-triangular block T(JB):
+*
+* T(JB) * (V1(JB)**T) = (-1)*U(JB)*S(JB).
+*
+* Even though the blocks X(JB) and B(JB) are upper-
+* triangular, the routine CTRSM will access all JNB**2
+* elements of the square T(1:JNB,JB:JB+JNB-1). Therefore,
+* we need to set to zero the elements of the block
+* T(1:JNB,JB:JB+JNB-1) below the diagonal before the call
+* to CTRSM.
+*
+* (2-3a) Set the elements to zero.
+*
+ JBTEMP2 = JB - 2
+ DO J = JB, JB+JNB-2
+ DO I = J-JBTEMP2, NB
+ T( I, J ) = CZERO
+ END DO
+ END DO
+*
+* (2-3b) Perform the triangular solve.
+*
+ CALL CTRSM( 'R', 'L', 'C', 'U', JNB, JNB, CONE,
+ $ A( JB, JB ), LDA, T( 1, JB ), LDT )
+*
+ END DO
+*
+ RETURN
+*
+* End of CUNHR_COL
+*
+ END
\ No newline at end of file