diff --git a/lapack-netlib/SRC/zporfsx.f b/lapack-netlib/SRC/zporfsx.f
index ee8cfbc6a..bbff4331e 100644
--- a/lapack-netlib/SRC/zporfsx.f
+++ b/lapack-netlib/SRC/zporfsx.f
@@ -44,7 +44,7 @@
*> \verbatim
*>
*> ZPORFSX 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*16 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 DOUBLE PRECISION 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 DOUBLE PRECISION 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.0D+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/zposvxx.f b/lapack-netlib/SRC/zposvxx.f
index 8126f14be..913d16cb2 100644
--- a/lapack-netlib/SRC/zposvxx.f
+++ b/lapack-netlib/SRC/zposvxx.f
@@ -45,7 +45,7 @@
*>
*> ZPOSVXX uses the Cholesky factorization A = U**T*U or A = L*L**T
*> to compute the solution to a complex*16 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*16 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 DOUBLE PRECISION 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.0D+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 extra-precise refinement algorithm.
+*> = 1.0: Use the extra-precise refinement algorithm.
*> (other values are reserved for future use)
*>
*> PARAMS(LA_LINRX_ITHRESH_I = 2) : Maximum number of residual
diff --git a/lapack-netlib/SRC/zpotrf2.f b/lapack-netlib/SRC/zpotrf2.f
index e37c9f6d6..85c434d47 100644
--- a/lapack-netlib/SRC/zpotrf2.f
+++ b/lapack-netlib/SRC/zpotrf2.f
@@ -24,7 +24,7 @@
*>
*> \verbatim
*>
-*> ZPOTRF2 computes the Cholesky factorization of a real symmetric
+*> ZPOTRF2 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*16 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/zstemr.f b/lapack-netlib/SRC/zstemr.f
index ac7552a6a..8685542de 100644
--- a/lapack-netlib/SRC/zstemr.f
+++ b/lapack-netlib/SRC/zstemr.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/zsycon_3.f b/lapack-netlib/SRC/zsycon_3.f
index 856845960..33bd23849 100644
--- a/lapack-netlib/SRC/zsycon_3.f
+++ b/lapack-netlib/SRC/zsycon_3.f
@@ -19,7 +19,7 @@
* ===========
*
* SUBROUTINE ZSYCON_3( UPLO, N, A, LDA, E, IPIV, ANORM, RCOND,
-* WORK, IWORK, INFO )
+* WORK, INFO )
*
* .. Scalar Arguments ..
* CHARACTER UPLO
@@ -27,7 +27,7 @@
* DOUBLE PRECISION ANORM, RCOND
* ..
* .. Array Arguments ..
-* INTEGER IPIV( * ), IWORK( * )
+* INTEGER IPIV( * )
* COMPLEX*16 A( LDA, * ), E ( * ), WORK( * )
* ..
*
@@ -129,11 +129,6 @@
*> WORK is COMPLEX*16 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/zsyconvf.f b/lapack-netlib/SRC/zsyconvf.f
index b26bfd63b..2d5ce882e 100644
--- a/lapack-netlib/SRC/zsyconvf.f
+++ b/lapack-netlib/SRC/zsyconvf.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/zsyconvf_rook.f b/lapack-netlib/SRC/zsyconvf_rook.f
index 5c36f4bcd..410d2eb34 100644
--- a/lapack-netlib/SRC/zsyconvf_rook.f
+++ b/lapack-netlib/SRC/zsyconvf_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/zsyrfsx.f b/lapack-netlib/SRC/zsyrfsx.f
index 3420d70cd..d086510d8 100644
--- a/lapack-netlib/SRC/zsyrfsx.f
+++ b/lapack-netlib/SRC/zsyrfsx.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 DOUBLE PRECISION 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.0D+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/zsysv_aa.f b/lapack-netlib/SRC/zsysv_aa.f
index 325d07c54..4e87bd105 100644
--- a/lapack-netlib/SRC/zsysv_aa.f
+++ b/lapack-netlib/SRC/zsysv_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
@@ -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
*> ZSYTRF.
*> \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 ZSYTRF_AA( UPLO, N, A, LDA, IPIV, WORK, LWORK, INFO )
IF( INFO.EQ.0 ) THEN
diff --git a/lapack-netlib/SRC/zsysv_aa_2stage.f b/lapack-netlib/SRC/zsysv_aa_2stage.f
index 029ed587d..923eaaec0 100644
--- a/lapack-netlib/SRC/zsysv_aa_2stage.f
+++ b/lapack-netlib/SRC/zsysv_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 ZSYTRF_AA_2STAGE( UPLO, N, A, LDA, TB, LTB, IPIV, IPIV2,
$ WORK, LWORK, INFO )
diff --git a/lapack-netlib/SRC/zsysvxx.f b/lapack-netlib/SRC/zsysvxx.f
index ef44d09d3..e29439385 100644
--- a/lapack-netlib/SRC/zsysvxx.f
+++ b/lapack-netlib/SRC/zsysvxx.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 DOUBLE PRECISION 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.0D+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 extra-precise refinement algorithm.
+*> = 1.0: Use the extra-precise refinement algorithm.
*> (other values are reserved for future use)
*>
*> PARAMS(LA_LINRX_ITHRESH_I = 2) : Maximum number of residual
diff --git a/lapack-netlib/SRC/zsytf2_rk.f b/lapack-netlib/SRC/zsytf2_rk.f
index b1a02f4a5..4ae1a4a22 100644
--- a/lapack-netlib/SRC/zsytf2_rk.f
+++ b/lapack-netlib/SRC/zsytf2_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/zsytrf.f b/lapack-netlib/SRC/zsytrf.f
index 663199c8a..54e22cca1 100644
--- a/lapack-netlib/SRC/zsytrf.f
+++ b/lapack-netlib/SRC/zsytrf.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/zsytrf_aa.f b/lapack-netlib/SRC/zsytrf_aa.f
index b25b1fbce..e547c6a60 100644
--- a/lapack-netlib/SRC/zsytrf_aa.f
+++ b/lapack-netlib/SRC/zsytrf_aa.f
@@ -37,7 +37,7 @@
*> ZSYTRF_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.
@@ -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/zsytrf_aa_2stage.f b/lapack-netlib/SRC/zsytrf_aa_2stage.f
index d3486c1a7..67a1c1f6f 100644
--- a/lapack-netlib/SRC/zsytrf_aa_2stage.f
+++ b/lapack-netlib/SRC/zsytrf_aa_2stage.f
@@ -38,7 +38,7 @@
*> ZSYTRF_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 ZSWAP( 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 ZSWAP( 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 ZSWAP( 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 ZSWAP( N-I2, A( I1, I2+1 ), LDA,
- $ A( I2, I2+1 ), LDA )
+ IF( I2.LT.N )
+ $ CALL ZSWAP( 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 ZSWAP( 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 ZSWAP( I2-I1-1, A( I1+1, I1 ), 1,
- $ A( I2, I1+1 ), LDA )
+ IF( I2.GT.(I1+1) )
+ $ CALL ZSWAP( 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 ZSWAP( N-I2, A( I2+1, I1 ), 1,
- $ A( I2+1, I2 ), 1 )
+ IF( I2.LT.N )
+ $ CALL ZSWAP( 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/zsytri2.f b/lapack-netlib/SRC/zsytri2.f
index e7303c90b..9929eb2c6 100644
--- a/lapack-netlib/SRC/zsytri2.f
+++ b/lapack-netlib/SRC/zsytri2.f
@@ -62,7 +62,7 @@
*> \param[in,out] A
*> \verbatim
*> A is COMPLEX*16 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 ZSYTRF.
*>
*> 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 ZSYTRF.
*> \endverbatim
*>
diff --git a/lapack-netlib/SRC/zsytrs2.f b/lapack-netlib/SRC/zsytrs2.f
index c0ee206a5..6e9cca425 100644
--- a/lapack-netlib/SRC/zsytrs2.f
+++ b/lapack-netlib/SRC/zsytrs2.f
@@ -36,7 +36,7 @@
*>
*> \verbatim
*>
-*> ZSYTRS2 solves a system of linear equations A*X = B with a real
+*> ZSYTRS2 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 ZSYTRF and converted by ZSYCONV.
*> \endverbatim
diff --git a/lapack-netlib/SRC/zsytrs_aa.f b/lapack-netlib/SRC/zsytrs_aa.f
index e62e9e486..0f0664009 100644
--- a/lapack-netlib/SRC/zsytrs_aa.f
+++ b/lapack-netlib/SRC/zsytrs_aa.f
@@ -37,7 +37,7 @@
*> \verbatim
*>
*> ZSYTRS_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 ZSYTRF_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
*>
@@ -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*16 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 ZSWAP( 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 ZTRSM('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 ZSWAP( 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 ZTRSM( '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 ZLACPY( 'F', 1, N, A( 1, 1 ), LDA+1, WORK( N ), 1)
IF( N.GT.1 ) THEN
@@ -223,35 +232,47 @@
CALL ZGTSV( 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 ZTRSM( '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 ZSWAP( NRHS, B( K, 1 ), LDB, B( KP, 1 ), LDB )
- END DO
+ CALL ZTRSM( 'L', 'U', 'N', 'U', N-1, NRHS, ONE, A( 1, 2 ),
+ $ LDA, B( 2, 1 ), LDB)
+*
+* Pivot, P * B -> B [ P * (U \ (T \ (U**T \P**T * B) )) ]
+*
+ DO K = N, 1, -1
+ KP = IPIV( K )
+ IF( KP.NE.K )
+ $ CALL ZSWAP( 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 ZSWAP( 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
*
- CALL ZTRSM( 'L', 'L', 'N', 'U', N-1, NRHS, ONE, A( 2, 1 ), LDA,
- $ B( 2, 1 ), LDB)
+ DO K = 1, N
+ KP = IPIV( K )
+ IF( KP.NE.K )
+ $ CALL ZSWAP( NRHS, B( K, 1 ), LDB, B( KP, 1 ), LDB )
+ END DO
+*
+* Compute L \ B -> B [ (L \P**T * B) ]
+*
+ CALL ZTRSM( 'L', 'L', 'N', 'U', N-1, NRHS, ONE, A( 2, 1 ),
+ $ LDA, B( 2, 1 ), LDB)
+ END IF
+*
+* 2) Solve with triangular matrix T
*
* Compute T \ B -> B [ T \ (L \P**T * B) ]
*
@@ -263,18 +284,23 @@
CALL ZGTSV( 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 ZTRSM( '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 ZSWAP( NRHS, B( K, 1 ), LDB, B( KP, 1 ), LDB )
- END DO
+ CALL ZTRSM( '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 ZSWAP( NRHS, B( K, 1 ), LDB, B( KP, 1 ), LDB )
+ END DO
+ END IF
*
END IF
*
diff --git a/lapack-netlib/SRC/zsytrs_aa_2stage.f b/lapack-netlib/SRC/zsytrs_aa_2stage.f
index fa15eee90..bf060b2d3 100644
--- a/lapack-netlib/SRC/zsytrs_aa_2stage.f
+++ b/lapack-netlib/SRC/zsytrs_aa_2stage.f
@@ -36,7 +36,7 @@
*> \verbatim
*>
*> ZSYTRS_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 ZSYTRF_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 ZLASWP( 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 ZTRSM( 'L', 'U', 'T', 'U', N-NB, NRHS, ONE, A(1, NB+1),
$ LDA, B(NB+1, 1), LDB)
@@ -234,7 +234,7 @@
CALL ZTRSM( '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 ZLASWP( 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 ZLASWP( 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 ZTRSM( 'L', 'L', 'N', 'U', N-NB, NRHS, ONE, A(NB+1, 1),
$ LDA, B(NB+1, 1), LDB)
@@ -268,7 +268,7 @@
CALL ZTRSM( '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 ZLASWP( NRHS, B, LDB, NB+1, N, IPIV, -1 )
*
diff --git a/lapack-netlib/SRC/ztgsy2.f b/lapack-netlib/SRC/ztgsy2.f
index f89effd6c..028ddfd3d 100644
--- a/lapack-netlib/SRC/ztgsy2.f
+++ b/lapack-netlib/SRC/ztgsy2.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 ZLACON.
+*> = sigma_min(Z) using reverse communication with ZLACON.
*>
*> ZTGSY2 also (IJOB >= 1) contributes to the computation in ZTGSYL
*> 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
*>
diff --git a/lapack-netlib/SRC/ztpmlqt.f b/lapack-netlib/SRC/ztpmlqt.f
index 6a67e4443..cc333f5a2 100644
--- a/lapack-netlib/SRC/ztpmlqt.f
+++ b/lapack-netlib/SRC/ztpmlqt.f
@@ -94,7 +94,7 @@
*>
*> \param[in] V
*> \verbatim
-*> V is COMPLEX*16 array, dimension (LDA,K)
+*> V is COMPLEX*16 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/ztpmqrt.f b/lapack-netlib/SRC/ztpmqrt.f
index aca7ff00f..530dca458 100644
--- a/lapack-netlib/SRC/ztpmqrt.f
+++ b/lapack-netlib/SRC/ztpmqrt.f
@@ -94,7 +94,7 @@
*>
*> \param[in] V
*> \verbatim
-*> V is COMPLEX*16 array, dimension (LDA,K)
+*> V is COMPLEX*16 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/ztprfb.f b/lapack-netlib/SRC/ztprfb.f
index 1a62829d5..f96c237ee 100644
--- a/lapack-netlib/SRC/ztprfb.f
+++ b/lapack-netlib/SRC/ztprfb.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/zungtsqr.f b/lapack-netlib/SRC/zungtsqr.f
new file mode 100644
index 000000000..7b04e9a29
--- /dev/null
+++ b/lapack-netlib/SRC/zungtsqr.f
@@ -0,0 +1,307 @@
+*> \brief \b ZUNGTSQR
+*
+* =========== DOCUMENTATION ===========
+*
+* Online html documentation available at
+* http://www.netlib.org/lapack/explore-html/
+*
+*> \htmlonly
+*> Download ZUNGTSQR + dependencies
+*>
+*> [TGZ]
+*>
+*> [ZIP]
+*>
+*> [TXT]
+*>
+* Definition:
+* ===========
+*
+* SUBROUTINE ZUNGTSQR( 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*16 A( LDA, * ), T( LDT, * ), WORK( * )
+* ..
+*
+*> \par Purpose:
+* =============
+*>
+*> \verbatim
+*>
+*> ZUNGTSQR 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 ZLATSQR
+*>
+*> Q_out = first_N_columns_of( Q(1)_in * Q(2)_in * ... * Q(k)_in ).
+*>
+*> See the documentation for ZLATSQR.
+*> \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 ZLATSQR 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*16 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 ZLATSQR
+*> 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 ZLATSQR).
+*>
+*> 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*16 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 ZLATSQR).
+*> \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*16 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 comlex16OTHERcomputational
+*
+*> \par Contributors:
+* ==================
+*>
+*> \verbatim
+*>
+*> November 2019, Igor Kozachenko,
+*> Computer Science Division,
+*> University of California, Berkeley
+*>
+*> \endverbatim
+*
+* =====================================================================
+ SUBROUTINE ZUNGTSQR( 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*16 A( LDA, * ), T( LDT, * ), WORK( * )
+* ..
+*
+* =====================================================================
+*
+* .. Parameters ..
+ COMPLEX*16 CONE, CZERO
+ PARAMETER ( CONE = ( 1.0D+0, 0.0D+0 ),
+ $ CZERO = ( 0.0D+0, 0.0D+0 ) )
+* ..
+* .. Local Scalars ..
+ LOGICAL LQUERY
+ INTEGER IINFO, LDC, LWORKOPT, LC, LW, NBLOCAL, J
+* ..
+* .. External Subroutines ..
+ EXTERNAL ZCOPY, ZLAMTSQR, ZLASET, XERBLA
+* ..
+* .. Intrinsic Functions ..
+ INTRINSIC DCMPLX, 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 ZLAMTSQR. See the documentation for ZLAMTSQR.
+*
+ 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 ZLAMTSQR call and set the optimal size of the work array
+* WORK(LWORK) in ZLAMTSQR 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( 'ZUNGTSQR', -INFO )
+ RETURN
+ ELSE IF ( LQUERY ) THEN
+ WORK( 1 ) = DCMPLX( LWORKOPT )
+ RETURN
+ END IF
+*
+* Quick return if possible
+*
+ IF( MIN( M, N ).EQ.0 ) THEN
+ WORK( 1 ) = DCMPLX( 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 ZLAMTSQR.
+*
+* 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 ZLASET( '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 ZLAMTSQR( '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 ZCOPY( M, WORK( (J-1)*LDC + 1 ), 1, A( 1, J ), 1 )
+ END DO
+*
+ WORK( 1 ) = DCMPLX( LWORKOPT )
+ RETURN
+*
+* End of ZUNGTSQR
+*
+ END
\ No newline at end of file
diff --git a/lapack-netlib/SRC/zunhr_col.f b/lapack-netlib/SRC/zunhr_col.f
new file mode 100644
index 000000000..71039fddb
--- /dev/null
+++ b/lapack-netlib/SRC/zunhr_col.f
@@ -0,0 +1,441 @@
+*> \brief \b ZUNHR_COL
+*
+* =========== DOCUMENTATION ===========
+*
+* Online html documentation available at
+* http://www.netlib.org/lapack/explore-html/
+*
+*> \htmlonly
+*> Download ZUNHR_COL + dependencies
+*>
+*> [TGZ]
+*>
+*> [ZIP]
+*>
+*> [TXT]
+*>
+* Definition:
+* ===========
+*
+* SUBROUTINE ZUNHR_COL( M, N, NB, A, LDA, T, LDT, D, INFO )
+*
+* .. Scalar Arguments ..
+* INTEGER INFO, LDA, LDT, M, N, NB
+* ..
+* .. Array Arguments ..
+* COMPLEX*16 A( LDA, * ), D( * ), T( LDT, * )
+* ..
+*
+*> \par Purpose:
+* =============
+*>
+*> \verbatim
+*>
+*> ZUNHR_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 ZGEQRT).
+*> \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*16 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
+*> ZGEQRT). 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*16 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 ZGEQRT).
+*> 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*16 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 complex16OTHERcomputational
+*
+*> \par Contributors:
+* ==================
+*>
+*> \verbatim
+*>
+*> November 2019, Igor Kozachenko,
+*> Computer Science Division,
+*> University of California, Berkeley
+*>
+*> \endverbatim
+*
+* =====================================================================
+ SUBROUTINE ZUNHR_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*16 A( LDA, * ), D( * ), T( LDT, * )
+* ..
+*
+* =====================================================================
+*
+* .. Parameters ..
+ COMPLEX*16 CONE, CZERO
+ PARAMETER ( CONE = ( 1.0D+0, 0.0D+0 ),
+ $ CZERO = ( 0.0D+0, 0.0D+0 ) )
+* ..
+* .. Local Scalars ..
+ INTEGER I, IINFO, J, JB, JBTEMP1, JBTEMP2, JNB,
+ $ NPLUSONE
+* ..
+* .. External Subroutines ..
+ EXTERNAL ZCOPY, ZLAUNHR_COL_GETRFNP, ZSCAL, ZTRSM,
+ $ 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( 'ZUNHR_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 ZLAUNHR_COL_GETRFNP( N, N, A, LDA, D, IINFO )
+*
+* (1-2) Solve for V2.
+*
+ IF( M.GT.N ) THEN
+ CALL ZTRSM( '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 ZCOPY( 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 ZSCAL( 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 ZTRSM 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 ZTRSM.
+*
+* (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 ZTRSM( 'R', 'L', 'C', 'U', JNB, JNB, CONE,
+ $ A( JB, JB ), LDA, T( 1, JB ), LDT )
+*
+ END DO
+*
+ RETURN
+*
+* End of ZUNHR_COL
+*
+ END
\ No newline at end of file