Functions
subroutine sgeqpf (M, N, A, LDA, JPVT, TAU, WORK, INFO)
SGEQPF
subroutine sgebak (JOB, SIDE, N, ILO, IHI, SCALE, M, V, LDV, INFO)
SGEBAK
subroutine sgebal (JOB, N, A, LDA, ILO, IHI, SCALE, INFO)
SGEBAL
subroutine sgebd2 (M, N, A, LDA, D, E, TAUQ, TAUP, WORK, INFO)
SGEBD2 reduces a general matrix to bidiagonal form using an unblocked algorithm.
subroutine sgebrd (M, N, A, LDA, D, E, TAUQ, TAUP, WORK, LWORK, INFO)
SGEBRD
subroutine sgecon (NORM, N, A, LDA, ANORM, RCOND, WORK, IWORK, INFO)
SGECON
subroutine sgeequ (M, N, A, LDA, R, C, ROWCND, COLCND, AMAX, INFO)
SGEEQU
subroutine sgeequb (M, N, A, LDA, R, C, ROWCND, COLCND, AMAX, INFO)
SGEEQUB
subroutine sgehd2 (N, ILO, IHI, A, LDA, TAU, WORK, INFO)
SGEHD2 reduces a general square matrix to upper Hessenberg form using an unblocked algorithm.
subroutine sgehrd (N, ILO, IHI, A, LDA, TAU, WORK, LWORK, INFO)
SGEHRD
subroutine sgelq2 (M, N, A, LDA, TAU, WORK, INFO)
SGELQ2 computes the LQ factorization of a general rectangular matrix using an unblocked algorithm.
subroutine sgelqf (M, N, A, LDA, TAU, WORK, LWORK, INFO)
SGELQF
subroutine sgemqrt (SIDE, TRANS, M, N, K, NB, V, LDV, T, LDT, C, LDC, WORK, INFO)
SGEMQRT
subroutine sgeql2 (M, N, A, LDA, TAU, WORK, INFO)
SGEQL2 computes the QL factorization of a general rectangular matrix using an unblocked algorithm.
subroutine sgeqlf (M, N, A, LDA, TAU, WORK, LWORK, INFO)
SGEQLF
subroutine sgeqp3 (M, N, A, LDA, JPVT, TAU, WORK, LWORK, INFO)
SGEQP3
subroutine sgeqr2 (M, N, A, LDA, TAU, WORK, INFO)
SGEQR2 computes the QR factorization of a general rectangular matrix using an unblocked algorithm.
subroutine sgeqr2p (M, N, A, LDA, TAU, WORK, INFO)
SGEQR2P computes the QR factorization of a general rectangular matrix with nonnegative diagonal elements using an unblocked algorithm.
subroutine sgeqrf (M, N, A, LDA, TAU, WORK, LWORK, INFO)
SGEQRF
subroutine sgeqrfp (M, N, A, LDA, TAU, WORK, LWORK, INFO)
SGEQRFP
subroutine sgeqrt (M, N, NB, A, LDA, T, LDT, WORK, INFO)
SGEQRT
subroutine sgeqrt2 (M, N, A, LDA, T, LDT, INFO)
SGEQRT2 computes a QR factorization of a general real or complex matrix using the compact WY representation of Q.
recursive subroutine sgeqrt3 (M, N, A, LDA, T, LDT, INFO)
SGEQRT3 recursively computes a QR factorization of a general real or complex matrix using the compact WY representation of Q.
subroutine sgerfs (TRANS, N, NRHS, A, LDA, AF, LDAF, IPIV, B, LDB, X, LDX, FERR, BERR, WORK, IWORK, INFO)
SGERFS
subroutine sgerfsx (TRANS, EQUED, N, NRHS, A, LDA, AF, LDAF, IPIV, R, C, B, LDB, X, LDX, RCOND, BERR, N_ERR_BNDS, ERR_BNDS_NORM, ERR_BNDS_COMP, NPARAMS, PARAMS, WORK, IWORK, INFO)
SGERFSX
subroutine sgerq2 (M, N, A, LDA, TAU, WORK, INFO)
SGERQ2 computes the RQ factorization of a general rectangular matrix using an unblocked algorithm.
subroutine sgerqf (M, N, A, LDA, TAU, WORK, LWORK, INFO)
SGERQF
subroutine sgesvj (JOBA, JOBU, JOBV, M, N, A, LDA, SVA, MV, V, LDV, WORK, LWORK, INFO)
SGESVJ
subroutine sgetf2 (M, N, A, LDA, IPIV, INFO)
SGETF2 computes the LU factorization of a general mbyn matrix using partial pivoting with row interchanges (unblocked algorithm).
subroutine sgetrf (M, N, A, LDA, IPIV, INFO)
SGETRF
recursive subroutine sgetrf2 (M, N, A, LDA, IPIV, INFO)
SGETRF2
subroutine sgetri (N, A, LDA, IPIV, WORK, LWORK, INFO)
SGETRI
subroutine sgetrs (TRANS, N, NRHS, A, LDA, IPIV, B, LDB, INFO)
SGETRS
subroutine shgeqz (JOB, COMPQ, COMPZ, N, ILO, IHI, H, LDH, T, LDT, ALPHAR, ALPHAI, BETA, Q, LDQ, Z, LDZ, WORK, LWORK, INFO)
SHGEQZ
subroutine sla_geamv (TRANS, M, N, ALPHA, A, LDA, X, INCX, BETA, Y, INCY)
SLA_GEAMV computes a matrixvector product using a general matrix to calculate error bounds.
real function sla_gercond (TRANS, N, A, LDA, AF, LDAF, IPIV, CMODE, C, INFO, WORK, IWORK)
SLA_GERCOND estimates the Skeel condition number for a general matrix.
subroutine sla_gerfsx_extended (PREC_TYPE, TRANS_TYPE, N, NRHS, A, LDA, AF, LDAF, IPIV, COLEQU, C, B, LDB, Y, LDY, BERR_OUT, N_NORMS, ERRS_N, ERRS_C, RES, AYB, DY, Y_TAIL, RCOND, ITHRESH, RTHRESH, DZ_UB, IGNORE_CWISE, INFO)
SLA_GERFSX_EXTENDED improves the computed solution to a system of linear equations for general matrices by performing extraprecise iterative refinement and provides error bounds and backward error estimates for the solution.
real function sla_gerpvgrw (N, NCOLS, A, LDA, AF, LDAF)
SLA_GERPVGRW
subroutine stgevc (SIDE, HOWMNY, SELECT, N, S, LDS, P, LDP, VL, LDVL, VR, LDVR, MM, M, WORK, INFO)
STGEVC
subroutine stgexc (WANTQ, WANTZ, N, A, LDA, B, LDB, Q, LDQ, Z, LDZ, IFST, ILST, WORK, LWORK, INFO)
STGEXC
Detailed Description
This is the group of real computational functions for GE matrices
Function Documentation
subroutine sgebak (character JOB, character SIDE, integer N, integer ILO, integer IHI, real, dimension( * ) SCALE, integer M, real, dimension( ldv, * ) V, integer LDV, integer INFO)
SGEBAK
Purpose:

SGEBAK forms the right or left eigenvectors of a real general matrix by backward transformation on the computed eigenvectors of the balanced matrix output by SGEBAL.
Parameters:

JOB
JOB is CHARACTER*1 Specifies the type of backward transformation required: = 'N', do nothing, return immediately; = 'P', do backward transformation for permutation only; = 'S', do backward transformation for scaling only; = 'B', do backward transformations for both permutation and scaling. JOB must be the same as the argument JOB supplied to SGEBAL.
SIDESIDE is CHARACTER*1 = 'R': V contains right eigenvectors; = 'L': V contains left eigenvectors.
NN is INTEGER The number of rows of the matrix V. N >= 0.
ILOILO is INTEGER
IHIIHI is INTEGER The integers ILO and IHI determined by SGEBAL. 1 <= ILO <= IHI <= N, if N > 0; ILO=1 and IHI=0, if N=0.
SCALESCALE is REAL array, dimension (N) Details of the permutation and scaling factors, as returned by SGEBAL.
MM is INTEGER The number of columns of the matrix V. M >= 0.
VV is REAL array, dimension (LDV,M) On entry, the matrix of right or left eigenvectors to be transformed, as returned by SHSEIN or STREVC. On exit, V is overwritten by the transformed eigenvectors.
LDVLDV is INTEGER The leading dimension of the array V. LDV >= max(1,N).
INFOINFO is INTEGER = 0: successful exit < 0: if INFO = i, the ith argument had an illegal value.
Author:

Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date:
 November 2011
subroutine sgebal (character JOB, integer N, real, dimension( lda, * ) A, integer LDA, integer ILO, integer IHI, real, dimension( * ) SCALE, integer INFO)
SGEBAL
Purpose:

SGEBAL balances a general real matrix A. This involves, first, permuting A by a similarity transformation to isolate eigenvalues in the first 1 to ILO1 and last IHI+1 to N elements on the diagonal; and second, applying a diagonal similarity transformation to rows and columns ILO to IHI to make the rows and columns as close in norm as possible. Both steps are optional. Balancing may reduce the 1norm of the matrix, and improve the accuracy of the computed eigenvalues and/or eigenvectors.
Parameters:

JOB
JOB is CHARACTER*1 Specifies the operations to be performed on A: = 'N': none: simply set ILO = 1, IHI = N, SCALE(I) = 1.0 for i = 1,...,N; = 'P': permute only; = 'S': scale only; = 'B': both permute and scale.
NN is INTEGER The order of the matrix A. N >= 0.
AA is REAL array, dimension (LDA,N) On entry, the input matrix A. On exit, A is overwritten by the balanced matrix. If JOB = 'N', A is not referenced. See Further Details.
LDALDA is INTEGER The leading dimension of the array A. LDA >= max(1,N).
ILOILO is INTEGER
IHIIHI is INTEGER ILO and IHI are set to integers such that on exit A(i,j) = 0 if i > j and j = 1,...,ILO1 or I = IHI+1,...,N. If JOB = 'N' or 'S', ILO = 1 and IHI = N.
SCALESCALE is REAL array, dimension (N) Details of the permutations and scaling factors applied to A. If P(j) is the index of the row and column interchanged with row and column j and D(j) is the scaling factor applied to row and column j, then SCALE(j) = P(j) for j = 1,...,ILO1 = D(j) for j = ILO,...,IHI = P(j) for j = IHI+1,...,N. The order in which the interchanges are made is N to IHI+1, then 1 to ILO1.
INFOINFO is INTEGER = 0: successful exit. < 0: if INFO = i, the ith argument had an illegal value.
Author:

Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date:
 November 2015
Further Details:

The permutations consist of row and column interchanges which put the matrix in the form ( T1 X Y ) P A P = ( 0 B Z ) ( 0 0 T2 ) where T1 and T2 are upper triangular matrices whose eigenvalues lie along the diagonal. The column indices ILO and IHI mark the starting and ending columns of the submatrix B. Balancing consists of applying a diagonal similarity transformation inv(D) * B * D to make the 1norms of each row of B and its corresponding column nearly equal. The output matrix is ( T1 X*D Y ) ( 0 inv(D)*B*D inv(D)*Z ). ( 0 0 T2 ) Information about the permutations P and the diagonal matrix D is returned in the vector SCALE. This subroutine is based on the EISPACK routine BALANC. Modified by TzuYi Chen, Computer Science Division, University of California at Berkeley, USA
subroutine sgebd2 (integer M, integer N, real, dimension( lda, * ) A, integer LDA, real, dimension( * ) D, real, dimension( * ) E, real, dimension( * ) TAUQ, real, dimension( * ) TAUP, real, dimension( * ) WORK, integer INFO)
SGEBD2 reduces a general matrix to bidiagonal form using an unblocked algorithm.
Purpose:

SGEBD2 reduces a real general m by n matrix A to upper or lower bidiagonal form B by an orthogonal transformation: Q**T * A * P = B. If m >= n, B is upper bidiagonal; if m < n, B is lower bidiagonal.
Parameters:

M
M is INTEGER The number of rows in the matrix A. M >= 0.
NN is INTEGER The number of columns in the matrix A. N >= 0.
AA is REAL array, dimension (LDA,N) On entry, the m by n general matrix to be reduced. On exit, if m >= n, the diagonal and the first superdiagonal are overwritten with the upper bidiagonal matrix B; the elements below the diagonal, with the array TAUQ, represent the orthogonal matrix Q as a product of elementary reflectors, and the elements above the first superdiagonal, with the array TAUP, represent the orthogonal matrix P as a product of elementary reflectors; if m < n, the diagonal and the first subdiagonal are overwritten with the lower bidiagonal matrix B; the elements below the first subdiagonal, with the array TAUQ, represent the orthogonal matrix Q as a product of elementary reflectors, and the elements above the diagonal, with the array TAUP, represent the orthogonal matrix P as a product of elementary reflectors. See Further Details.
LDALDA is INTEGER The leading dimension of the array A. LDA >= max(1,M).
DD is REAL array, dimension (min(M,N)) The diagonal elements of the bidiagonal matrix B: D(i) = A(i,i).
EE is REAL array, dimension (min(M,N)1) The offdiagonal elements of the bidiagonal matrix B: if m >= n, E(i) = A(i,i+1) for i = 1,2,...,n1; if m < n, E(i) = A(i+1,i) for i = 1,2,...,m1.
TAUQTAUQ is REAL array dimension (min(M,N)) The scalar factors of the elementary reflectors which represent the orthogonal matrix Q. See Further Details.
TAUPTAUP is REAL array, dimension (min(M,N)) The scalar factors of the elementary reflectors which represent the orthogonal matrix P. See Further Details.
WORKWORK is REAL array, dimension (max(M,N))
INFOINFO is INTEGER = 0: successful exit. < 0: if INFO = i, the ith argument had an illegal value.
Author:

Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date:
 September 2012
Further Details:

The matrices Q and P are represented as products of elementary reflectors: If m >= n, Q = H(1) H(2) . . . H(n) and P = G(1) G(2) . . . G(n1) Each H(i) and G(i) has the form: H(i) = I  tauq * v * v**T and G(i) = I  taup * u * u**T where tauq and taup are real scalars, and v and u are real vectors; v(1:i1) = 0, v(i) = 1, and v(i+1:m) is stored on exit in A(i+1:m,i); u(1:i) = 0, u(i+1) = 1, and u(i+2:n) is stored on exit in A(i,i+2:n); tauq is stored in TAUQ(i) and taup in TAUP(i). If m < n, Q = H(1) H(2) . . . H(m1) and P = G(1) G(2) . . . G(m) Each H(i) and G(i) has the form: H(i) = I  tauq * v * v**T and G(i) = I  taup * u * u**T where tauq and taup are real scalars, and v and u are real vectors; v(1:i) = 0, v(i+1) = 1, and v(i+2:m) is stored on exit in A(i+2:m,i); u(1:i1) = 0, u(i) = 1, and u(i+1:n) is stored on exit in A(i,i+1:n); tauq is stored in TAUQ(i) and taup in TAUP(i). The contents of A on exit are illustrated by the following examples: m = 6 and n = 5 (m > n): m = 5 and n = 6 (m < n): ( d e u1 u1 u1 ) ( d u1 u1 u1 u1 u1 ) ( v1 d e u2 u2 ) ( e d u2 u2 u2 u2 ) ( v1 v2 d e u3 ) ( v1 e d u3 u3 u3 ) ( v1 v2 v3 d e ) ( v1 v2 e d u4 u4 ) ( v1 v2 v3 v4 d ) ( v1 v2 v3 e d u5 ) ( v1 v2 v3 v4 v5 ) where d and e denote diagonal and offdiagonal elements of B, vi denotes an element of the vector defining H(i), and ui an element of the vector defining G(i).
subroutine sgebrd (integer M, integer N, real, dimension( lda, * ) A, integer LDA, real, dimension( * ) D, real, dimension( * ) E, real, dimension( * ) TAUQ, real, dimension( * ) TAUP, real, dimension( * ) WORK, integer LWORK, integer INFO)
SGEBRD
Purpose:

SGEBRD reduces a general real MbyN matrix A to upper or lower bidiagonal form B by an orthogonal transformation: Q**T * A * P = B. If m >= n, B is upper bidiagonal; if m < n, B is lower bidiagonal.
Parameters:

M
M is INTEGER The number of rows in the matrix A. M >= 0.
NN is INTEGER The number of columns in the matrix A. N >= 0.
AA is REAL array, dimension (LDA,N) On entry, the MbyN general matrix to be reduced. On exit, if m >= n, the diagonal and the first superdiagonal are overwritten with the upper bidiagonal matrix B; the elements below the diagonal, with the array TAUQ, represent the orthogonal matrix Q as a product of elementary reflectors, and the elements above the first superdiagonal, with the array TAUP, represent the orthogonal matrix P as a product of elementary reflectors; if m < n, the diagonal and the first subdiagonal are overwritten with the lower bidiagonal matrix B; the elements below the first subdiagonal, with the array TAUQ, represent the orthogonal matrix Q as a product of elementary reflectors, and the elements above the diagonal, with the array TAUP, represent the orthogonal matrix P as a product of elementary reflectors. See Further Details.
LDALDA is INTEGER The leading dimension of the array A. LDA >= max(1,M).
DD is REAL array, dimension (min(M,N)) The diagonal elements of the bidiagonal matrix B: D(i) = A(i,i).
EE is REAL array, dimension (min(M,N)1) The offdiagonal elements of the bidiagonal matrix B: if m >= n, E(i) = A(i,i+1) for i = 1,2,...,n1; if m < n, E(i) = A(i+1,i) for i = 1,2,...,m1.
TAUQTAUQ is REAL array dimension (min(M,N)) The scalar factors of the elementary reflectors which represent the orthogonal matrix Q. See Further Details.
TAUPTAUP is REAL array, dimension (min(M,N)) The scalar factors of the elementary reflectors which represent the orthogonal matrix P. See Further Details.
WORKWORK is REAL array, dimension (MAX(1,LWORK)) On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
LWORKLWORK is INTEGER The length of the array WORK. LWORK >= max(1,M,N). For optimum performance LWORK >= (M+N)*NB, where NB is the optimal blocksize. 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.
INFOINFO is INTEGER = 0: successful exit < 0: if INFO = i, the ith argument had an illegal value.
Author:

Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date:
 November 2011
Further Details:

The matrices Q and P are represented as products of elementary reflectors: If m >= n, Q = H(1) H(2) . . . H(n) and P = G(1) G(2) . . . G(n1) Each H(i) and G(i) has the form: H(i) = I  tauq * v * v**T and G(i) = I  taup * u * u**T where tauq and taup are real scalars, and v and u are real vectors; v(1:i1) = 0, v(i) = 1, and v(i+1:m) is stored on exit in A(i+1:m,i); u(1:i) = 0, u(i+1) = 1, and u(i+2:n) is stored on exit in A(i,i+2:n); tauq is stored in TAUQ(i) and taup in TAUP(i). If m < n, Q = H(1) H(2) . . . H(m1) and P = G(1) G(2) . . . G(m) Each H(i) and G(i) has the form: H(i) = I  tauq * v * v**T and G(i) = I  taup * u * u**T where tauq and taup are real scalars, and v and u are real vectors; v(1:i) = 0, v(i+1) = 1, and v(i+2:m) is stored on exit in A(i+2:m,i); u(1:i1) = 0, u(i) = 1, and u(i+1:n) is stored on exit in A(i,i+1:n); tauq is stored in TAUQ(i) and taup in TAUP(i). The contents of A on exit are illustrated by the following examples: m = 6 and n = 5 (m > n): m = 5 and n = 6 (m < n): ( d e u1 u1 u1 ) ( d u1 u1 u1 u1 u1 ) ( v1 d e u2 u2 ) ( e d u2 u2 u2 u2 ) ( v1 v2 d e u3 ) ( v1 e d u3 u3 u3 ) ( v1 v2 v3 d e ) ( v1 v2 e d u4 u4 ) ( v1 v2 v3 v4 d ) ( v1 v2 v3 e d u5 ) ( v1 v2 v3 v4 v5 ) where d and e denote diagonal and offdiagonal elements of B, vi denotes an element of the vector defining H(i), and ui an element of the vector defining G(i).
subroutine sgecon (character NORM, integer N, real, dimension( lda, * ) A, integer LDA, real ANORM, real RCOND, real, dimension( * ) WORK, integer, dimension( * ) IWORK, integer INFO)
SGECON
Purpose:

SGECON estimates the reciprocal of the condition number of a general real matrix A, in either the 1norm or the infinitynorm, using the LU factorization computed by SGETRF. An estimate is obtained for norm(inv(A)), and the reciprocal of the condition number is computed as RCOND = 1 / ( norm(A) * norm(inv(A)) ).
Parameters:

NORM
NORM is CHARACTER*1 Specifies whether the 1norm condition number or the infinitynorm condition number is required: = '1' or 'O': 1norm; = 'I': Infinitynorm.
NN is INTEGER The order of the matrix A. N >= 0.
AA is REAL array, dimension (LDA,N) The factors L and U from the factorization A = P*L*U as computed by SGETRF.
LDALDA is INTEGER The leading dimension of the array A. LDA >= max(1,N).
ANORMANORM is REAL If NORM = '1' or 'O', the 1norm of the original matrix A. If NORM = 'I', the infinitynorm of the original matrix A.
RCONDRCOND is REAL The reciprocal of the condition number of the matrix A, computed as RCOND = 1/(norm(A) * norm(inv(A))).
WORKWORK is REAL array, dimension (4*N)
IWORKIWORK is INTEGER array, dimension (N)
INFOINFO is INTEGER = 0: successful exit < 0: if INFO = i, the ith argument had an illegal value
Author:

Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date:
 November 2011
subroutine sgeequ (integer M, integer N, real, dimension( lda, * ) A, integer LDA, real, dimension( * ) R, real, dimension( * ) C, real ROWCND, real COLCND, real AMAX, integer INFO)
SGEEQU
Purpose:

SGEEQU computes row and column scalings intended to equilibrate an MbyN matrix A and reduce its condition number. R returns the row scale factors and C the column scale factors, chosen to try to make the largest element in each row and column of the matrix B with elements B(i,j)=R(i)*A(i,j)*C(j) have absolute value 1. R(i) and C(j) are restricted to be between SMLNUM = smallest safe number and BIGNUM = largest safe number. Use of these scaling factors is not guaranteed to reduce the condition number of A but works well in practice.
Parameters:

M
M is INTEGER The number of rows of the matrix A. M >= 0.
NN is INTEGER The number of columns of the matrix A. N >= 0.
AA is REAL array, dimension (LDA,N) The MbyN matrix whose equilibration factors are to be computed.
LDALDA is INTEGER The leading dimension of the array A. LDA >= max(1,M).
RR is REAL array, dimension (M) If INFO = 0 or INFO > M, R contains the row scale factors for A.
CC is REAL array, dimension (N) If INFO = 0, C contains the column scale factors for A.
ROWCNDROWCND is REAL If INFO = 0 or INFO > M, ROWCND contains the ratio of the smallest R(i) to the largest R(i). If ROWCND >= 0.1 and AMAX is neither too large nor too small, it is not worth scaling by R.
COLCNDCOLCND is REAL If INFO = 0, COLCND contains the ratio of the smallest C(i) to the largest C(i). If COLCND >= 0.1, it is not worth scaling by C.
AMAXAMAX is REAL Absolute value of largest matrix element. If AMAX is very close to overflow or very close to underflow, the matrix should be scaled.
INFOINFO is INTEGER = 0: successful exit < 0: if INFO = i, the ith argument had an illegal value > 0: if INFO = i, and i is <= M: the ith row of A is exactly zero > M: the (iM)th column of A is exactly zero
Author:

Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date:
 November 2011
subroutine sgeequb (integer M, integer N, real, dimension( lda, * ) A, integer LDA, real, dimension( * ) R, real, dimension( * ) C, real ROWCND, real COLCND, real AMAX, integer INFO)
SGEEQUB
Purpose:

SGEEQUB computes row and column scalings intended to equilibrate an MbyN matrix A and reduce its condition number. R returns the row scale factors and C the column scale factors, chosen to try to make the largest element in each row and column of the matrix B with elements B(i,j)=R(i)*A(i,j)*C(j) have an absolute value of at most the radix. R(i) and C(j) are restricted to be a power of the radix between SMLNUM = smallest safe number and BIGNUM = largest safe number. Use of these scaling factors is not guaranteed to reduce the condition number of A but works well in practice. This routine differs from SGEEQU by restricting the scaling factors to a power of the radix. Baring over and underflow, scaling by these factors introduces no additional rounding errors. However, the scaled entries' magnitured are no longer approximately 1 but lie between sqrt(radix) and 1/sqrt(radix).
Parameters:

M
M is INTEGER The number of rows of the matrix A. M >= 0.
NN is INTEGER The number of columns of the matrix A. N >= 0.
AA is REAL array, dimension (LDA,N) The MbyN matrix whose equilibration factors are to be computed.
LDALDA is INTEGER The leading dimension of the array A. LDA >= max(1,M).
RR is REAL array, dimension (M) If INFO = 0 or INFO > M, R contains the row scale factors for A.
CC is REAL array, dimension (N) If INFO = 0, C contains the column scale factors for A.
ROWCNDROWCND is REAL If INFO = 0 or INFO > M, ROWCND contains the ratio of the smallest R(i) to the largest R(i). If ROWCND >= 0.1 and AMAX is neither too large nor too small, it is not worth scaling by R.
COLCNDCOLCND is REAL If INFO = 0, COLCND contains the ratio of the smallest C(i) to the largest C(i). If COLCND >= 0.1, it is not worth scaling by C.
AMAXAMAX is REAL Absolute value of largest matrix element. If AMAX is very close to overflow or very close to underflow, the matrix should be scaled.
INFOINFO is INTEGER = 0: successful exit < 0: if INFO = i, the ith argument had an illegal value > 0: if INFO = i, and i is <= M: the ith row of A is exactly zero > M: the (iM)th column of A is exactly zero
Author:

Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date:
 November 2011
subroutine sgehd2 (integer N, integer ILO, integer IHI, real, dimension( lda, * ) A, integer LDA, real, dimension( * ) TAU, real, dimension( * ) WORK, integer INFO)
SGEHD2 reduces a general square matrix to upper Hessenberg form using an unblocked algorithm.
Purpose:

SGEHD2 reduces a real general matrix A to upper Hessenberg form H by an orthogonal similarity transformation: Q**T * A * Q = H .
Parameters:

N
N is INTEGER The order of the matrix A. N >= 0.
ILOILO is INTEGER
IHIIHI is INTEGER It is assumed that A is already upper triangular in rows and columns 1:ILO1 and IHI+1:N. ILO and IHI are normally set by a previous call to SGEBAL; otherwise they should be set to 1 and N respectively. See Further Details. 1 <= ILO <= IHI <= max(1,N).
AA is REAL array, dimension (LDA,N) On entry, the n by n general matrix to be reduced. On exit, the upper triangle and the first subdiagonal of A are overwritten with the upper Hessenberg matrix H, and the elements below the first subdiagonal, with the array TAU, represent the orthogonal matrix Q as a product of elementary reflectors. See Further Details.
LDALDA is INTEGER The leading dimension of the array A. LDA >= max(1,N).
TAUTAU is REAL array, dimension (N1) The scalar factors of the elementary reflectors (see Further Details).
WORKWORK is REAL array, dimension (N)
INFOINFO is INTEGER = 0: successful exit. < 0: if INFO = i, the ith argument had an illegal value.
Author:

Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date:
 September 2012
Further Details:

The matrix Q is represented as a product of (ihiilo) elementary reflectors Q = H(ilo) H(ilo+1) . . . H(ihi1). Each H(i) has the form H(i) = I  tau * v * v**T where tau is a real scalar, and v is a real vector with v(1:i) = 0, v(i+1) = 1 and v(ihi+1:n) = 0; v(i+2:ihi) is stored on exit in A(i+2:ihi,i), and tau in TAU(i). The contents of A are illustrated by the following example, with n = 7, ilo = 2 and ihi = 6: on entry, on exit, ( a a a a a a a ) ( a a h h h h a ) ( a a a a a a ) ( a h h h h a ) ( a a a a a a ) ( h h h h h h ) ( a a a a a a ) ( v2 h h h h h ) ( a a a a a a ) ( v2 v3 h h h h ) ( a a a a a a ) ( v2 v3 v4 h h h ) ( a ) ( a ) where a denotes an element of the original matrix A, h denotes a modified element of the upper Hessenberg matrix H, and vi denotes an element of the vector defining H(i).
subroutine sgehrd (integer N, integer ILO, integer IHI, real, dimension( lda, * ) A, integer LDA, real, dimension( * ) TAU, real, dimension( * ) WORK, integer LWORK, integer INFO)
SGEHRD
Purpose:

SGEHRD reduces a real general matrix A to upper Hessenberg form H by an orthogonal similarity transformation: Q**T * A * Q = H .
Parameters:

N
N is INTEGER The order of the matrix A. N >= 0.
ILOILO is INTEGER
IHIIHI is INTEGER It is assumed that A is already upper triangular in rows and columns 1:ILO1 and IHI+1:N. ILO and IHI are normally set by a previous call to SGEBAL; otherwise they should be set to 1 and N respectively. See Further Details. 1 <= ILO <= IHI <= N, if N > 0; ILO=1 and IHI=0, if N=0.
AA is REAL array, dimension (LDA,N) On entry, the NbyN general matrix to be reduced. On exit, the upper triangle and the first subdiagonal of A are overwritten with the upper Hessenberg matrix H, and the elements below the first subdiagonal, with the array TAU, represent the orthogonal matrix Q as a product of elementary reflectors. See Further Details.
LDALDA is INTEGER The leading dimension of the array A. LDA >= max(1,N).
TAUTAU is REAL array, dimension (N1) The scalar factors of the elementary reflectors (see Further Details). Elements 1:ILO1 and IHI:N1 of TAU are set to zero.
WORKWORK is REAL array, dimension (LWORK) On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
LWORKLWORK is INTEGER The length of the array WORK. LWORK >= max(1,N). For good performance, LWORK should generally be larger. 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.
INFOINFO is INTEGER = 0: successful exit < 0: if INFO = i, the ith argument had an illegal value.
Author:

Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date:
 November 2015
Further Details:

The matrix Q is represented as a product of (ihiilo) elementary reflectors Q = H(ilo) H(ilo+1) . . . H(ihi1). Each H(i) has the form H(i) = I  tau * v * v**T where tau is a real scalar, and v is a real vector with v(1:i) = 0, v(i+1) = 1 and v(ihi+1:n) = 0; v(i+2:ihi) is stored on exit in A(i+2:ihi,i), and tau in TAU(i). The contents of A are illustrated by the following example, with n = 7, ilo = 2 and ihi = 6: on entry, on exit, ( a a a a a a a ) ( a a h h h h a ) ( a a a a a a ) ( a h h h h a ) ( a a a a a a ) ( h h h h h h ) ( a a a a a a ) ( v2 h h h h h ) ( a a a a a a ) ( v2 v3 h h h h ) ( a a a a a a ) ( v2 v3 v4 h h h ) ( a ) ( a ) where a denotes an element of the original matrix A, h denotes a modified element of the upper Hessenberg matrix H, and vi denotes an element of the vector defining H(i). This file is a slight modification of LAPACK3.0's DGEHRD subroutine incorporating improvements proposed by QuintanaOrti and Van de Geijn (2006). (See DLAHR2.)
subroutine sgelq2 (integer M, integer N, real, dimension( lda, * ) A, integer LDA, real, dimension( * ) TAU, real, dimension( * ) WORK, integer INFO)
SGELQ2 computes the LQ factorization of a general rectangular matrix using an unblocked algorithm.
Purpose:

SGELQ2 computes an LQ factorization of a real m by n matrix A: A = L * Q.
Parameters:

M
M is INTEGER The number of rows of the matrix A. M >= 0.
NN is INTEGER The number of columns of the matrix A. N >= 0.
AA is REAL array, dimension (LDA,N) On entry, the m by n matrix A. On exit, the elements on and below the diagonal of the array contain the m by min(m,n) lower trapezoidal matrix L (L is lower triangular if m <= n); the elements above the diagonal, with the array TAU, represent the orthogonal matrix Q as a product of elementary reflectors (see Further Details).
LDALDA is INTEGER The leading dimension of the array A. LDA >= max(1,M).
TAUTAU is REAL array, dimension (min(M,N)) The scalar factors of the elementary reflectors (see Further Details).
WORKWORK is REAL array, dimension (M)
INFOINFO is INTEGER = 0: successful exit < 0: if INFO = i, the ith argument had an illegal value
Author:

Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date:
 September 2012
Further Details:

The matrix Q is represented as a product of elementary reflectors Q = H(k) . . . H(2) H(1), where k = min(m,n). Each H(i) has the form H(i) = I  tau * v * v**T where tau is a real scalar, and v is a real vector with v(1:i1) = 0 and v(i) = 1; v(i+1:n) is stored on exit in A(i,i+1:n), and tau in TAU(i).
subroutine sgelqf (integer M, integer N, real, dimension( lda, * ) A, integer LDA, real, dimension( * ) TAU, real, dimension( * ) WORK, integer LWORK, integer INFO)
SGELQF
Purpose:

SGELQF computes an LQ factorization of a real MbyN matrix A: A = L * Q.
Parameters:

M
M is INTEGER The number of rows of the matrix A. M >= 0.
NN is INTEGER The number of columns of the matrix A. N >= 0.
AA is REAL array, dimension (LDA,N) On entry, the MbyN matrix A. On exit, the elements on and below the diagonal of the array contain the mbymin(m,n) lower trapezoidal matrix L (L is lower triangular if m <= n); the elements above the diagonal, with the array TAU, represent the orthogonal matrix Q as a product of elementary reflectors (see Further Details).
LDALDA is INTEGER The leading dimension of the array A. LDA >= max(1,M).
TAUTAU is REAL array, dimension (min(M,N)) The scalar factors of the elementary reflectors (see Further Details).
WORKWORK is REAL array, dimension (MAX(1,LWORK)) On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
LWORKLWORK is INTEGER The dimension of the array WORK. LWORK >= max(1,M). For optimum performance LWORK >= M*NB, where NB is the optimal blocksize. 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.
INFOINFO is INTEGER = 0: successful exit < 0: if INFO = i, the ith argument had an illegal value
Author:

Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date:
 November 2011
Further Details:

The matrix Q is represented as a product of elementary reflectors Q = H(k) . . . H(2) H(1), where k = min(m,n). Each H(i) has the form H(i) = I  tau * v * v**T where tau is a real scalar, and v is a real vector with v(1:i1) = 0 and v(i) = 1; v(i+1:n) is stored on exit in A(i,i+1:n), and tau in TAU(i).
subroutine sgemqrt (character SIDE, character TRANS, integer M, integer N, integer K, integer NB, real, dimension( ldv, * ) V, integer LDV, real, dimension( ldt, * ) T, integer LDT, real, dimension( ldc, * ) C, integer LDC, real, dimension( * ) WORK, integer INFO)
SGEMQRT
Purpose:

SGEMQRT overwrites the general real MbyN matrix C with SIDE = 'L' SIDE = 'R' TRANS = 'N': Q C C Q TRANS = 'T': Q**T C C Q**T where Q is a real orthogonal matrix defined as the product of K elementary reflectors: Q = H(1) H(2) . . . H(K) = I  V T V**T generated using the compact WY representation as returned by SGEQRT. Q is of order M if SIDE = 'L' and of order N if SIDE = 'R'.
Parameters:

SIDE
SIDE is CHARACTER*1 = 'L': apply Q or Q**T from the Left; = 'R': apply Q or Q**T from the Right.
TRANSTRANS is CHARACTER*1 = 'N': No transpose, apply Q; = 'T': Transpose, apply Q**T.
MM is INTEGER The number of rows of the matrix C. M >= 0.
NN is INTEGER The number of columns of the matrix C. N >= 0.
KK is INTEGER The number of elementary reflectors whose product defines the matrix Q. If SIDE = 'L', M >= K >= 0; if SIDE = 'R', N >= K >= 0.
NBNB is INTEGER The block size used for the storage of T. K >= NB >= 1. This must be the same value of NB used to generate T in CGEQRT.
VV is REAL array, dimension (LDV,K) The ith column must contain the vector which defines the elementary reflector H(i), for i = 1,2,...,k, as returned by CGEQRT in the first K columns of its array argument A.
LDVLDV is INTEGER The leading dimension of the array V. If SIDE = 'L', LDA >= max(1,M); if SIDE = 'R', LDA >= max(1,N).
TT is REAL array, dimension (LDT,K) The upper triangular factors of the block reflectors as returned by CGEQRT, stored as a NBbyN matrix.
LDTLDT is INTEGER The leading dimension of the array T. LDT >= NB.
CC is REAL array, dimension (LDC,N) On entry, the MbyN matrix C. On exit, C is overwritten by Q C, Q**T C, C Q**T or C Q.
LDCLDC is INTEGER The leading dimension of the array C. LDC >= max(1,M).
WORKWORK is REAL array. The dimension of WORK is N*NB if SIDE = 'L', or M*NB if SIDE = 'R'.
INFOINFO is INTEGER = 0: successful exit < 0: if INFO = i, the ith argument had an illegal value
Author:

Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date:
 November 2013
subroutine sgeql2 (integer M, integer N, real, dimension( lda, * ) A, integer LDA, real, dimension( * ) TAU, real, dimension( * ) WORK, integer INFO)
SGEQL2 computes the QL factorization of a general rectangular matrix using an unblocked algorithm.
Purpose:

SGEQL2 computes a QL factorization of a real m by n matrix A: A = Q * L.
Parameters:

M
M is INTEGER The number of rows of the matrix A. M >= 0.
NN is INTEGER The number of columns of the matrix A. N >= 0.
AA is REAL array, dimension (LDA,N) On entry, the m by n matrix A. On exit, if m >= n, the lower triangle of the subarray A(mn+1:m,1:n) contains the n by n lower triangular matrix L; if m <= n, the elements on and below the (nm)th superdiagonal contain the m by n lower trapezoidal matrix L; the remaining elements, with the array TAU, represent the orthogonal matrix Q as a product of elementary reflectors (see Further Details).
LDALDA is INTEGER The leading dimension of the array A. LDA >= max(1,M).
TAUTAU is REAL array, dimension (min(M,N)) The scalar factors of the elementary reflectors (see Further Details).
WORKWORK is REAL array, dimension (N)
INFOINFO is INTEGER = 0: successful exit < 0: if INFO = i, the ith argument had an illegal value
Author:

Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date:
 September 2012
Further Details:

The matrix Q is represented as a product of elementary reflectors Q = H(k) . . . H(2) H(1), where k = min(m,n). Each H(i) has the form H(i) = I  tau * v * v**T where tau is a real scalar, and v is a real vector with v(mk+i+1:m) = 0 and v(mk+i) = 1; v(1:mk+i1) is stored on exit in A(1:mk+i1,nk+i), and tau in TAU(i).
subroutine sgeqlf (integer M, integer N, real, dimension( lda, * ) A, integer LDA, real, dimension( * ) TAU, real, dimension( * ) WORK, integer LWORK, integer INFO)
SGEQLF
Purpose:

SGEQLF computes a QL factorization of a real MbyN matrix A: A = Q * L.
Parameters:

M
M is INTEGER The number of rows of the matrix A. M >= 0.
NN is INTEGER The number of columns of the matrix A. N >= 0.
AA is REAL array, dimension (LDA,N) On entry, the MbyN matrix A. On exit, if m >= n, the lower triangle of the subarray A(mn+1:m,1:n) contains the NbyN lower triangular matrix L; if m <= n, the elements on and below the (nm)th superdiagonal contain the MbyN lower trapezoidal matrix L; the remaining elements, with the array TAU, represent the orthogonal matrix Q as a product of elementary reflectors (see Further Details).
LDALDA is INTEGER The leading dimension of the array A. LDA >= max(1,M).
TAUTAU is REAL array, dimension (min(M,N)) The scalar factors of the elementary reflectors (see Further Details).
WORKWORK is REAL array, dimension (MAX(1,LWORK)) On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
LWORKLWORK is INTEGER The dimension of the array WORK. LWORK >= max(1,N). For optimum performance LWORK >= N*NB, where NB is the optimal blocksize. 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.
INFOINFO is INTEGER = 0: successful exit < 0: if INFO = i, the ith argument had an illegal value
Author:

Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date:
 November 2011
Further Details:

The matrix Q is represented as a product of elementary reflectors Q = H(k) . . . H(2) H(1), where k = min(m,n). Each H(i) has the form H(i) = I  tau * v * v**T where tau is a real scalar, and v is a real vector with v(mk+i+1:m) = 0 and v(mk+i) = 1; v(1:mk+i1) is stored on exit in A(1:mk+i1,nk+i), and tau in TAU(i).
subroutine sgeqp3 (integer M, integer N, real, dimension( lda, * ) A, integer LDA, integer, dimension( * ) JPVT, real, dimension( * ) TAU, real, dimension( * ) WORK, integer LWORK, integer INFO)
SGEQP3
Purpose:

SGEQP3 computes a QR factorization with column pivoting of a matrix A: A*P = Q*R using Level 3 BLAS.
Parameters:

M
M is INTEGER The number of rows of the matrix A. M >= 0.
NN is INTEGER The number of columns of the matrix A. N >= 0.
AA is REAL array, dimension (LDA,N) On entry, the MbyN matrix A. On exit, the upper triangle of the array contains the min(M,N)byN upper trapezoidal matrix R; the elements below the diagonal, together with the array TAU, represent the orthogonal matrix Q as a product of min(M,N) elementary reflectors.
LDALDA is INTEGER The leading dimension of the array A. LDA >= max(1,M).
JPVTJPVT is INTEGER array, dimension (N) On entry, if JPVT(J).ne.0, the Jth column of A is permuted to the front of A*P (a leading column); if JPVT(J)=0, the Jth column of A is a free column. On exit, if JPVT(J)=K, then the Jth column of A*P was the the Kth column of A.
TAUTAU is REAL array, dimension (min(M,N)) The scalar factors of the elementary reflectors.
WORKWORK is REAL array, dimension (MAX(1,LWORK)) On exit, if INFO=0, WORK(1) returns the optimal LWORK.
LWORKLWORK is INTEGER The dimension of the array WORK. LWORK >= 3*N+1. For optimal performance LWORK >= 2*N+( N+1 )*NB, where NB is the optimal blocksize. 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.
INFOINFO is INTEGER = 0: successful exit. < 0: if INFO = i, the ith argument had an illegal value.
Author:

Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date:
 November 2015
Further Details:

The matrix Q is represented as a product of elementary reflectors Q = H(1) H(2) . . . H(k), where k = min(m,n). Each H(i) has the form H(i) = I  tau * v * v**T where tau is a real scalar, and v is a real/complex vector with v(1:i1) = 0 and v(i) = 1; v(i+1:m) is stored on exit in A(i+1:m,i), and tau in TAU(i).
Contributors:
 G. QuintanaOrti, Depto. de Informatica, Universidad Jaime I, Spain X. Sun, Computer Science Dept., Duke University, USA
subroutine sgeqpf (integer M, integer N, real, dimension( lda, * ) A, integer LDA, integer, dimension( * ) JPVT, real, dimension( * ) TAU, real, dimension( * ) WORK, integer INFO)
SGEQPF
Purpose:

This routine is deprecated and has been replaced by routine SGEQP3. SGEQPF computes a QR factorization with column pivoting of a real MbyN matrix A: A*P = Q*R.
Parameters:

M
M is INTEGER The number of rows of the matrix A. M >= 0.
NN is INTEGER The number of columns of the matrix A. N >= 0
AA is REAL array, dimension (LDA,N) On entry, the MbyN matrix A. On exit, the upper triangle of the array contains the min(M,N)byN upper triangular matrix R; the elements below the diagonal, together with the array TAU, represent the orthogonal matrix Q as a product of min(m,n) elementary reflectors.
LDALDA is INTEGER The leading dimension of the array A. LDA >= max(1,M).
JPVTJPVT is INTEGER array, dimension (N) On entry, if JPVT(i) .ne. 0, the ith column of A is permuted to the front of A*P (a leading column); if JPVT(i) = 0, the ith column of A is a free column. On exit, if JPVT(i) = k, then the ith column of A*P was the kth column of A.
TAUTAU is REAL array, dimension (min(M,N)) The scalar factors of the elementary reflectors.
WORKWORK is REAL array, dimension (3*N)
INFOINFO is INTEGER = 0: successful exit < 0: if INFO = i, the ith argument had an illegal value
Author:

Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date:
 November 2011
Further Details:

The matrix Q is represented as a product of elementary reflectors Q = H(1) H(2) . . . H(n) Each H(i) has the form H = I  tau * v * v**T where tau is a real scalar, and v is a real vector with v(1:i1) = 0 and v(i) = 1; v(i+1:m) is stored on exit in A(i+1:m,i). The matrix P is represented in jpvt as follows: If jpvt(j) = i then the jth column of P is the ith canonical unit vector. Partial column norm updating strategy modified by Z. Drmac and Z. Bujanovic, Dept. of Mathematics, University of Zagreb, Croatia.  April 2011  For more details see LAPACK Working Note 176.
subroutine sgeqr2 (integer M, integer N, real, dimension( lda, * ) A, integer LDA, real, dimension( * ) TAU, real, dimension( * ) WORK, integer INFO)
SGEQR2 computes the QR factorization of a general rectangular matrix using an unblocked algorithm.
Purpose:

SGEQR2 computes a QR factorization of a real m by n matrix A: A = Q * R.
Parameters:

M
M is INTEGER The number of rows of the matrix A. M >= 0.
NN is INTEGER The number of columns of the matrix A. N >= 0.
AA is REAL array, dimension (LDA,N) On entry, the m by n matrix A. On exit, the elements on and above the diagonal of the array contain the min(m,n) by n upper trapezoidal matrix R (R is upper triangular if m >= n); the elements below the diagonal, with the array TAU, represent the orthogonal matrix Q as a product of elementary reflectors (see Further Details).
LDALDA is INTEGER The leading dimension of the array A. LDA >= max(1,M).
TAUTAU is REAL array, dimension (min(M,N)) The scalar factors of the elementary reflectors (see Further Details).
WORKWORK is REAL array, dimension (N)
INFOINFO is INTEGER = 0: successful exit < 0: if INFO = i, the ith argument had an illegal value
Author:

Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date:
 September 2012
Further Details:

The matrix Q is represented as a product of elementary reflectors Q = H(1) H(2) . . . H(k), where k = min(m,n). Each H(i) has the form H(i) = I  tau * v * v**T where tau is a real scalar, and v is a real vector with v(1:i1) = 0 and v(i) = 1; v(i+1:m) is stored on exit in A(i+1:m,i), and tau in TAU(i).
subroutine sgeqr2p (integer M, integer N, real, dimension( lda, * ) A, integer LDA, real, dimension( * ) TAU, real, dimension( * ) WORK, integer INFO)
SGEQR2P computes the QR factorization of a general rectangular matrix with nonnegative diagonal elements using an unblocked algorithm.
Purpose:

SGEQR2P computes a QR factorization of a real m by n matrix A: A = Q * R. The diagonal entries of R are nonnegative.
Parameters:

M
M is INTEGER The number of rows of the matrix A. M >= 0.
NN is INTEGER The number of columns of the matrix A. N >= 0.
AA is REAL array, dimension (LDA,N) On entry, the m by n matrix A. On exit, the elements on and above the diagonal of the array contain the min(m,n) by n upper trapezoidal matrix R (R is upper triangular if m >= n). The diagonal entries of R are nonnegative; the elements below the diagonal, with the array TAU, represent the orthogonal matrix Q as a product of elementary reflectors (see Further Details).
LDALDA is INTEGER The leading dimension of the array A. LDA >= max(1,M).
TAUTAU is REAL array, dimension (min(M,N)) The scalar factors of the elementary reflectors (see Further Details).
WORKWORK is REAL array, dimension (N)
INFOINFO is INTEGER = 0: successful exit < 0: if INFO = i, the ith argument had an illegal value
Author:

Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date:
 November 2015
Further Details:

The matrix Q is represented as a product of elementary reflectors Q = H(1) H(2) . . . H(k), where k = min(m,n). Each H(i) has the form H(i) = I  tau * v * v**T where tau is a real scalar, and v is a real vector with v(1:i1) = 0 and v(i) = 1; v(i+1:m) is stored on exit in A(i+1:m,i), and tau in TAU(i). See Lapack Working Note 203 for details
subroutine sgeqrf (integer M, integer N, real, dimension( lda, * ) A, integer LDA, real, dimension( * ) TAU, real, dimension( * ) WORK, integer LWORK, integer INFO)
SGEQRF
Purpose:

SGEQRF computes a QR factorization of a real MbyN matrix A: A = Q * R.
Parameters:

M
M is INTEGER The number of rows of the matrix A. M >= 0.
NN is INTEGER The number of columns of the matrix A. N >= 0.
AA is REAL array, dimension (LDA,N) On entry, the MbyN matrix A. On exit, the elements on and above the diagonal of the array contain the min(M,N)byN upper trapezoidal matrix R (R is upper triangular if m >= n); the elements below the diagonal, with the array TAU, represent the orthogonal matrix Q as a product of min(m,n) elementary reflectors (see Further Details).
LDALDA is INTEGER The leading dimension of the array A. LDA >= max(1,M).
TAUTAU is REAL array, dimension (min(M,N)) The scalar factors of the elementary reflectors (see Further Details).
WORKWORK is REAL array, dimension (MAX(1,LWORK)) On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
LWORKLWORK is INTEGER The dimension of the array WORK. LWORK >= max(1,N). For optimum performance LWORK >= N*NB, where NB is the optimal blocksize. 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.
INFOINFO is INTEGER = 0: successful exit < 0: if INFO = i, the ith argument had an illegal value
Author:

Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date:
 November 2011
Further Details:

The matrix Q is represented as a product of elementary reflectors Q = H(1) H(2) . . . H(k), where k = min(m,n). Each H(i) has the form H(i) = I  tau * v * v**T where tau is a real scalar, and v is a real vector with v(1:i1) = 0 and v(i) = 1; v(i+1:m) is stored on exit in A(i+1:m,i), and tau in TAU(i).
subroutine sgeqrfp (integer M, integer N, real, dimension( lda, * ) A, integer LDA, real, dimension( * ) TAU, real, dimension( * ) WORK, integer LWORK, integer INFO)
SGEQRFP
Purpose:

SGEQRFP computes a QR factorization of a real MbyN matrix A: A = Q * R. The diagonal entries of R are nonnegative.
Parameters:

M
M is INTEGER The number of rows of the matrix A. M >= 0.
NN is INTEGER The number of columns of the matrix A. N >= 0.
AA is REAL array, dimension (LDA,N) On entry, the MbyN matrix A. On exit, the elements on and above the diagonal of the array contain the min(M,N)byN upper trapezoidal matrix R (R is upper triangular if m >= n). The diagonal entries of R are nonnegative; the elements below the diagonal, with the array TAU, represent the orthogonal matrix Q as a product of min(m,n) elementary reflectors (see Further Details).
LDALDA is INTEGER The leading dimension of the array A. LDA >= max(1,M).
TAUTAU is REAL array, dimension (min(M,N)) The scalar factors of the elementary reflectors (see Further Details).
WORKWORK is REAL array, dimension (MAX(1,LWORK)) On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
LWORKLWORK is INTEGER The dimension of the array WORK. LWORK >= max(1,N). For optimum performance LWORK >= N*NB, where NB is the optimal blocksize. 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.
INFOINFO is INTEGER = 0: successful exit < 0: if INFO = i, the ith argument had an illegal value
Author:

Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date:
 November 2015
Further Details:

The matrix Q is represented as a product of elementary reflectors Q = H(1) H(2) . . . H(k), where k = min(m,n). Each H(i) has the form H(i) = I  tau * v * v**T where tau is a real scalar, and v is a real vector with v(1:i1) = 0 and v(i) = 1; v(i+1:m) is stored on exit in A(i+1:m,i), and tau in TAU(i). See Lapack Working Note 203 for details
subroutine sgeqrt (integer M, integer N, integer NB, real, dimension( lda, * ) A, integer LDA, real, dimension( ldt, * ) T, integer LDT, real, dimension( * ) WORK, integer INFO)
SGEQRT
Purpose:

SGEQRT computes a blocked QR factorization of a real MbyN matrix A using the compact WY representation of Q.
Parameters:

M
M is INTEGER The number of rows of the matrix A. M >= 0.
NN is INTEGER The number of columns of the matrix A. N >= 0.
NBNB is INTEGER The block size to be used in the blocked QR. MIN(M,N) >= NB >= 1.
AA is REAL array, dimension (LDA,N) On entry, the MbyN matrix A. On exit, the elements on and above the diagonal of the array contain the min(M,N)byN upper trapezoidal matrix R (R is upper triangular if M >= N); the elements below the diagonal are the columns of V.
LDALDA is INTEGER The leading dimension of the array A. LDA >= max(1,M).
TT is REAL array, dimension (LDT,MIN(M,N)) The upper triangular block reflectors stored in compact form as a sequence of upper triangular blocks. See below for further details.
LDTLDT is INTEGER The leading dimension of the array T. LDT >= NB.
WORKWORK is REAL array, dimension (NB*N)
INFOINFO is INTEGER = 0: successful exit < 0: if INFO = i, the ith argument had an illegal value
Author:

Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date:
 November 2013
Further Details:

The matrix V stores the elementary reflectors H(i) in the ith column below the diagonal. For example, if M=5 and N=3, the matrix V is V = ( 1 ) ( v1 1 ) ( v1 v2 1 ) ( v1 v2 v3 ) ( v1 v2 v3 ) where the vi's represent the vectors which define H(i), which are returned in the matrix A. The 1's along the diagonal of V are not stored in A. Let K=MIN(M,N). The number of blocks is B = ceiling(K/NB), where each block is of order NB except for the last block, which is of order IB = K  (B1)*NB. For each of the B blocks, a upper triangular block reflector factor is computed: T1, T2, ..., TB. The NBbyNB (and IBbyIB for the last block) T's are stored in the NBbyN matrix T as T = (T1 T2 ... TB).
subroutine sgeqrt2 (integer M, integer N, real, dimension( lda, * ) A, integer LDA, real, dimension( ldt, * ) T, integer LDT, integer INFO)
SGEQRT2 computes a QR factorization of a general real or complex matrix using the compact WY representation of Q.
Purpose:

SGEQRT2 computes a QR factorization of a real MbyN matrix A, using the compact WY representation of Q.
Parameters:

M
M is INTEGER The number of rows of the matrix A. M >= N.
NN is INTEGER The number of columns of the matrix A. N >= 0.
AA is REAL array, dimension (LDA,N) On entry, the real MbyN matrix A. On exit, the elements on and above the diagonal contain the NbyN upper triangular matrix R; the elements below the diagonal are the columns of V. See below for further details.
LDALDA is INTEGER The leading dimension of the array A. LDA >= max(1,M).
TT is REAL array, dimension (LDT,N) The NbyN upper triangular factor of the block reflector. The elements on and above the diagonal contain the block reflector T; the elements below the diagonal are not used. See below for further details.
LDTLDT is INTEGER The leading dimension of the array T. LDT >= max(1,N).
INFOINFO is INTEGER = 0: successful exit < 0: if INFO = i, the ith argument had an illegal value
Author:

Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date:
 September 2012
Further Details:

The matrix V stores the elementary reflectors H(i) in the ith column below the diagonal. For example, if M=5 and N=3, the matrix V is V = ( 1 ) ( v1 1 ) ( v1 v2 1 ) ( v1 v2 v3 ) ( v1 v2 v3 ) where the vi's represent the vectors which define H(i), which are returned in the matrix A. The 1's along the diagonal of V are not stored in A. The block reflector H is then given by H = I  V * T * V**T where V**T is the transpose of V.
recursive subroutine sgeqrt3 (integer M, integer N, real, dimension( lda, * ) A, integer LDA, real, dimension( ldt, * ) T, integer LDT, integer INFO)
SGEQRT3 recursively computes a QR factorization of a general real or complex matrix using the compact WY representation of Q.
Purpose:

SGEQRT3 recursively computes a QR factorization of a real MbyN matrix A, using the compact WY representation of Q. Based on the algorithm of Elmroth and Gustavson, IBM J. Res. Develop. Vol 44 No. 4 July 2000.
Parameters:

M
M is INTEGER The number of rows of the matrix A. M >= N.
NN is INTEGER The number of columns of the matrix A. N >= 0.
AA is REAL array, dimension (LDA,N) On entry, the real MbyN matrix A. On exit, the elements on and above the diagonal contain the NbyN upper triangular matrix R; the elements below the diagonal are the columns of V. See below for further details.
LDALDA is INTEGER The leading dimension of the array A. LDA >= max(1,M).
TT is REAL array, dimension (LDT,N) The NbyN upper triangular factor of the block reflector. The elements on and above the diagonal contain the block reflector T; the elements below the diagonal are not used. See below for further details.
LDTLDT is INTEGER The leading dimension of the array T. LDT >= max(1,N).
INFOINFO is INTEGER = 0: successful exit < 0: if INFO = i, the ith argument had an illegal value
Author:

Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date:
 June 2016
Further Details:

The matrix V stores the elementary reflectors H(i) in the ith column below the diagonal. For example, if M=5 and N=3, the matrix V is V = ( 1 ) ( v1 1 ) ( v1 v2 1 ) ( v1 v2 v3 ) ( v1 v2 v3 ) where the vi's represent the vectors which define H(i), which are returned in the matrix A. The 1's along the diagonal of V are not stored in A. The block reflector H is then given by H = I  V * T * V**T where V**T is the transpose of V. For details of the algorithm, see Elmroth and Gustavson (cited above).
subroutine sgerfs (character TRANS, integer N, integer NRHS, real, dimension( lda, * ) A, integer LDA, real, dimension( ldaf, * ) AF, integer LDAF, integer, dimension( * ) IPIV, real, dimension( ldb, * ) B, integer LDB, real, dimension( ldx, * ) X, integer LDX, real, dimension( * ) FERR, real, dimension( * ) BERR, real, dimension( * ) WORK, integer, dimension( * ) IWORK, integer INFO)
SGERFS
Purpose:

SGERFS improves the computed solution to a system of linear equations and provides error bounds and backward error estimates for the solution.
Parameters:

TRANS
TRANS is CHARACTER*1 Specifies the form of the system of equations: = 'N': A * X = B (No transpose) = 'T': A**T * X = B (Transpose) = 'C': A**H * X = B (Conjugate transpose = Transpose)
NN is INTEGER The order of the matrix A. N >= 0.
NRHSNRHS is INTEGER The number of right hand sides, i.e., the number of columns of the matrices B and X. NRHS >= 0.
AA is REAL array, dimension (LDA,N) The original NbyN matrix A.
LDALDA is INTEGER The leading dimension of the array A. LDA >= max(1,N).
AFAF is REAL array, dimension (LDAF,N) The factors L and U from the factorization A = P*L*U as computed by SGETRF.
LDAFLDAF is INTEGER The leading dimension of the array AF. LDAF >= max(1,N).
IPIVIPIV is INTEGER array, dimension (N) The pivot indices from SGETRF; for 1<=i<=N, row i of the matrix was interchanged with row IPIV(i).
BB is REAL array, dimension (LDB,NRHS) The right hand side matrix B.
LDBLDB is INTEGER The leading dimension of the array B. LDB >= max(1,N).
XX is REAL array, dimension (LDX,NRHS) On entry, the solution matrix X, as computed by SGETRS. On exit, the improved solution matrix X.
LDXLDX is INTEGER The leading dimension of the array X. LDX >= max(1,N).
FERRFERR is REAL array, dimension (NRHS) The estimated forward error bound for each solution vector X(j) (the jth column of the solution matrix X). If XTRUE is the true solution corresponding to X(j), FERR(j) is an estimated upper bound for the magnitude of the largest element in (X(j)  XTRUE) divided by the magnitude of the largest element in X(j). The estimate is as reliable as the estimate for RCOND, and is almost always a slight overestimate of the true error.
BERRBERR is REAL array, dimension (NRHS) The componentwise relative backward error of each solution vector X(j) (i.e., the smallest relative change in any element of A or B that makes X(j) an exact solution).
WORKWORK is REAL array, dimension (3*N)
IWORKIWORK is INTEGER array, dimension (N)
INFOINFO is INTEGER = 0: successful exit < 0: if INFO = i, the ith argument had an illegal value
Internal Parameters:

ITMAX is the maximum number of steps of iterative refinement.
Author:

Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date:
 November 2011
subroutine sgerfsx (character TRANS, character EQUED, integer N, integer NRHS, real, dimension( lda, * ) A, integer LDA, real, dimension( ldaf, * ) AF, integer LDAF, integer, dimension( * ) IPIV, real, dimension( * ) R, real, dimension( * ) C, real, dimension( ldb, * ) B, integer LDB, real, dimension( ldx , * ) X, integer LDX, real RCOND, real, dimension( * ) BERR, integer N_ERR_BNDS, real, dimension( nrhs, * ) ERR_BNDS_NORM, real, dimension( nrhs, * ) ERR_BNDS_COMP, integer NPARAMS, real, dimension( * ) PARAMS, real, dimension( * ) WORK, integer, dimension( * ) IWORK, integer INFO)
SGERFSX
Purpose:

SGERFSX improves the computed solution to a system of linear equations 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 comments for ERR_BNDS_NORM and ERR_BNDS_COMP for details of the error bounds. The original system of linear equations may have been equilibrated before calling this routine, as described by arguments EQUED, R and C below. In this case, the solution and error bounds returned are for the original unequilibrated system.
Some optional parameters are bundled in the PARAMS array. These settings determine how refinement is performed, but often the defaults are acceptable. If the defaults are acceptable, users can pass NPARAMS = 0 which prevents the source code from accessing the PARAMS argument.
Parameters:

TRANS
TRANS is CHARACTER*1 Specifies the form of the system of equations: = 'N': A * X = B (No transpose) = 'T': A**T * X = B (Transpose) = 'C': A**H * X = B (Conjugate transpose = Transpose)
EQUEDEQUED is CHARACTER*1 Specifies the form of equilibration that was done to A before calling this routine. This is needed to compute the solution and error bounds correctly. = 'N': No equilibration = 'R': Row equilibration, i.e., A has been premultiplied by diag(R). = 'C': Column equilibration, i.e., A has been postmultiplied by diag(C). = 'B': Both row and column equilibration, i.e., A has been replaced by diag(R) * A * diag(C). The right hand side B has been changed accordingly.
NN is INTEGER The order of the matrix A. N >= 0.
NRHSNRHS is INTEGER The number of right hand sides, i.e., the number of columns of the matrices B and X. NRHS >= 0.
AA is REAL array, dimension (LDA,N) The original NbyN matrix A.
LDALDA is INTEGER The leading dimension of the array A. LDA >= max(1,N).
AFAF is REAL array, dimension (LDAF,N) The factors L and U from the factorization A = P*L*U as computed by SGETRF.
LDAFLDAF is INTEGER The leading dimension of the array AF. LDAF >= max(1,N).
IPIVIPIV is INTEGER array, dimension (N) The pivot indices from SGETRF; for 1<=i<=N, row i of the matrix was interchanged with row IPIV(i).
RR is REAL array, dimension (N) The row scale factors for A. If EQUED = 'R' or 'B', A is multiplied on the left by diag(R); if EQUED = 'N' or 'C', R is not accessed. If R is accessed, each element of R should be a power of the radix to ensure a reliable solution and error estimates. Scaling by powers of the radix does not cause rounding errors unless the result underflows or overflows. Rounding errors during scaling lead to refining with a matrix that is not equivalent to the input matrix, producing error estimates that may not be reliable.
CC is REAL array, dimension (N) The column scale factors for A. If EQUED = 'C' or 'B', A is multiplied on the right by diag(C); if EQUED = 'N' or 'R', C is not accessed. If C is accessed, each element of C should be a power of the radix to ensure a reliable solution and error estimates. Scaling by powers of the radix does not cause rounding errors unless the result underflows or overflows. Rounding errors during scaling lead to refining with a matrix that is not equivalent to the input matrix, producing error estimates that may not be reliable.
BB is REAL array, dimension (LDB,NRHS) The right hand side matrix B.
LDBLDB is INTEGER The leading dimension of the array B. LDB >= max(1,N).
XX is REAL array, dimension (LDX,NRHS) On entry, the solution matrix X, as computed by SGETRS. On exit, the improved solution matrix X.
LDXLDX is INTEGER The leading dimension of the array X. LDX >= max(1,N).
RCONDRCOND is REAL Reciprocal scaled condition number. This is an estimate of the reciprocal Skeel condition number of the matrix A after equilibration (if done). If this is less than the machine precision (in particular, if it is zero), the matrix is singular to working precision. Note that the error may still be small even if this number is very small and the matrix appears ill conditioned.
BERRBERR is REAL array, dimension (NRHS) Componentwise relative backward error. This is the componentwise relative backward error of each solution vector X(j) (i.e., the smallest relative change in any element of A or B that makes X(j) an exact solution).
N_ERR_BNDSN_ERR_BNDS is INTEGER Number of error bounds to return for each right hand side and each type (normwise or componentwise). See ERR_BNDS_NORM and ERR_BNDS_COMP below.
ERR_BNDS_NORMERR_BNDS_NORM is REAL array, dimension (NRHS, N_ERR_BNDS) For each righthand side, this array contains information about various error bounds and condition numbers corresponding to the normwise relative error, which is defined as follows: Normwise relative error in the ith solution vector: max_j (abs(XTRUE(j,i)  X(j,i)))  max_j abs(X(j,i)) The array is indexed by the type of error information as described below. There currently are up to three pieces of information returned. The first index in ERR_BNDS_NORM(i,:) corresponds to the ith righthand side. The second index in ERR_BNDS_NORM(:,err) contains the following three fields: err = 1 "Trust/don't trust" boolean. Trust the answer if the reciprocal condition number is less than the threshold sqrt(n) * slamch('Epsilon'). err = 2 "Guaranteed" error bound: The estimated forward error, almost certainly within a factor of 10 of the true error so long as the next entry is greater than the threshold sqrt(n) * slamch('Epsilon'). This error bound should only be trusted if the previous boolean is true. err = 3 Reciprocal condition number: Estimated normwise reciprocal condition number. Compared with the threshold sqrt(n) * slamch('Epsilon') to determine if the error estimate is "guaranteed". These reciprocal condition numbers are 1 / (norm(Z^{1},inf) * norm(Z,inf)) for some appropriately scaled matrix Z. Let Z = S*A, where S scales each row by a power of the radix so all absolute row sums of Z are approximately 1. See Lapack Working Note 165 for further details and extra cautions.
ERR_BNDS_COMPERR_BNDS_COMP is REAL array, dimension (NRHS, N_ERR_BNDS) For each righthand side, this array contains information about various error bounds and condition numbers corresponding to the componentwise relative error, which is defined as follows: Componentwise relative error in the ith solution vector: abs(XTRUE(j,i)  X(j,i)) max_j  abs(X(j,i)) The array is indexed by the righthand side i (on which the componentwise relative error depends), and the type of error information as described below. There currently are up to three pieces of information returned for each righthand 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 the first (:,N_ERR_BNDS) entries are returned. The first index in ERR_BNDS_COMP(i,:) corresponds to the ith righthand side. The second index in ERR_BNDS_COMP(:,err) contains the following three fields: err = 1 "Trust/don't trust" boolean. Trust the answer if the reciprocal condition number is less than the threshold sqrt(n) * slamch('Epsilon'). err = 2 "Guaranteed" error bound: The estimated forward error, almost certainly within a factor of 10 of the true error so long as the next entry is greater than the threshold sqrt(n) * slamch('Epsilon'). This error bound should only be trusted if the previous boolean is true. err = 3 Reciprocal condition number: Estimated componentwise reciprocal condition number. Compared with the threshold sqrt(n) * slamch('Epsilon') to determine if the error estimate is "guaranteed". These reciprocal condition numbers are 1 / (norm(Z^{1},inf) * norm(Z,inf)) for some appropriately scaled matrix Z. Let Z = S*(A*diag(x)), where x is the solution for the current righthand side and S scales each row of A*diag(x) by a power of the radix so all absolute row sums of Z are approximately 1. See Lapack Working Note 165 for further details and extra cautions.
NPARAMSNPARAMS is INTEGER Specifies the number of parameters set in PARAMS. If .LE. 0, the PARAMS array is never referenced and default values are used.
PARAMSPARAMS is REAL array, dimension NPARAMS Specifies algorithm parameters. If an entry is .LT. 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 highernumbered parameters. 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 computed. = 1.0 : Use the doubleprecision refinement algorithm, possibly with doubledsingle computations if the compilation environment does not support DOUBLE PRECISION. (other values are reserved for future use) PARAMS(LA_LINRX_ITHRESH_I = 2) : Maximum number of residual computations allowed for refinement. Default: 10 Aggressive: Set to 100 to permit convergence using approximate factorizations or factorizations other than LU. If the factorization uses a technique other than Gaussian elimination, the guarantees in err_bnds_norm and err_bnds_comp may no longer be trustworthy. PARAMS(LA_LINRX_CWISE_I = 3) : Flag determining if the code will attempt to find a solution with small componentwise relative error in the doubleprecision algorithm. Positive is true, 0.0 is false. Default: 1.0 (attempt componentwise convergence)
WORKWORK is REAL array, dimension (4*N)
IWORKIWORK is INTEGER array, dimension (N)
INFOINFO is INTEGER = 0: Successful exit. The solution to every righthand side is guaranteed. < 0: If INFO = i, the ith argument had an illegal value > 0 and <= N: U(INFO,INFO) is exactly zero. The factorization has been completed, but the factor U is exactly singular, so the solution and error bounds could not be computed. RCOND = 0 is returned. = N+J: The solution corresponding to the Jth righthand side is not guaranteed. The solutions corresponding to other right hand sides K with K > J may not be guaranteed as well, but only the first such righthand side is reported. If a small componentwise error is not requested (PARAMS(3) = 0.0) then the Jth righthand side is the first with a normwise error bound that is not guaranteed (the smallest J such that ERR_BNDS_NORM(J,1) = 0.0). By default (PARAMS(3) = 1.0) the Jth righthand side is the first with either a normwise or componentwise error bound that is not guaranteed (the smallest J such that either ERR_BNDS_NORM(J,1) = 0.0 or ERR_BNDS_COMP(J,1) = 0.0). See the definition of ERR_BNDS_NORM(:,1) and ERR_BNDS_COMP(:,1). To get information about all of the righthand sides check ERR_BNDS_NORM or ERR_BNDS_COMP.
Author:

Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date:
 November 2011
subroutine sgerq2 (integer M, integer N, real, dimension( lda, * ) A, integer LDA, real, dimension( * ) TAU, real, dimension( * ) WORK, integer INFO)
SGERQ2 computes the RQ factorization of a general rectangular matrix using an unblocked algorithm.
Purpose:

SGERQ2 computes an RQ factorization of a real m by n matrix A: A = R * Q.
Parameters:

M
M is INTEGER The number of rows of the matrix A. M >= 0.
NN is INTEGER The number of columns of the matrix A. N >= 0.
AA is REAL array, dimension (LDA,N) On entry, the m by n matrix A. On exit, if m <= n, the upper triangle of the subarray A(1:m,nm+1:n) contains the m by m upper triangular matrix R; if m >= n, the elements on and above the (mn)th subdiagonal contain the m by n upper trapezoidal matrix R; the remaining elements, with the array TAU, represent the orthogonal matrix Q as a product of elementary reflectors (see Further Details).
LDALDA is INTEGER The leading dimension of the array A. LDA >= max(1,M).
TAUTAU is REAL array, dimension (min(M,N)) The scalar factors of the elementary reflectors (see Further Details).
WORKWORK is REAL array, dimension (M)
INFOINFO is INTEGER = 0: successful exit < 0: if INFO = i, the ith argument had an illegal value
Author:

Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date:
 September 2012
Further Details:

The matrix Q is represented as a product of elementary reflectors Q = H(1) H(2) . . . H(k), where k = min(m,n). Each H(i) has the form H(i) = I  tau * v * v**T where tau is a real scalar, and v is a real vector with v(nk+i+1:n) = 0 and v(nk+i) = 1; v(1:nk+i1) is stored on exit in A(mk+i,1:nk+i1), and tau in TAU(i).
subroutine sgerqf (integer M, integer N, real, dimension( lda, * ) A, integer LDA, real, dimension( * ) TAU, real, dimension( * ) WORK, integer LWORK, integer INFO)
SGERQF
Purpose:

SGERQF computes an RQ factorization of a real MbyN matrix A: A = R * Q.
Parameters:

M
M is INTEGER The number of rows of the matrix A. M >= 0.
NN is INTEGER The number of columns of the matrix A. N >= 0.
AA is REAL array, dimension (LDA,N) On entry, the MbyN matrix A. On exit, if m <= n, the upper triangle of the subarray A(1:m,nm+1:n) contains the MbyM upper triangular matrix R; if m >= n, the elements on and above the (mn)th subdiagonal contain the MbyN upper trapezoidal matrix R; the remaining elements, with the array TAU, represent the orthogonal matrix Q as a product of min(m,n) elementary reflectors (see Further Details).
LDALDA is INTEGER The leading dimension of the array A. LDA >= max(1,M).
TAUTAU is REAL array, dimension (min(M,N)) The scalar factors of the elementary reflectors (see Further Details).
WORKWORK is REAL array, dimension (MAX(1,LWORK)) On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
LWORKLWORK is INTEGER The dimension of the array WORK. LWORK >= max(1,M). For optimum performance LWORK >= M*NB, where NB is the optimal blocksize. 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.
INFOINFO is INTEGER = 0: successful exit < 0: if INFO = i, the ith argument had an illegal value
Author:

Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date:
 November 2011
Further Details:

The matrix Q is represented as a product of elementary reflectors Q = H(1) H(2) . . . H(k), where k = min(m,n). Each H(i) has the form H(i) = I  tau * v * v**T where tau is a real scalar, and v is a real vector with v(nk+i+1:n) = 0 and v(nk+i) = 1; v(1:nk+i1) is stored on exit in A(mk+i,1:nk+i1), and tau in TAU(i).
subroutine sgesvj (character*1 JOBA, character*1 JOBU, character*1 JOBV, integer M, integer N, real, dimension( lda, * ) A, integer LDA, real, dimension( n ) SVA, integer MV, real, dimension( ldv, * ) V, integer LDV, real, dimension( lwork ) WORK, integer LWORK, integer INFO)
SGESVJ
Purpose:

SGESVJ computes the singular value decomposition (SVD) of a real MbyN matrix A, where M >= N. The SVD of A is written as [++] [xx] [x0] [xx] A = U * SIGMA * V^t, [++] = [xx] * [ox] * [xx] [++] [xx] where SIGMA is an NbyN diagonal matrix, U is an MbyN orthonormal matrix, and V is an NbyN orthogonal matrix. The diagonal elements of SIGMA are the singular values of A. The columns of U and V are the left and the right singular vectors of A, respectively. SGESVJ can sometimes compute tiny singular values and their singular vectors much more accurately than other SVD routines, see below under Further Details.
Parameters:

JOBA
JOBA is CHARACTER* 1 Specifies the structure of A. = 'L': The input matrix A is lower triangular; = 'U': The input matrix A is upper triangular; = 'G': The input matrix A is general MbyN matrix, M >= N.
JOBUJOBU is CHARACTER*1 Specifies whether to compute the left singular vectors (columns of U): = 'U': The left singular vectors corresponding to the nonzero singular values are computed and returned in the leading columns of A. See more details in the description of A. The default numerical orthogonality threshold is set to approximately TOL=CTOL*EPS, CTOL=SQRT(M), EPS=SLAMCH('E'). = 'C': Analogous to JOBU='U', except that user can control the level of numerical orthogonality of the computed left singular vectors. TOL can be set to TOL = CTOL*EPS, where CTOL is given on input in the array WORK. No CTOL smaller than ONE is allowed. CTOL greater than 1 / EPS is meaningless. The option 'C' can be used if M*EPS is satisfactory orthogonality of the computed left singular vectors, so CTOL=M could save few sweeps of Jacobi rotations. See the descriptions of A and WORK(1). = 'N': The matrix U is not computed. However, see the description of A.
JOBVJOBV is CHARACTER*1 Specifies whether to compute the right singular vectors, that is, the matrix V: = 'V' : the matrix V is computed and returned in the array V = 'A' : the Jacobi rotations are applied to the MVbyN array V. In other words, the right singular vector matrix V is not computed explicitly; instead it is applied to an MVbyN matrix initially stored in the first MV rows of V. = 'N' : the matrix V is not computed and the array V is not referenced
MM is INTEGER The number of rows of the input matrix A. 1/SLAMCH('E') > M >= 0.
NN is INTEGER The number of columns of the input matrix A. M >= N >= 0.
AA is REAL array, dimension (LDA,N) On entry, the MbyN matrix A. On exit, If JOBU .EQ. 'U' .OR. JOBU .EQ. 'C': If INFO .EQ. 0 : RANKA orthonormal columns of U are returned in the leading RANKA columns of the array A. Here RANKA <= N is the number of computed singular values of A that are above the underflow threshold SLAMCH('S'). The singular vectors corresponding to underflowed or zero singular values are not computed. The value of RANKA is returned in the array WORK as RANKA=NINT(WORK(2)). Also see the descriptions of SVA and WORK. The computed columns of U are mutually numerically orthogonal up to approximately TOL=SQRT(M)*EPS (default); or TOL=CTOL*EPS (JOBU.EQ.'C'), see the description of JOBU. If INFO .GT. 0, the procedure SGESVJ did not converge in the given number of iterations (sweeps). In that case, the computed columns of U may not be orthogonal up to TOL. The output U (stored in A), SIGMA (given by the computed singular values in SVA(1:N)) and V is still a decomposition of the input matrix A in the sense that the residual ASCALE*U*SIGMA*V^T_2 / A_2 is small. If JOBU .EQ. 'N': If INFO .EQ. 0 : Note that the left singular vectors are 'for free' in the onesided Jacobi SVD algorithm. However, if only the singular values are needed, the level of numerical orthogonality of U is not an issue and iterations are stopped when the columns of the iterated matrix are numerically orthogonal up to approximately M*EPS. Thus, on exit, A contains the columns of U scaled with the corresponding singular values. If INFO .GT. 0 : the procedure SGESVJ did not converge in the given number of iterations (sweeps).
LDALDA is INTEGER The leading dimension of the array A. LDA >= max(1,M).
SVASVA is REAL array, dimension (N) On exit, If INFO .EQ. 0 : depending on the value SCALE = WORK(1), we have: If SCALE .EQ. ONE: SVA(1:N) contains the computed singular values of A. During the computation SVA contains the Euclidean column norms of the iterated matrices in the array A. If SCALE .NE. ONE: The singular values of A are SCALE*SVA(1:N), and this factored representation is due to the fact that some of the singular values of A might underflow or overflow. If INFO .GT. 0 : the procedure SGESVJ did not converge in the given number of iterations (sweeps) and SCALE*SVA(1:N) may not be accurate.
MVMV is INTEGER If JOBV .EQ. 'A', then the product of Jacobi rotations in SGESVJ is applied to the first MV rows of V. See the description of JOBV.
VV is REAL array, dimension (LDV,N) If JOBV = 'V', then V contains on exit the NbyN matrix of the right singular vectors; If JOBV = 'A', then V contains the product of the computed right singular vector matrix and the initial matrix in the array V. If JOBV = 'N', then V is not referenced.
LDVLDV is INTEGER The leading dimension of the array V, LDV .GE. 1. If JOBV .EQ. 'V', then LDV .GE. max(1,N). If JOBV .EQ. 'A', then LDV .GE. max(1,MV) .
WORKWORK is REAL array, dimension max(4,M+N). On entry, If JOBU .EQ. 'C' : WORK(1) = CTOL, where CTOL defines the threshold for convergence. The process stops if all columns of A are mutually orthogonal up to CTOL*EPS, EPS=SLAMCH('E'). It is required that CTOL >= ONE, i.e. it is not allowed to force the routine to obtain orthogonality below EPSILON. On exit, WORK(1) = SCALE is the scaling factor such that SCALE*SVA(1:N) are the computed singular vcalues of A. (See description of SVA().) WORK(2) = NINT(WORK(2)) is the number of the computed nonzero singular values. WORK(3) = NINT(WORK(3)) is the number of the computed singular values that are larger than the underflow threshold. WORK(4) = NINT(WORK(4)) is the number of sweeps of Jacobi rotations needed for numerical convergence. WORK(5) = max_{i.NE.j} COS(A(:,i),A(:,j)) in the last sweep. This is useful information in cases when SGESVJ did not converge, as it can be used to estimate whether the output is stil useful and for post festum analysis. WORK(6) = the largest absolute value over all sines of the Jacobi rotation angles in the last sweep. It can be useful for a post festum analysis.
LWORKLWORK is INTEGER length of WORK, WORK >= MAX(6,M+N)
INFOINFO is INTEGER = 0 : successful exit. < 0 : if INFO = i, then the ith argument had an illegal value > 0 : SGESVJ did not converge in the maximal allowed number (30) of sweeps. The output may still be useful. See the description of WORK.
Author:

Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date:
 November 2015
Further Details:

The orthogonal NbyN matrix V is obtained as a product of Jacobi plane rotations. The rotations are implemented as fast scaled rotations of Anda and Park [1]. In the case of underflow of the Jacobi angle, a modified Jacobi transformation of Drmac [4] is used. Pivot strategy uses column interchanges of de Rijk [2]. The relative accuracy of the computed singular values and the accuracy of the computed singular vectors (in angle metric) is as guaranteed by the theory of Demmel and Veselic [3]. The condition number that determines the accuracy in the full rank case is essentially min_{D=diag} kappa(A*D), where kappa(.) is the spectral condition number. The best performance of this Jacobi SVD procedure is achieved if used in an accelerated version of Drmac and Veselic [5,6], and it is the kernel routine in the SIGMA library [7]. Some tunning parameters (marked with [TP]) are available for the implementer.
The computational range for the nonzero singular values is the machine number interval ( UNDERFLOW , OVERFLOW ). In extreme cases, even denormalized singular values can be computed with the corresponding gradual loss of accurate digits.
Contributors:
 Zlatko Drmac (Zagreb, Croatia) and Kresimir Veselic (Hagen, Germany)
References:

[1] A. A. Anda and H. Park: Fast plane rotations with dynamic scaling.
SIAM J. matrix Anal. Appl., Vol. 15 (1994), pp. 162174.
[2] P. P. M. De Rijk: A onesided Jacobi algorithm for computing the singular value decomposition on a vector computer.
SIAM J. Sci. Stat. Comp., Vol. 10 (1998), pp. 359371.
[3] J. Demmel and K. Veselic: Jacobi method is more accurate than QR.
[4] Z. Drmac: Implementation of Jacobi rotations for accurate singular value computation in floating point arithmetic.
SIAM J. Sci. Comp., Vol. 18 (1997), pp. 12001222.
[5] Z. Drmac and K. Veselic: New fast and accurate Jacobi SVD algorithm I.
SIAM J. Matrix Anal. Appl. Vol. 35, No. 2 (2008), pp. 13221342.
LAPACK Working note 169.
[6] Z. Drmac and K. Veselic: New fast and accurate Jacobi SVD algorithm II.
SIAM J. Matrix Anal. Appl. Vol. 35, No. 2 (2008), pp. 13431362.
LAPACK Working note 170.
[7] Z. Drmac: SIGMA  mathematical software library for accurate SVD, PSV, QSVD, (H,K)SVD computations.
Department of Mathematics, University of Zagreb, 2008.
Bugs, Examples and Comments:
 Please report all bugs and send interesting test examples and comments to [email protected]. Thank you.
subroutine sgetf2 (integer M, integer N, real, dimension( lda, * ) A, integer LDA, integer, dimension( * ) IPIV, integer INFO)
SGETF2 computes the LU factorization of a general mbyn matrix using partial pivoting with row interchanges (unblocked algorithm).
Purpose:

SGETF2 computes an LU factorization of a general mbyn matrix A using partial pivoting with row interchanges. The factorization has the form A = P * L * U where P is a permutation matrix, L is lower triangular with unit diagonal elements (lower trapezoidal if m > n), and U is upper triangular (upper trapezoidal if m < n). This is the rightlooking Level 2 BLAS version of the algorithm.
Parameters:

M
M is INTEGER The number of rows of the matrix A. M >= 0.
NN is INTEGER The number of columns of the matrix A. N >= 0.
AA is REAL 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 = P*L*U; the unit diagonal elements of L are not stored.
LDALDA is INTEGER The leading dimension of the array A. LDA >= max(1,M).
IPIVIPIV is INTEGER array, dimension (min(M,N)) The pivot indices; for 1 <= i <= min(M,N), row i of the matrix was interchanged with row IPIV(i).
INFOINFO is INTEGER = 0: successful exit < 0: if INFO = k, the kth argument had an illegal value > 0: if INFO = k, U(k,k) is exactly zero. The factorization has been completed, but the factor U is exactly singular, and division by zero will occur if it is used to solve a system of equations.
Author:

Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date:
 September 2012
subroutine sgetrf (integer M, integer N, real, dimension( lda, * ) A, integer LDA, integer, dimension( * ) IPIV, integer INFO)
SGETRF
Purpose:

SGETRF computes an LU factorization of a general MbyN matrix A using partial pivoting with row interchanges. The factorization has the form A = P * L * U where P is a permutation matrix, L is lower triangular with unit diagonal elements (lower trapezoidal if m > n), and U is upper triangular (upper trapezoidal if m < n). This is the rightlooking Level 3 BLAS version of the algorithm.
Parameters:

M
M is INTEGER The number of rows of the matrix A. M >= 0.
NN is INTEGER The number of columns of the matrix A. N >= 0.
AA is REAL array, dimension (LDA,N) On entry, the MbyN matrix to be factored. On exit, the factors L and U from the factorization A = P*L*U; the unit diagonal elements of L are not stored.
LDALDA is INTEGER The leading dimension of the array A. LDA >= max(1,M).
IPIVIPIV is INTEGER array, dimension (min(M,N)) The pivot indices; for 1 <= i <= min(M,N), row i of the matrix was interchanged with row IPIV(i).
INFOINFO is INTEGER = 0: successful exit < 0: if INFO = i, the ith argument had an illegal value > 0: if INFO = i, U(i,i) is exactly zero. The factorization has been completed, but the factor U is exactly singular, and division by zero will occur if it is used to solve a system of equations.
Author:

Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date:
 November 2015
recursive subroutine sgetrf2 (integer M, integer N, real, dimension( lda, * ) A, integer LDA, integer, dimension( * ) IPIV, integer INFO)
SGETRF2
Purpose:

SGETRF2 computes an LU factorization of a general MbyN matrix A using partial pivoting with row interchanges. The factorization has the form A = P * L * U where P is a permutation matrix, L is lower triangular with unit diagonal elements (lower trapezoidal if m > n), and U is upper triangular (upper trapezoidal if m < n). This is the recursive version of the algorithm. It divides the matrix into four submatrices: [ A11  A12 ] where A11 is n1 by n1 and A22 is n2 by n2 A = [ —— ] with n1 = min(m,n)/2 [ A11 ] The subroutine calls itself to factor [  ], [ A12 ] [ A12 ] do the swaps on [  ], solve A12, update A22, [ A22 ] then calls itself to factor A22 and do the swaps on A21.
Parameters:

M
M is INTEGER The number of rows of the matrix A. M >= 0.
NN is INTEGER The number of columns of the matrix A. N >= 0.
AA is REAL array, dimension (LDA,N) On entry, the MbyN matrix to be factored. On exit, the factors L and U from the factorization A = P*L*U; the unit diagonal elements of L are not stored.
LDALDA is INTEGER The leading dimension of the array A. LDA >= max(1,M).
IPIVIPIV is INTEGER array, dimension (min(M,N)) The pivot indices; for 1 <= i <= min(M,N), row i of the matrix was interchanged with row IPIV(i).
INFOINFO is INTEGER = 0: successful exit < 0: if INFO = i, the ith argument had an illegal value > 0: if INFO = i, U(i,i) is exactly zero. The factorization has been completed, but the factor U is exactly singular, and division by zero will occur if it is used to solve a system of equations.
Author:

Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date:
 June 2016
subroutine sgetri (integer N, real, dimension( lda, * ) A, integer LDA, integer, dimension( * ) IPIV, real, dimension( * ) WORK, integer LWORK, integer INFO)
SGETRI
Purpose:

SGETRI computes the inverse of a matrix using the LU factorization computed by SGETRF. This method inverts U and then computes inv(A) by solving the system inv(A)*L = inv(U) for inv(A).
Parameters:

N
N is INTEGER The order of the matrix A. N >= 0.
AA is REAL array, dimension (LDA,N) On entry, the factors L and U from the factorization A = P*L*U as computed by SGETRF. On exit, if INFO = 0, the inverse of the original matrix A.
LDALDA is INTEGER The leading dimension of the array A. LDA >= max(1,N).
IPIVIPIV is INTEGER array, dimension (N) The pivot indices from SGETRF; for 1<=i<=N, row i of the matrix was interchanged with row IPIV(i).
WORKWORK is REAL array, dimension (MAX(1,LWORK)) On exit, if INFO=0, then WORK(1) returns the optimal LWORK.
LWORKLWORK is INTEGER The dimension of the array WORK. LWORK >= max(1,N). For optimal performance LWORK >= N*NB, where NB is the optimal blocksize returned by ILAENV. 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.
INFOINFO is INTEGER = 0: successful exit < 0: if INFO = i, the ith argument had an illegal value > 0: if INFO = i, U(i,i) is exactly zero; the matrix is singular and its inverse could not be computed.
Author:

Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date:
 November 2011
subroutine sgetrs (character TRANS, integer N, integer NRHS, real, dimension( lda, * ) A, integer LDA, integer, dimension( * ) IPIV, real, dimension( ldb, * ) B, integer LDB, integer INFO)
SGETRS
Purpose:

SGETRS solves a system of linear equations A * X = B or A**T * X = B with a general NbyN matrix A using the LU factorization computed by SGETRF.
Parameters:

TRANS
TRANS is CHARACTER*1 Specifies the form of the system of equations: = 'N': A * X = B (No transpose) = 'T': A**T* X = B (Transpose) = 'C': A**T* X = B (Conjugate transpose = Transpose)
NN is INTEGER The order of the matrix A. N >= 0.
NRHSNRHS is INTEGER The number of right hand sides, i.e., the number of columns of the matrix B. NRHS >= 0.
AA is REAL array, dimension (LDA,N) The factors L and U from the factorization A = P*L*U as computed by SGETRF.
LDALDA is INTEGER The leading dimension of the array A. LDA >= max(1,N).
IPIVIPIV is INTEGER array, dimension (N) The pivot indices from SGETRF; for 1<=i<=N, row i of the matrix was interchanged with row IPIV(i).
BB is REAL array, dimension (LDB,NRHS) On entry, the right hand side matrix B. On exit, the solution matrix X.
LDBLDB is INTEGER The leading dimension of the array B. LDB >= max(1,N).
INFOINFO is INTEGER = 0: successful exit < 0: if INFO = i, the ith argument had an illegal value
Author:

Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date:
 November 2011
subroutine shgeqz (character JOB, character COMPQ, character COMPZ, integer N, integer ILO, integer IHI, real, dimension( ldh, * ) H, integer LDH, real, dimension( ldt, * ) T, integer LDT, real, dimension( * ) ALPHAR, real, dimension( * ) ALPHAI, real, dimension( * ) BETA, real, dimension( ldq, * ) Q, integer LDQ, real, dimension( ldz, * ) Z, integer LDZ, real, dimension( * ) WORK, integer LWORK, integer INFO)
SHGEQZ
Purpose:

SHGEQZ computes the eigenvalues of a real matrix pair (H,T), where H is an upper Hessenberg matrix and T is upper triangular, using the doubleshift QZ method. Matrix pairs of this type are produced by the reduction to generalized upper Hessenberg form of a real matrix pair (A,B): A = Q1*H*Z1**T, B = Q1*T*Z1**T, as computed by SGGHRD. If JOB='S', then the Hessenbergtriangular pair (H,T) is also reduced to generalized Schur form, H = Q*S*Z**T, T = Q*P*Z**T, where Q and Z are orthogonal matrices, P is an upper triangular matrix, and S is a quasitriangular matrix with 1by1 and 2by2 diagonal blocks. The 1by1 blocks correspond to real eigenvalues of the matrix pair (H,T) and the 2by2 blocks correspond to complex conjugate pairs of eigenvalues. Additionally, the 2by2 upper triangular diagonal blocks of P corresponding to 2by2 blocks of S are reduced to positive diagonal form, i.e., if S(j+1,j) is nonzero, then P(j+1,j) = P(j,j+1) = 0, P(j,j) > 0, and P(j+1,j+1) > 0. Optionally, the orthogonal matrix Q from the generalized Schur factorization may be postmultiplied into an input matrix Q1, and the orthogonal matrix Z may be postmultiplied into an input matrix Z1. If Q1 and Z1 are the orthogonal matrices from SGGHRD that reduced the matrix pair (A,B) to generalized upper Hessenberg form, then the output matrices Q1*Q and Z1*Z are the orthogonal factors from the generalized Schur factorization of (A,B): A = (Q1*Q)*S*(Z1*Z)**T, B = (Q1*Q)*P*(Z1*Z)**T. To avoid overflow, eigenvalues of the matrix pair (H,T) (equivalently, of (A,B)) are computed as a pair of values (alpha,beta), where alpha is complex and beta real. If beta is nonzero, lambda = alpha / beta is an eigenvalue of the generalized nonsymmetric eigenvalue problem (GNEP) A*x = lambda*B*x and if alpha is nonzero, mu = beta / alpha is an eigenvalue of the alternate form of the GNEP mu*A*y = B*y. Real eigenvalues can be read directly from the generalized Schur form: alpha = S(i,i), beta = P(i,i). Ref: C.B. Moler & G.W. Stewart, "An Algorithm for Generalized Matrix Eigenvalue Problems", SIAM J. Numer. Anal., 10(1973), pp. 241256.
Parameters:

JOB
JOB is CHARACTER*1 = 'E': Compute eigenvalues only; = 'S': Compute eigenvalues and the Schur form.
COMPQCOMPQ is CHARACTER*1 = 'N': Left Schur vectors (Q) are not computed; = 'I': Q is initialized to the unit matrix and the matrix Q of left Schur vectors of (H,T) is returned; = 'V': Q must contain an orthogonal matrix Q1 on entry and the product Q1*Q is returned.
COMPZCOMPZ is CHARACTER*1 = 'N': Right Schur vectors (Z) are not computed; = 'I': Z is initialized to the unit matrix and the matrix Z of right Schur vectors of (H,T) is returned; = 'V': Z must contain an orthogonal matrix Z1 on entry and the product Z1*Z is returned.
NN is INTEGER The order of the matrices H, T, Q, and Z. N >= 0.
ILOILO is INTEGER
IHIIHI is INTEGER ILO and IHI mark the rows and columns of H which are in Hessenberg form. It is assumed that A is already upper triangular in rows and columns 1:ILO1 and IHI+1:N. If N > 0, 1 <= ILO <= IHI <= N; if N = 0, ILO=1 and IHI=0.
HH is REAL array, dimension (LDH, N) On entry, the NbyN upper Hessenberg matrix H. On exit, if JOB = 'S', H contains the upper quasitriangular matrix S from the generalized Schur factorization. If JOB = 'E', the diagonal blocks of H match those of S, but the rest of H is unspecified.
LDHLDH is INTEGER The leading dimension of the array H. LDH >= max( 1, N ).
TT is REAL array, dimension (LDT, N) On entry, the NbyN upper triangular matrix T. On exit, if JOB = 'S', T contains the upper triangular matrix P from the generalized Schur factorization; 2by2 diagonal blocks of P corresponding to 2by2 blocks of S are reduced to positive diagonal form, i.e., if H(j+1,j) is nonzero, then T(j+1,j) = T(j,j+1) = 0, T(j,j) > 0, and T(j+1,j+1) > 0. If JOB = 'E', the diagonal blocks of T match those of P, but the rest of T is unspecified.
LDTLDT is INTEGER The leading dimension of the array T. LDT >= max( 1, N ).
ALPHARALPHAR is REAL array, dimension (N) The real parts of each scalar alpha defining an eigenvalue of GNEP.
ALPHAIALPHAI is REAL array, dimension (N) The imaginary parts of each scalar alpha defining an eigenvalue of GNEP. If ALPHAI(j) is zero, then the jth eigenvalue is real; if positive, then the jth and (j+1)st eigenvalues are a complex conjugate pair, with ALPHAI(j+1) = ALPHAI(j).
BETABETA is REAL array, dimension (N) The scalars beta that define the eigenvalues of GNEP. Together, the quantities alpha = (ALPHAR(j),ALPHAI(j)) and beta = BETA(j) represent the jth eigenvalue of the matrix pair (A,B), in one of the forms lambda = alpha/beta or mu = beta/alpha. Since either lambda or mu may overflow, they should not, in general, be computed.
QQ is REAL array, dimension (LDQ, N) On entry, if COMPQ = 'V', the orthogonal matrix Q1 used in the reduction of (A,B) to generalized Hessenberg form. On exit, if COMPQ = 'I', the orthogonal matrix of left Schur vectors of (H,T), and if COMPQ = 'V', the orthogonal matrix of left Schur vectors of (A,B). Not referenced if COMPQ = 'N'.
LDQLDQ is INTEGER The leading dimension of the array Q. LDQ >= 1. If COMPQ='V' or 'I', then LDQ >= N.
ZZ is REAL array, dimension (LDZ, N) On entry, if COMPZ = 'V', the orthogonal matrix Z1 used in the reduction of (A,B) to generalized Hessenberg form. On exit, if COMPZ = 'I', the orthogonal matrix of right Schur vectors of (H,T), and if COMPZ = 'V', the orthogonal matrix of right Schur vectors of (A,B). Not referenced if COMPZ = 'N'.
LDZLDZ is INTEGER The leading dimension of the array Z. LDZ >= 1. If COMPZ='V' or 'I', then LDZ >= N.
WORKWORK is REAL array, dimension (MAX(1,LWORK)) On exit, if INFO >= 0, WORK(1) returns the optimal LWORK.
LWORKLWORK is INTEGER The dimension of the array WORK. LWORK >= max(1,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.
INFOINFO is INTEGER = 0: successful exit < 0: if INFO = i, the ith argument had an illegal value = 1,...,N: the QZ iteration did not converge. (H,T) is not in Schur form, but ALPHAR(i), ALPHAI(i), and BETA(i), i=INFO+1,...,N should be correct. = N+1,...,2*N: the shift calculation failed. (H,T) is not in Schur form, but ALPHAR(i), ALPHAI(i), and BETA(i), i=INFON+1,...,N should be correct.
Author:

Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date:
 June 2016
Further Details:

Iteration counters: JITER  counts iterations. IITER  counts iterations run since ILAST was last changed. This is therefore reset only when a 1by1 or 2by2 block deflates off the bottom.
subroutine sla_geamv (integer TRANS, integer M, integer N, real ALPHA, real, dimension( lda, * ) A, integer LDA, real, dimension( * ) X, integer INCX, real BETA, real, dimension( * ) Y, integer INCY)
SLA_GEAMV computes a matrixvector product using a general matrix to calculate error bounds.
Purpose:

SLA_GEAMV performs one of the matrixvector operations y := alpha*abs(A)*abs(x) + beta*abs(y), or y := alpha*abs(A)**T*abs(x) + beta*abs(y), where alpha and beta are scalars, x and y are vectors and A is an m by n matrix. This function is primarily used in calculating error bounds. To protect against underflow during evaluation, components in the resulting vector are perturbed away from zero by (N+1) times the underflow threshold. To prevent unnecessarily large errors for blockstructure embedded in general matrices, "symbolically" zero components are not perturbed. A zero entry is considered "symbolic" if all multiplications involved in computing that entry have at least one zero multiplicand.
Parameters:

TRANS
TRANS is INTEGER On entry, TRANS specifies the operation to be performed as follows: BLAS_NO_TRANS y := alpha*abs(A)*abs(x) + beta*abs(y) BLAS_TRANS y := alpha*abs(A**T)*abs(x) + beta*abs(y) BLAS_CONJ_TRANS y := alpha*abs(A**T)*abs(x) + beta*abs(y) Unchanged on exit.
MM is INTEGER On entry, M specifies the number of rows of the matrix A. M must be at least zero. Unchanged on exit.
NN is INTEGER On entry, N specifies the number of columns of the matrix A. N must be at least zero. Unchanged on exit.
ALPHAALPHA is REAL On entry, ALPHA specifies the scalar alpha. Unchanged on exit.
AA is REAL array of DIMENSION ( LDA, n ) Before entry, the leading m by n part of the array A must contain the matrix of coefficients. Unchanged on exit.
LDALDA is INTEGER On entry, LDA specifies the first dimension of A as declared in the calling (sub) program. LDA must be at least max( 1, m ). Unchanged on exit.
XX is REAL array, dimension ( 1 + ( n  1 )*abs( INCX ) ) when TRANS = 'N' or 'n' and at least ( 1 + ( m  1 )*abs( INCX ) ) otherwise. Before entry, the incremented array X must contain the vector x. Unchanged on exit.
INCXINCX is INTEGER On entry, INCX specifies the increment for the elements of X. INCX must not be zero. Unchanged on exit.
BETABETA is REAL On entry, BETA specifies the scalar beta. When BETA is supplied as zero then Y need not be set on input. Unchanged on exit.
YY is REAL Array of DIMENSION at least ( 1 + ( m  1 )*abs( INCY ) ) when TRANS = 'N' or 'n' and at least ( 1 + ( n  1 )*abs( INCY ) ) otherwise. Before entry with BETA nonzero, the incremented array Y must contain the vector y. On exit, Y is overwritten by the updated vector y.
INCYINCY is INTEGER On entry, INCY specifies the increment for the elements of Y. INCY must not be zero. Unchanged on exit. Level 2 Blas routine.
Author:

Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date:
 September 2012
real function sla_gercond (character TRANS, integer N, real, dimension( lda, * ) A, integer LDA, real, dimension( ldaf, * ) AF, integer LDAF, integer, dimension( * ) IPIV, integer CMODE, real, dimension( * ) C, integer INFO, real, dimension( * ) WORK, integer, dimension( * ) IWORK)
SLA_GERCOND estimates the Skeel condition number for a general matrix.
Purpose:

SLA_GERCOND estimates the Skeel condition number of op(A) * op2(C) where op2 is determined by CMODE as follows CMODE = 1 op2(C) = C CMODE = 0 op2(C) = I CMODE = 1 op2(C) = inv(C) The Skeel condition number cond(A) = norminf( inv(A)A ) is computed by computing scaling factors R such that diag(R)*A*op2(C) is row equilibrated and computing the standard infinitynorm condition number.
Parameters:

TRANS
TRANS is CHARACTER*1 Specifies the form of the system of equations: = 'N': A * X = B (No transpose) = 'T': A**T * X = B (Transpose) = 'C': A**H * X = B (Conjugate Transpose = Transpose)
NN is INTEGER The number of linear equations, i.e., the order of the matrix A. N >= 0.
AA is REAL array, dimension (LDA,N) On entry, the NbyN matrix A.
LDALDA is INTEGER The leading dimension of the array A. LDA >= max(1,N).
AFAF is REAL array, dimension (LDAF,N) The factors L and U from the factorization A = P*L*U as computed by SGETRF.
LDAFLDAF is INTEGER The leading dimension of the array AF. LDAF >= max(1,N).
IPIVIPIV is INTEGER array, dimension (N) The pivot indices from the factorization A = P*L*U as computed by SGETRF; row i of the matrix was interchanged with row IPIV(i).
CMODECMODE is INTEGER Determines op2(C) in the formula op(A) * op2(C) as follows: CMODE = 1 op2(C) = C CMODE = 0 op2(C) = I CMODE = 1 op2(C) = inv(C)
CC is REAL array, dimension (N) The vector C in the formula op(A) * op2(C).
INFOINFO is INTEGER = 0: Successful exit. i > 0: The ith argument is invalid.
WORKWORK is REAL array, dimension (3*N). Workspace.
IWORKIWORK is INTEGER array, dimension (N). Workspace.2
Author:

Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date:
 September 2012
subroutine sla_gerfsx_extended (integer PREC_TYPE, integer TRANS_TYPE, integer N, integer NRHS, real, dimension( lda, * ) A, integer LDA, real, dimension( ldaf, * ) AF, integer LDAF, integer, dimension( * ) IPIV, logical COLEQU, real, dimension( * ) C, real, dimension( ldb, * ) B, integer LDB, real, dimension( ldy, * ) Y, integer LDY, real, dimension( * ) BERR_OUT, integer N_NORMS, real, dimension( nrhs, * ) ERRS_N, real, dimension( nrhs, * ) ERRS_C, real, dimension( * ) RES, real, dimension( * ) AYB, real, dimension( * ) DY, real, dimension( * ) Y_TAIL, real RCOND, integer ITHRESH, real RTHRESH, real DZ_UB, logical IGNORE_CWISE, integer INFO)
SLA_GERFSX_EXTENDED improves the computed solution to a system of linear equations for general matrices by performing extraprecise iterative refinement and provides error bounds and backward error estimates for the solution.
Purpose:

SLA_GERFSX_EXTENDED improves the computed solution to a system of linear equations by performing extraprecise iterative refinement and provides error bounds and backward error estimates for the solution. This subroutine is called by SGERFSX to perform iterative refinement. In addition to normwise error bound, the code provides maximum componentwise error bound if possible. See comments for ERRS_N and ERRS_C for details of the error bounds. Note that this subroutine is only resonsible for setting the second fields of ERRS_N and ERRS_C.
Parameters:

PREC_TYPE
PREC_TYPE is INTEGER Specifies the intermediate precision to be used in refinement. The value is defined by ILAPREC(P) where P is a CHARACTER and P = 'S': Single = 'D': Double = 'I': Indigenous = 'X', 'E': Extra
TRANS_TYPETRANS_TYPE is INTEGER Specifies the transposition operation on A. The value is defined by ILATRANS(T) where T is a CHARACTER and T = 'N': No transpose = 'T': Transpose = 'C': Conjugate transpose
NN is INTEGER The number of linear equations, i.e., the order of the matrix A. N >= 0.
NRHSNRHS is INTEGER The number of righthandsides, i.e., the number of columns of the matrix B.
AA is REAL array, dimension (LDA,N) On entry, the NbyN matrix A.
LDALDA is INTEGER The leading dimension of the array A. LDA >= max(1,N).
AFAF is REAL array, dimension (LDAF,N) The factors L and U from the factorization A = P*L*U as computed by SGETRF.
LDAFLDAF is INTEGER The leading dimension of the array AF. LDAF >= max(1,N).
IPIVIPIV is INTEGER array, dimension (N) The pivot indices from the factorization A = P*L*U as computed by SGETRF; row i of the matrix was interchanged with row IPIV(i).
COLEQUCOLEQU is LOGICAL If .TRUE. then column equilibration was done to A before calling this routine. This is needed to compute the solution and error bounds correctly.
CC is REAL array, dimension (N) The column scale factors for A. If COLEQU = .FALSE., C is not accessed. If C is input, each element of C should be a power of the radix to ensure a reliable solution and error estimates. Scaling by powers of the radix does not cause rounding errors unless the result underflows or overflows. Rounding errors during scaling lead to refining with a matrix that is not equivalent to the input matrix, producing error estimates that may not be reliable.
BB is REAL array, dimension (LDB,NRHS) The righthandside matrix B.
LDBLDB is INTEGER The leading dimension of the array B. LDB >= max(1,N).
YY is REAL array, dimension (LDY,NRHS) On entry, the solution matrix X, as computed by SGETRS. On exit, the improved solution matrix Y.
LDYLDY is INTEGER The leading dimension of the array Y. LDY >= max(1,N).
BERR_OUTBERR_OUT is REAL array, dimension (NRHS) On exit, BERR_OUT(j) contains the componentwise relative backward error for righthandside j from the formula max(i) ( abs(RES(i)) / ( abs(op(A_s))*abs(Y) + abs(B_s) )(i) ) where abs(Z) is the componentwise absolute value of the matrix or vector Z. This is computed by SLA_LIN_BERR.
N_NORMSN_NORMS is INTEGER Determines which error bounds to return (see ERRS_N and ERRS_C). If N_NORMS >= 1 return normwise error bounds. If N_NORMS >= 2 return componentwise error bounds.
ERRS_NERRS_N is REAL array, dimension (NRHS, N_ERR_BNDS) For each righthand side, this array contains information about various error bounds and condition numbers corresponding to the normwise relative error, which is defined as follows: Normwise relative error in the ith solution vector: max_j (abs(XTRUE(j,i)  X(j,i)))  max_j abs(X(j,i)) The array is indexed by the type of error information as described below. There currently are up to three pieces of information returned. The first index in ERRS_N(i,:) corresponds to the ith righthand side. The second index in ERRS_N(:,err) contains the following three fields: err = 1 "Trust/don't trust" boolean. Trust the answer if the reciprocal condition number is less than the threshold sqrt(n) * slamch('Epsilon'). err = 2 "Guaranteed" error bound: The estimated forward error, almost certainly within a factor of 10 of the true error so long as the next entry is greater than the threshold sqrt(n) * slamch('Epsilon'). This error bound should only be trusted if the previous boolean is true. err = 3 Reciprocal condition number: Estimated normwise reciprocal condition number. Compared with the threshold sqrt(n) * slamch('Epsilon') to determine if the error estimate is "guaranteed". These reciprocal condition numbers are 1 / (norm(Z^{1},inf) * norm(Z,inf)) for some appropriately scaled matrix Z. Let Z = S*A, where S scales each row by a power of the radix so all absolute row sums of Z are approximately 1. This subroutine is only responsible for setting the second field above. See Lapack Working Note 165 for further details and extra cautions.
ERRS_CERRS_C is REAL array, dimension (NRHS, N_ERR_BNDS) For each righthand side, this array contains information about various error bounds and condition numbers corresponding to the componentwise relative error, which is defined as follows: Componentwise relative error in the ith solution vector: abs(XTRUE(j,i)  X(j,i)) max_j  abs(X(j,i)) The array is indexed by the righthand side i (on which the componentwise relative error depends), and the type of error information as described below. There currently are up to three pieces of information returned for each righthand side. If componentwise accuracy is not requested (PARAMS(3) = 0.0), then ERRS_C is not accessed. If N_ERR_BNDS .LT. 3, then at most the first (:,N_ERR_BNDS) entries are returned. The first index in ERRS_C(i,:) corresponds to the ith righthand side. The second index in ERRS_C(:,err) contains the following three fields: err = 1 "Trust/don't trust" boolean. Trust the answer if the reciprocal condition number is less than the threshold sqrt(n) * slamch('Epsilon'). err = 2 "Guaranteed" error bound: The estimated forward error, almost certainly within a factor of 10 of the true error so long as the next entry is greater than the threshold sqrt(n) * slamch('Epsilon'). This error bound should only be trusted if the previous boolean is true. err = 3 Reciprocal condition number: Estimated componentwise reciprocal condition number. Compared with the threshold sqrt(n) * slamch('Epsilon') to determine if the error estimate is "guaranteed". These reciprocal condition numbers are 1 / (norm(Z^{1},inf) * norm(Z,inf)) for some appropriately scaled matrix Z. Let Z = S*(A*diag(x)), where x is the solution for the current righthand side and S scales each row of A*diag(x) by a power of the radix so all absolute row sums of Z are approximately 1. This subroutine is only responsible for setting the second field above. See Lapack Working Note 165 for further details and extra cautions.
RESRES is REAL array, dimension (N) Workspace to hold the intermediate residual.
AYBAYB is REAL array, dimension (N) Workspace. This can be the same workspace passed for Y_TAIL.
DYDY is REAL array, dimension (N) Workspace to hold the intermediate solution.
Y_TAILY_TAIL is REAL array, dimension (N) Workspace to hold the trailing bits of the intermediate solution.
RCONDRCOND is REAL Reciprocal scaled condition number. This is an estimate of the reciprocal Skeel condition number of the matrix A after equilibration (if done). If this is less than the machine precision (in particular, if it is zero), the matrix is singular to working precision. Note that the error may still be small even if this number is very small and the matrix appears ill conditioned.
ITHRESHITHRESH is INTEGER The maximum number of residual computations allowed for refinement. The default is 10. For 'aggressive' set to 100 to permit convergence using approximate factorizations or factorizations other than LU. If the factorization uses a technique other than Gaussian elimination, the guarantees in ERRS_N and ERRS_C may no longer be trustworthy.
RTHRESHRTHRESH is REAL Determines when to stop refinement if the error estimate stops decreasing. Refinement will stop when the next solution no longer satisfies norm(dx_{i+1}) < RTHRESH * norm(dx_i) where norm(Z) is the infinity norm of Z. RTHRESH satisfies 0 < RTHRESH <= 1. The default value is 0.5. For 'aggressive' set to 0.9 to permit convergence on extremely illconditioned matrices. See LAWN 165 for more details.
DZ_UBDZ_UB is REAL Determines when to start considering componentwise convergence. Componentwise convergence is only considered after each component of the solution Y is stable, which we definte as the relative change in each component being less than DZ_UB. The default value is 0.25, requiring the first bit to be stable. See LAWN 165 for more details.
IGNORE_CWISEIGNORE_CWISE is LOGICAL If .TRUE. then ignore componentwise convergence. Default value is .FALSE..
INFOINFO is INTEGER = 0: Successful exit. < 0: if INFO = i, the ith argument to SGETRS had an illegal value
Author:

Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date:
 September 2012
real function sla_gerpvgrw (integer N, integer NCOLS, real, dimension( lda, * ) A, integer LDA, real, dimension( ldaf, * ) AF, integer LDAF)
SLA_GERPVGRW
Purpose:

SLA_GERPVGRW computes the reciprocal pivot growth factor norm(A)/norm(U). The "max absolute element" norm is used. If this is much less than 1, the stability of the LU factorization of the (equilibrated) matrix A could be poor. This also means that the solution X, estimated condition numbers, and error bounds could be unreliable.
Parameters:

N
N is INTEGER The number of linear equations, i.e., the order of the matrix A. N >= 0.
NCOLSNCOLS is INTEGER The number of columns of the matrix A. NCOLS >= 0.
AA is REAL array, dimension (LDA,N) On entry, the NbyN matrix A.
LDALDA is INTEGER The leading dimension of the array A. LDA >= max(1,N).
AFAF is REAL array, dimension (LDAF,N) The factors L and U from the factorization A = P*L*U as computed by SGETRF.
LDAFLDAF is INTEGER The leading dimension of the array AF. LDAF >= max(1,N).
Author:

Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date:
 November 2011
subroutine stgevc (character SIDE, character HOWMNY, logical, dimension( * ) SELECT, integer N, real, dimension( lds, * ) S, integer LDS, real, dimension( ldp, * ) P, integer LDP, real, dimension( ldvl, * ) VL, integer LDVL, real, dimension( ldvr, * ) VR, integer LDVR, integer MM, integer M, real, dimension( * ) WORK, integer INFO)
STGEVC
Purpose:

STGEVC computes some or all of the right and/or left eigenvectors of a pair of real matrices (S,P), where S is a quasitriangular matrix and P is upper triangular. Matrix pairs of this type are produced by the generalized Schur factorization of a matrix pair (A,B): A = Q*S*Z**T, B = Q*P*Z**T as computed by SGGHRD + SHGEQZ. The right eigenvector x and the left eigenvector y of (S,P) corresponding to an eigenvalue w are defined by: S*x = w*P*x, (y**H)*S = w*(y**H)*P, where y**H denotes the conjugate tranpose of y. The eigenvalues are not input to this routine, but are computed directly from the diagonal blocks of S and P. This routine returns the matrices X and/or Y of right and left eigenvectors of (S,P), or the products Z*X and/or Q*Y, where Z and Q are input matrices. If Q and Z are the orthogonal factors from the generalized Schur factorization of a matrix pair (A,B), then Z*X and Q*Y are the matrices of right and left eigenvectors of (A,B).
Parameters:

SIDE
SIDE is CHARACTER*1 = 'R': compute right eigenvectors only; = 'L': compute left eigenvectors only; = 'B': compute both right and left eigenvectors.
HOWMNYHOWMNY is CHARACTER*1 = 'A': compute all right and/or left eigenvectors; = 'B': compute all right and/or left eigenvectors, backtransformed by the matrices in VR and/or VL; = 'S': compute selected right and/or left eigenvectors, specified by the logical array SELECT.
SELECTSELECT is LOGICAL array, dimension (N) If HOWMNY='S', SELECT specifies the eigenvectors to be computed. If w(j) is a real eigenvalue, the corresponding real eigenvector is computed if SELECT(j) is .TRUE.. If w(j) and w(j+1) are the real and imaginary parts of a complex eigenvalue, the corresponding complex eigenvector is computed if either SELECT(j) or SELECT(j+1) is .TRUE., and on exit SELECT(j) is set to .TRUE. and SELECT(j+1) is set to .FALSE.. Not referenced if HOWMNY = 'A' or 'B'.
NN is INTEGER The order of the matrices S and P. N >= 0.
SS is REAL array, dimension (LDS,N) The upper quasitriangular matrix S from a generalized Schur factorization, as computed by SHGEQZ.
LDSLDS is INTEGER The leading dimension of array S. LDS >= max(1,N).
PP is REAL array, dimension (LDP,N) The upper triangular matrix P from a generalized Schur factorization, as computed by SHGEQZ. 2by2 diagonal blocks of P corresponding to 2by2 blocks of S must be in positive diagonal form.
LDPLDP is INTEGER The leading dimension of array P. LDP >= max(1,N).
VLVL is REAL array, dimension (LDVL,MM) On entry, if SIDE = 'L' or 'B' and HOWMNY = 'B', VL must contain an NbyN matrix Q (usually the orthogonal matrix Q of left Schur vectors returned by SHGEQZ). On exit, if SIDE = 'L' or 'B', VL contains: if HOWMNY = 'A', the matrix Y of left eigenvectors of (S,P); if HOWMNY = 'B', the matrix Q*Y; if HOWMNY = 'S', the left eigenvectors of (S,P) specified by SELECT, stored consecutively in the columns of VL, in the same order as their eigenvalues. A complex eigenvector corresponding to a complex eigenvalue is stored in two consecutive columns, the first holding the real part, and the second the imaginary part. Not referenced if SIDE = 'R'.
LDVLLDVL is INTEGER The leading dimension of array VL. LDVL >= 1, and if SIDE = 'L' or 'B', LDVL >= N.
VRVR is REAL array, dimension (LDVR,MM) On entry, if SIDE = 'R' or 'B' and HOWMNY = 'B', VR must contain an NbyN matrix Z (usually the orthogonal matrix Z of right Schur vectors returned by SHGEQZ). On exit, if SIDE = 'R' or 'B', VR contains: if HOWMNY = 'A', the matrix X of right eigenvectors of (S,P); if HOWMNY = 'B' or 'b', the matrix Z*X; if HOWMNY = 'S' or 's', the right eigenvectors of (S,P) specified by SELECT, stored consecutively in the columns of VR, in the same order as their eigenvalues. A complex eigenvector corresponding to a complex eigenvalue is stored in two consecutive columns, the first holding the real part and the second the imaginary part. Not referenced if SIDE = 'L'.
LDVRLDVR is INTEGER The leading dimension of the array VR. LDVR >= 1, and if SIDE = 'R' or 'B', LDVR >= N.
MMMM is INTEGER The number of columns in the arrays VL and/or VR. MM >= M.
MM is INTEGER The number of columns in the arrays VL and/or VR actually used to store the eigenvectors. If HOWMNY = 'A' or 'B', M is set to N. Each selected real eigenvector occupies one column and each selected complex eigenvector occupies two columns.
WORKWORK is REAL array, dimension (6*N)
INFOINFO is INTEGER = 0: successful exit. < 0: if INFO = i, the ith argument had an illegal value. > 0: the 2by2 block (INFO:INFO+1) does not have a complex eigenvalue.
Author:

Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date:
 November 2011
Further Details:

Allocation of workspace:    WORK( j ) = 1norm of jth column of A, above the diagonal WORK( N+j ) = 1norm of jth column of B, above the diagonal WORK( 2*N+1:3*N ) = real part of eigenvector WORK( 3*N+1:4*N ) = imaginary part of eigenvector WORK( 4*N+1:5*N ) = real part of backtransformed eigenvector WORK( 5*N+1:6*N ) = imaginary part of backtransformed eigenvector Rowwise vs. columnwise solution methods:      Finding a generalized eigenvector consists basically of solving the singular triangular system (A  w B) x = 0 (for right) or: (A  w B)**H y = 0 (for left) Consider finding the ith right eigenvector (assume all eigenvalues are real). The equation to be solved is: n i 0 = sum C(j,k) v(k) = sum C(j,k) v(k) for j = i,. . .,1 k=j k=j where C = (A  w B) (The components v(i+1:n) are 0.) The "rowwise" method is: (1) v(i) := 1 for j = i1,. . .,1: i (2) compute s =  sum C(j,k) v(k) and k=j+1 (3) v(j) := s / C(j,j) Step 2 is sometimes called the "dot product" step, since it is an inner product between the jth row and the portion of the eigenvector that has been computed so far. The "columnwise" method consists basically in doing the sums for all the rows in parallel. As each v(j) is computed, the contribution of v(j) times the jth column of C is added to the partial sums. Since FORTRAN arrays are stored columnwise, this has the advantage that at each step, the elements of C that are accessed are adjacent to one another, whereas with the rowwise method, the elements accessed at a step are spaced LDS (and LDP) words apart. When finding left eigenvectors, the matrix in question is the transpose of the one in storage, so the rowwise method then actually accesses columns of A and B at each step, and so is the preferred method.
subroutine stgexc (logical WANTQ, logical WANTZ, integer N, real, dimension( lda, * ) A, integer LDA, real, dimension( ldb, * ) B, integer LDB, real, dimension( ldq, * ) Q, integer LDQ, real, dimension( ldz, * ) Z, integer LDZ, integer IFST, integer ILST, real, dimension( * ) WORK, integer LWORK, integer INFO)
STGEXC
Purpose:

STGEXC reorders the generalized real Schur decomposition of a real matrix pair (A,B) using an orthogonal equivalence transformation (A, B) = Q * (A, B) * Z**T, so that the diagonal block of (A, B) with row index IFST is moved to row ILST. (A, B) must be in generalized real Schur canonical form (as returned by SGGES), i.e. A is block upper triangular with 1by1 and 2by2 diagonal blocks. B is upper triangular. Optionally, the matrices Q and Z of generalized Schur vectors are updated. Q(in) * A(in) * Z(in)**T = Q(out) * A(out) * Z(out)**T Q(in) * B(in) * Z(in)**T = Q(out) * B(out) * Z(out)**T
Parameters:

WANTQ
WANTQ is LOGICAL .TRUE. : update the left transformation matrix Q; .FALSE.: do not update Q.
WANTZWANTZ is LOGICAL .TRUE. : update the right transformation matrix Z; .FALSE.: do not update Z.
NN is INTEGER The order of the matrices A and B. N >= 0.
AA is REAL array, dimension (LDA,N) On entry, the matrix A in generalized real Schur canonical form. On exit, the updated matrix A, again in generalized real Schur canonical form.
LDALDA is INTEGER The leading dimension of the array A. LDA >= max(1,N).
BB is REAL array, dimension (LDB,N) On entry, the matrix B in generalized real Schur canonical form (A,B). On exit, the updated matrix B, again in generalized real Schur canonical form (A,B).
LDBLDB is INTEGER The leading dimension of the array B. LDB >= max(1,N).
QQ is REAL array, dimension (LDZ,N) On entry, if WANTQ = .TRUE., the orthogonal matrix Q. On exit, the updated matrix Q. If WANTQ = .FALSE., Q is not referenced.
LDQLDQ is INTEGER The leading dimension of the array Q. LDQ >= 1. If WANTQ = .TRUE., LDQ >= N.
ZZ is REAL array, dimension (LDZ,N) On entry, if WANTZ = .TRUE., the orthogonal matrix Z. On exit, the updated matrix Z. If WANTZ = .FALSE., Z is not referenced.
LDZLDZ is INTEGER The leading dimension of the array Z. LDZ >= 1. If WANTZ = .TRUE., LDZ >= N.
IFSTIFST is INTEGER
ILSTILST is INTEGER Specify the reordering of the diagonal blocks of (A, B). The block with row index IFST is moved to row ILST, by a sequence of swapping between adjacent blocks. On exit, if IFST pointed on entry to the second row of a 2by2 block, it is changed to point to the first row; ILST always points to the first row of the block in its final position (which may differ from its input value by +1 or 1). 1 <= IFST, ILST <= N.
WORKWORK is REAL array, dimension (MAX(1,LWORK)) On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
LWORKLWORK is INTEGER The dimension of the array WORK. LWORK >= 1 when N <= 1, otherwise LWORK >= 4*N + 16. 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.
INFOINFO is INTEGER =0: successful exit. <0: if INFO = i, the ith argument had an illegal value. =1: The transformed matrix pair (A, B) would be too far from generalized Schur form; the problem is ill conditioned. (A, B) may have been partially reordered, and ILST points to the first row of the current position of the block being moved.
Author:

Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date:
 November 2011
Contributors:
 Bo Kagstrom and Peter Poromaa, Department of Computing Science, Umea University, S901 87 Umea, Sweden.
References:

[1] B. Kagstrom; A Direct Method for Reordering Eigenvalues in the Generalized Real Schur Form of a Regular Matrix Pair (A, B), in M.S. Moonen et al (eds), Linear Algebra for Large Scale and RealTime Applications, Kluwer Academic Publ. 1993, pp 195218.
Author
Generated automatically by Doxygen for LAPACK from the source code.