Non Symmetric Eigen values APIs#
GEEV#
- group geev
Functions
-
template<typename T>
void geev(char *jobvl, char *jobvr, integer *n, T *a, integer *lda, T *wr, T *wi, T *vl, integer *ldvl, T *vr, integer *ldvr, T *work, integer *lwork, integer *info)# GEEV computes the eigenvalues and, optionally, the left and/or right eigenvectors for GE matrices.
Purpose: \verbtatim GEEV computes for an N-by-N real nonsymmetric matrix A, the eigenvalues and, optionally, the left and/or right eigenvectors.
The right eigenvector v(j) of A satisfies A * v(j) = lambda(j) * v(j) where lambda(j) is its eigenvalue. The left eigenvector u(j) of A satisfies u(j)**H * A = lambda(j) * u(j)**H where u(j)**H denotes the conjugate-transpose of u(j).
The computed eigenvectors are normalized to have Euclidean norm equal to 1 and largest component real.
- Parameters:
JOBVL – [in]
JOBVL is CHARACTER*1
= ‘N’: left eigenvectors of A are not computed;
= ‘V’: left eigenvectors of A are computed.JOBVR – [in]
JOBVR is CHARACTER*1
= ‘N’: right eigenvectors of A are not computed;
= ‘V’: right eigenvectors of A are computed.N – [in]
N is INTEGER
The order of the matrix A. N >= 0.
A – [inout]
A is REAL array, dimension (LDA,N)
On entry, the N-by-N matrix A.
On exit, A has been overwritten.LDA – [in]
LDA is INTEGER
The leading dimension of the array A. LDA >= fla_max(1,N).
WR – [out] WR is REAL array, dimension (N)
WI – [out]
WI is REAL array, dimension (N)
WR and WI contain the real and imaginary parts, respectively, of the computed eigenvalues. Complex conjugate pairs of eigenvalues appear consecutively with the eigenvalue having the positive imaginary part first.
VL – [out]
VL is REAL array, dimension (LDVL,N)
If JOBVL = ‘V’, the left eigenvectors u(j) are stored one after another in the columns of VL, in the same order as their eigenvalues.
If JOBVL = ‘N’, VL is not referenced.
If the j-th eigenvalue is real, then u(j) = VL(:,j), the j-th column of VL.
If the j-th and (j+1)-st eigenvalues form a complex conjugate pair - computes row and column scaling to reduce condition number of matrixhen u(j@ = VL(:,j) + i*VL(:,j+1) and u(j+1) = VL(:,j)LDVL – [in]
LDVL is INTEGER
The leading dimension of the array VL. LDVL >= 1; if JOBVL = ‘V’, LDVL >= N.
VR – [out]
VR is REAL array, dimension (LDVR,N)
If JOBVR = ‘V’, the right eigenvectors v(j) are stored one after another in the columns of VR, in the same order as their eigenvalues.
If JOBVR = ‘N’, VR is not referenced.
If the j-th eigenvalue is real, then v(j) = VR(:,j), the j-th column of VR.
If the j-th and (j+1)-st eigenvalues form a complex conjugate pair, then v(j) = VR(:,j) + i*VR(:,j+1) and v(j+1) = VR(:,j) - i*VR(:,j+1).LDVR – [in]
LDVR is INTEGER
The leading dimension of the array VR. LDVR >= 1; if JOBVR = ‘V’, LDVR >= N.
WORK – [out]
WORK is COMPLEX array, dimension (MAX(1,LWORK))
On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
LWORK – [in]
LWORK is INTEGER
The dimension of the array WORK. LWORK >= fla_max(1,2*N). For good performance, LWORK must 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.RWORK – [out] RWORK is REAL array, dimension (2*N)
INFO – [out]
INFO is INTEGER
= 0: successful exit
< 0: if INFO = -i, the i-th argument had an illegal value.
> 0: if INFO = i, the QR algorithm failed to compute all the eigenvalues, and no eigenvectors have been computed; elements i+1:N of W contain eigenvalues which have converged.
-
template<typename T>
GEEVX#
- group geevx
Functions
-
template<typename T>
void geevx(char *balanc, char *jobvl, char *jobvr, char *sense, integer *n, T *a, integer *lda, T *wr, T *wi, T *vl, integer *ldvl, T *vr, integer *ldvr, integer *ilo, integer *ihi, T *scale, T *abnrm, T *rconde, T *rcondv, T *work, integer *lwork, integer *iwork, integer *info)# GEEVX computes the eigenvalues and, optionally, the left and/or right eigenvectors for GE matrices(enabling conditions)
Purpose:
GEEVX computes for an N-by-N real nonsymmetric matrix A, the eigenvalues and, optionally, the left and/or right eigenvectors. Optionally also, it computes a balancing transformation to improve the conditioning of the eigenvalues and eigenvectors (ILO, IHI, SCALE, and ABNRM), reciprocal condition numbers for the eigenvalues (RCONDE), and reciprocal condition numbers for the right eigenvectors (RCONDV). The right eigenvector v(j) of A satisfies A * v(j) = lambda(j) * v(j) where lambda(j) is its eigenvalue. The left eigenvector u(j) of A satisfies u(j)**H * A = lambda(j) * u(j)**H where u(j)**H denotes the conjugate-transpose of u(j). The computed eigenvectors are normalized to have Euclidean norm equal to 1 and largest component real. Balancing a matrix means permuting the rows and columns to make it more nearly upper triangular, and applying a diagonal similarity transformation D * A * D**(-1), where D is a diagonal matrix, to make its rows and columns closer in norm and the condition numbers of its eigenvalues and eigenvectors smaller. The computed reciprocal condition numbers correspond to the balanced matrix. Permuting rows and columns will not change the condition numbers (in exact arithmetic) but diagonal scaling will. For further explanation of balancing, see section 4.10.2 of the LAPACK Users' Guide.
- Parameters:
BALANC – [in]
BALANC is CHARACTER*1
Indicates how the input matrix should be diagonally scaled and/or permuted to improve the conditioning of its eigenvalues.
= ‘N’: Do not diagonally scale or permute;
= ‘P’: Perform permutations to make the matrix more nearly upper triangular. Do not diagonally scale;
= ‘S’: Diagonally scale the matrix, i.e. replace A by D*A*D**(-1), where D is a diagonal matrix chosen to make the rows and columns of A more equal in norm. Do not permute;
= ‘B’: Both diagonally scale and permute A.
Computed reciprocal condition numbers will be for the matrix after balancing and/or permuting. Permuting does not change condition numbers (in exact arithmetic), but balancing does.JOBVL – [in]
JOBVL is CHARACTER*1
= ‘N’: left eigenvectors of A are not computed;
= ‘V’: left eigenvectors of A are computed.
If SENSE = ‘E’ or ‘B’, JOBVL must = ‘V’.
JOBVR – [in]
JOBVR is CHARACTER*1
= ‘N’: right eigenvectors of A are not computed;
= ‘V’: right eigenvectors of A are computed.
If SENSE = ‘E’ or ‘B’, JOBVR must = ‘V’.
SENSE – [in]
SENSE is CHARACTER*1
Determines which reciprocal condition numbers are computed.
= ‘N’: None are computed;
= ‘E’: Computed for eigenvalues only;
= ‘V’: Computed for right eigenvectors only;
= ‘B’: Computed for eigenvalues and right eigenvectors.
If SENSE = ‘E’ or ‘B’, both left and right eigenvectors must also be computed (JOBVL = ‘V’ and JOBVR = ‘V’).N – [in]
N is INTEGER
The order of the matrix A. N >= 0.
A – [inout]
A is REAL array, dimension (LDA,N)
On entry, the N-by-N matrix A.
On exit, A has been overwritten. If JOBVL = ‘V’ or JOBVR = ‘V’, A contains the real Schur form of the balanced version of the input matrix A.LDA – [in]
LDA is INTEGER
The leading dimension of the array A. LDA >= fla_max(1,N).
WR – [out] WR is REAL array, dimension (N)
WI – [out]
WI is REAL array, dimension (N)
WR and WI contain the real and imaginary parts, respectively, of the computed eigenvalues. Complex conjugate pairs of eigenvalues will appear consecutively with the eigenvalue having the positive imaginary part first.
VL – [out]
VL is REAL array, dimension (LDVL,N)
If JOBVL = ‘V’, the left eigenvectors u(j) are stored one after another in the columns of VL, in the same order as their eigenvalues.
If JOBVL = ‘N’, VL is not referenced.
If the j-th eigenvalue is real, then u(j) = VL(:,j), the j-th column of VL.
If the j-th and (j+1)-st eigenvalues form a complex conjugate pair, then u(j) = VL(:,j) + i*VL(:,j+1) and u(j+1) = VL(:,j) - i*VL(:,j+1).LDVL – [in]
LDVL is INTEGER
The leading dimension of the array VL. LDVL >= 1; if JOBVL = ‘V’, LDVL >= N.
VR – [out]
VR is REAL array, dimension (LDVR,N)
If JOBVR = ‘V’, the right eigenvectors v(j) are stored one after another in the columns of VR, in the same order as their eigenvalues.
If JOBVR = ‘N’, VR is not referenced.
If the j-th eigenvalue is real, then v(j) = VR(:,j), the j-th column of VR.
If the j-th and (j+1)-st eigenvalues form a complex conjugate pair, then v(j) = VR(:,j) + i*VR(:,j+1) and v(j+1) = VR(:,j) - i*VR(:,j+1).LDVR – [in]
LDVR is INTEGER
The leading dimension of the array VR. LDVR >= 1, and if JOBVR = ‘V’, LDVR >= N.
ILO – [out] ILO is INTEGER
IHI – [out]
IHI is INTEGER
ILO and IHI are integer values determined when A was balanced. The balanced A(i,j) = 0 if I > J and J = 1,…,ILO-1 or I = IHI+1,…,N.
SCALE – [out]
SCALE is REAL array, dimension (N)
Details of the permutations and scaling factors applied when balancin - computes row and column scaling to reduce condition number of matrix. If P@j) is the index of the row and column interchanged wit/*!h 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,…,ILO-1 = 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 ILO-1.
ABNRM – [out]
ABNRM is REAL
The one-norm of the balanced matrix (the maximum of the sum of absolute values of elements of any column).
RCONDE – [out]
RCONDE is REAL array, dimension (N)
RCONDE(j) is the reciprocal condition number of the j-th eigenvalue.
RCONDV – [out]
RCONDV is REAL array, dimension (N)
RCONDV(j) is the reciprocal condition number of the j-th right eigenvector.
WORK – [out]
WORK is COMPLEX array, dimension (MAX(1,LWORK))
On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
LWORK – [in]
LWORK is INTEGER
The dimension of the array WORK. If SENSE = ‘N’ or ‘E’, LWORK >= fla_max(1,2*N), and if SENSE = ‘V’ or ‘B’, LWORK >= N*N+2*N.
For good performance, LWORK must 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.
RWORK – [out] RWORK is REAL array, dimension (2*N)
INFO – [out]
INFO is INTEGER
= 0: successful exit
< 0: if INFO = -i, the i-th argument had an illegal value.
> 0: if INFO = i, the QR algorithm failed to compute all the eigenvalues, and no eigenvectors or condition numbers have been computed; elements 1:ILO-1 and i+1:N of W contain eigenvalues which have converged.
-
template<typename T, typename Ta>
void geevx(char *balanc, char *jobvl, char *jobvr, char *sense, integer *n, T *a, integer *lda, T *w, T *vl, integer *ldvl, T *vr, integer *ldvr, integer *ilo, integer *ihi, Ta *scale, Ta *abnrm, Ta *rconde, Ta *rcondv, T *work, integer *lwork, Ta *rwork, integer *info)#
-
template<typename T>
GEES#
- group gees
Functions
-
template<typename T>
void gees(char *jobvs, char *sort, void *select, integer *n, T *a, integer *lda, integer *sdim, T *wr, T *wi, T *vs, integer *ldvs, T *work, integer *lwork, logical *bwork, integer *info)# GEES computes the eigenvalues, the Schur form, and, optionally, the matrix of Schur vectors for GE matrices
Purpose:
GEES computes for an N-by-N real nonsymmetric matrix A, the eigenvalues, the real Schur form T, and, optionally, the matrix of Schur vectors Z. This gives the Schur factorization A = Z*T*(Z**T). Optionally, it also orders the eigenvalues on the diagonal of the real Schur form so that selected eigenvalues are at the top left. The leading columns of Z then form an orthonormal basis for the invariant subspace corresponding to the selected eigenvalues. A matrix is in real Schur form if it is upper quasi-triangular with 1-by-1 and 2-by-2 blocks. 2-by-2 blocks will be standardized in the form [ a b ] [ c a ] where b*c < 0. The eigenvalues of such a block are a +- sqrt(bc).
- Parameters:
JOBVS – [in]
JOBVS is CHARACTER*1
= ‘N’: Schur vectors are not computed;
= ‘V’: Schur vectors are computed.SORT – [in]
SORT is CHARACTER*1
Specifies whether or not to order the eigenvalues on the diagonal of the Schur form.
= ‘N’: Eigenvalues are not ordered;
= ‘S’: Eigenvalues are ordered (see SELECT).
SELECT – [in]
SELECT is a LOGICAL FUNCTION of two REAL arguments
SELECT must be declared EXTERNAL in the calling subroutine. If SORT = ‘S’, SELECT is used to select eigenvalues to sort to the top left of the Schur form. If SORT = ‘N’, SELECT is not referenced.
An eigenvalue WR(j)+sqrt(-1)*WI(j) is selected if SELECT(WR(j),WI(j)) is true; i.e., if either one of a complex conjugate pair of eigenvalues is selected, then both complex eigenvalues are selected.
Note that a selected complex eigenvalue may no longer satisfy SELECT(WR(j),WI(j)) = .TRUE. after ordering, since ordering may change the value of complex eigenvalues (especially if the eigenvalue is ill-conditioned); in this case INFO is set to N+2 (see INFO below).
N – [in]
N is INTEGER
The order of the matrix A. N >= 0.
A – [inout]
A is REAL array, dimension (LDA,N)
On entry, the N-by-N matrix A.
On exit, A has been overwritten by its real Schur form T.LDA – [in]
LDA is INTEGER
The leading dimension of the array A. LDA >= fla_max(1,N).
SDIM – [out]
SDIM is INTEGER
If SORT = ‘N’, SDIM = 0.
If SORT = ‘S’, SDIM = number of eigenvalues (after sorting) for which SELECT is true. (Complex conjugate pairs for which SELECT is true for either eigenvalue count as - computes row and column scaling to reduce condition number of matrixWR/*! – [out] WR is REAL array, dimension (N)
WI – [out]
WI is REAL array, dimension (N)
WR and WI contain the real and imaginary parts, respectively, of the computed eigenvalues in the same order that they appear on the diagonal of the output Schur form T. Complex conjugate pairs of eigenvalues will appear consecutively with the eigenvalue having the positive imaginary part first.
VS – [out]
VS is REAL array, dimension (LDVS,N)
If JOBVS = ‘V’, VS contains the orthogonal matrix Z of Schur vectors.
If JOBVS = ‘N’, VS is not referenced.LDVS – [in]
LDVS is INTEGER
The leading dimension of the array VS. LDVS >= 1; if JOBVS = ‘V’, LDVS >= N.
WORK – [out]
WORK is COMPLEX array, dimension (MAX(1,LWORK))
On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
LWORK – [in]
LWORK is INTEGER
The dimension of the array WORK. LWORK >= fla_max(1,2*N). For good performance, LWORK must 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.RWORK – [out] RWORK is REAL array, dimension (N)
BWORK – [out]
BWORK is LOGICAL array, dimension (N)
Not referenced if SORT = ‘N’.
INFO – [out]
INFO is INTEGER
= 0: successful exit
< 0: if INFO = -i, the i-th argument had an illegal value.
> 0: if INFO = i, and i is
<= N: the QR algorithm failed to compute all the eigenvalues; elements 1:ILO-1 and i+1:N of W contain those eigenvalues which have converged; if JOBVS = ‘V’, VS contains the matrix which reduces A to its partially converged Schur form.
= N+1: the eigenvalues could not be reordered because some eigenvalues were too close to separate (the problem is very ill-conditioned);
= N+2: after reordering, roundoff changed values of some complex eigenvalues so that leading eigenvalues in the Schur form no longer satisfy SELECT = .TRUE.. This could also be caused by underflow due to scaling.
-
template<typename T>
GEESX#
- group geesx
Functions
-
template<typename T>
void geesx(char *jobvs, char *sort, void *select, char *sense, integer *n, T *a, integer *lda, integer *sdim, T *wr, T *wi, T *vs, integer *ldvs, T *rconde, T *rcondv, T *work, integer *lwork, integer *iwork, integer *liwork, logical *bwork, integer *info)# GEESX computes the eigenvalues, the Schur form, and, optionally, the matrix of Schur vectors for GE matrices.
Purpose:
GEESX computes for an N-by-N real nonsymmetric matrix A, the eigenvalues, the real Schur form T, and, optionally, the matrix of Schur vectors Z. This gives the Schur factorization A = Z*T*(Z**T). Optionally, it also orders the eigenvalues on the diagonal of the real Schur form so that selected eigenvalues are at the top left; computes a reciprocal condition number for the average of the selected eigenvalues (RCONDE); and computes a reciprocal condition number for the right invariant subspace corresponding to the selected eigenvalues (RCONDV). The leading columns of Z form an orthonormal basis for this invariant subspace. For further explanation of the reciprocal condition numbers RCONDE and RCONDV, see Section 4.10 of the LAPACK Users' Guide (where these quantities are called s and sep respectively). A real matrix is in real Schur form if it is upper quasi-triangular with 1-by-1 and 2-by-2 blocks. 2-by-2 blocks will be standardized in the form [ a b ] [ c a ] where b*c < 0. The eigenvalues of such a block are a +- sqrt(bc).
- Parameters:
JOBVS – [in]
JOBVS is CHARACTER*1
= ‘N’: Schur vectors are not computed;
= ‘V’: Schur vectors are computed.SORT – [in]
SORT is CHARACTER*1
Specifies whether or not to order the eigenvalues on the diagonal of the Schur form.
= ‘N’: Eigenvalues are not ordered;
= ‘S’: Eigenvalues are ordered (see SELECT).
SELECT – [in]
SELECT is a LOGICAL FUNCTION of two REAL arguments SELECT must be declared EXTERNAL in the calling subroutine.
If SORT = ‘S’, SELECT is used to select eigenvalues to sort to the top left of the Schur form. If SORT = ‘N’, SELECT is not referenced.
An eigenvalue WR(j)+sqrt(-1)*WI(j) is selected if SELECT(WR(j),WI(j)) is true; i.e., if either one of a complex conjugate pair of eigenvalues is selected, then both are. Note that a selected complex eigenvalue may no longer satisfy SELECT(WR(j),WI(j)) = .TRUE. after ordering, since ordering may change the value of complex eigenvalues (especially if the eigenvalue is ill-conditioned); in this case INFO may be set to N+3 (see INFO below).SENSE – [in]
SENSE is CHARACTER*1
Determines which reciprocal condition numbers are computed.
= ‘N’: None are computed;
= ‘E’: Computed for average of selected eigenvalues only;
= ‘V’: Computed for selected right invariant subspace only;
= ‘B’: Computed for both.
If SENSE = ‘E’, ‘V’ or ‘B’, SORT must equal ‘S’.N – [in]
N is INTEGER
The order of the matrix A. N >= 0.
A – [inout]
A is REAL array, dimension (LDA, N)
On entry, the N-by-N matrix A.
On exit, A is overwritten by its real Schur form T.LDA – [in]
LDA is INTEGER
The leading dimension of the array A. LDA >= fla_max(1,N).
SDIM – [out]
SDIM is INTEGER
If SORT = ‘N’, SDIM = 0.
If SORT = ‘S’, SDIM = number of eigenvalues (after sorting) for which SELECT is true. (Complex conjugate pairs for which SELECT is true for either eigenvalue count as 2.)WR – [out] WR is REAL array, dimension (N)
WI – [out]
WI is REAL array, dimension (N)
WR and WI contain the real and imaginary parts, respectively, of the computed eigenvalues, in the same order that they appear on the diagonal of the output Schur form T. Complex conjugate pairs of eigenvalues appear consecutively with the eigenvalue having the positive imaginary part fir - computes row and column scaling to reduce condition number of matrix
VS/*! – [out]
VS is REAL array, dimension (LDVS,N)
If JOBVS = ‘V’, VS contains the orthogonal matrix Z of Schur vectors.
If JOBVS = ‘N’, VS is not referenced.LDVS – [in]
LDVS is INTEGER
The leading dimension of the array VS. LDVS >= 1, and if JOBVS = ‘V’, LDVS >= N.
RCONDE – [out]
RCONDE is REAL
If SENSE = ‘E’ or ‘B’, RCONDE contains the reciprocal condition number for the average of the selected eigenvalues. Not referenced if SENSE = ‘N’ or ‘V’.
RCONDV – [out]
RCONDV is REAL
If SENSE = ‘V’ or ‘B’, RCONDV contains the reciprocal condition number for the selected right invariant subspace. Not referenced if SENSE = ‘N’ or ‘E’.
WORK – [out]
WORK is COMPLEX array, dimension (MAX(1,LWORK))
On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
LWORK – [in]
LWORK is INTEGER
The dimension of the array WORK. LWORK >= fla_max(1,2*N).
Also, if SENSE = ‘E’ or ‘V’ or ‘B’, LWORK >= 2*SDIM*(N-SDIM), where SDIM is the number of selected eigenvalues computed by this routine. Note that 2*SDIM*(N-SDIM) <= N*N/2. Note also that an error is only returned if LWORK < fla_max(1,2*N), but if SENSE = ‘E’ or ‘V’ or ‘B’ this may not be large enough. For good performance, LWORK must generally be larger.
If LWORK = -1, then a workspace query is assumed; the routine only calculates upper bound on the optimal size of the array WORK, returns this value as the first entry of the WORK array, and no error message related to LWORK is issued by XERBLA.
RWORK – [out] RWORK is REAL array, dimension (N)
BWORK – [out]
BWORK is LOGICAL array, dimension (N)
Not referenced if SORT = ‘N’.
INFO – [out]
INFO is INTEGER
= 0: successful exit
< 0: if INFO = -i, the i-th argument had an illegal value.
> 0: if INFO = i, and i is
<= N: the QR algorithm failed to compute all the eigenvalues; elements 1:ILO-1 and i+1:N of W contain those eigenvalues which have converged; if JOBVS = ‘V’, VS contains the transformation which reduces A to its partially converged Schur form.
= N+1: the eigenvalues could not be reordered because some eigenvalues were too close to separate (the problem is very ill-conditioned);
= N+2: after reordering, roundoff changed values of some complex eigenvalues so that leading eigenvalues in the Schur form no longer satisfy SELECT=.TRUE. This could also be caused by underflow due to scaling.
-
template<typename T>
GGEV3#
- group ggev3
Functions
-
template<typename T>
void ggev3(char *jobvl, char *jobvr, integer *n, T *a, integer *lda, T *b, integer *ldb, T *alphar, T *alphai, T *beta, T *vl, integer *ldvl, T *vr, integer *ldvr, T *work, integer *lwork, integer *info)# GGEV3 computes the eigenvalues and, optionally, the left and/or right eigenvectors for GE matrices (blocked algorithm)
Purpose:
GGEV3 computes for a pair of N-by-N real nonsymmetric matrices (A,B) the generalized eigenvalues, and optionally, the left and/or right generalized eigenvectors. A generalized eigenvalue for a pair of matrices (A,B) is a scalar lambda or a ratio alpha/beta = lambda, such that A - lambda*B is singular. It is usually represented as the pair (alpha,beta), as there is a reasonable interpretation for beta=0, and even for both being zero. The right eigenvector v(j) corresponding to the eigenvalue lambda(j) of (A,B) satisfies A * v(j) = lambda(j) * B * v(j). The left eigenvector u(j) corresponding to the eigenvalue lambda(j) of (A,B) satisfies u(j)**H * A = lambda(j) * u(j)**H * B . where u(j)**H is the conjugate-transpose of u(j).
- Parameters:
JOBVL – [in]
JOBVL is CHARACTER*1
= ‘N’: do not compute the left generalized eigenvectors;
= ‘V’: compute the left generalized eigenvectors.JOBVR – [in]
JOBVR is CHARACTER*1
= ‘N’: do not compute the right generalized eigenvectors;
= ‘V’: compute the right generalized eigenvectors.N – [in]
N is INTEGER
The order of the matrices A, B, VL, and VR. N >= 0.
A – [inout]
A is REAL array, dimension (LDA, N)
On entry, the matrix A in the pair (A,B). On exit, A has been overwritten.
LDA – [in]
LDA is INTEGER
The leading dimension of A. LDA >= fla_max(1,N).
B – [inout]
B is REAL array, dimension (LDB, N)
On entry, the matrix B in the pair (A,B). On exit, B has been overwritten.
LDB – [in]
LDB is INTEGER
The leading dimension of B. LDB >= fla_max(1,N).
ALPHAR – [out] ALPHAR is REAL array, dimension (N)
ALPHAI – [out] ALPHAI is REAL array, dimension (N)
BETA – [out]
BETA is REAL array, dimension (N)
On exit, (ALPHAR(j) + ALPHAI(j)*i)/BETA(j), j=1,…,N, will be the generalized eigenvalues. If ALPHAI(j) is zero, then the j-th eigenvalue is real; if positive, then the j-th and (j+1)-st eigenvalues are a complex conjugate pair, with ALPHAI(j+1) negative.
Note: the quotients ALPHAR(j)/BETA(j) and ALPHAI(j)/BETA(j) may easily over- or underflow, and BETA(j) may even be zero. Thus, the user should avoid naively computing the ratio alpha/beta. However, ALPHAR and ALPHAI will be always less than and usually comparable with norm(A) in magnitude, and BETA always less than and usually comparable with norm(B).VL – [out]
VL is REAL array, dimension (LDVL,N)
If JOBVL = ‘V’, the left eigenvectors u(j) are stored one after another in the columns of VL, in the same order as their eigenvalues. If the j-th eigenvalue is real, then u(j) = VL(:,j), the j-th column of VL. If the j-th and (j+1)-th eigenvalues form a complex conjugate pair, then u(j) = VL(:,j)+i*VL(:,j+1) and u(j+1) = VL(:,j)-i*VL(:,j+1). Each eigenvector is scaled so the largest component has abs(real part)+abs(imag. part)=1.
Not referenced if JOBVL = ‘N’.LDVL – [in]
LDVL is INTEGER
The leading dimension of the matrix VL. LDVL >= 1, and if JOBVL = ‘V’, LDVL >= N.
VR – [out]
VR is REAL array, dimension (LDVR,N)
If JOBVR = ‘V’, the right eigenvectors v(j) are stored one after another in the columns of VR, in the same order as their eigenvalues. If the j-th eigenvalue is real, then v(j) = VR(:,j), the j-th column of VR. If the j-th and (j+1)-th eigenvalues form a complex conjugate pair, then v(j) = VR(:,j)+i*VR(:,j+1) and v(j+1) = VR(:,j)-i*VR(:,j+1). Each eigenvector is scaled so the largest component has abs(real part)+abs(imag. part)=1.
Not referenced if JOBVR = ‘N’.LDVR – [in]
LDVR is INTEGER
The leading dimension of the matrix VR. LDVR >= 1, and if JOBVR = ‘V’, LDVR >= N.
WORK – [out]
WORK is REAL array, dimension (MAX(1,LWORK))
On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
LWORK – [in]
LWORK is INTEGER
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.
INFO – [out]
INFO is INTEGER
= 0: successful exit
< 0: if INFO = -i, the i-th argument had an illegal value.
= 1,…,N:
The QZ iteration failed. No eigenvectors have been calculated, but ALPHAR(j), ALPHAI(j), and BETA(j) should be correct for j=INFO+1,…,N.
> N: =N+1: other than QZ iteration failed in SHGEQZ.
=N+2: error return from STGEVC.
-
template<typename T>
GGEV#
- group ggev
Functions
-
template<typename T>
void ggev(char *jobvl, char *jobvr, integer *n, T *a, integer *lda, T *b, integer *ldb, T *alphar, T *alphai, T *beta, T *vl, integer *ldvl, T *vr, integer *ldvr, T *work, integer *lwork, integer *info)# GGEV computes the eigenvalues and, optionally, the left and/or right eigenvectors for GE matrices.
Purpose:
GGEV computes for a pair of N-by-N real nonsymmetric matrices (A,B) the generalized eigenvalues, and optionally, the left and/or right generalized eigenvectors. A generalized eigenvalue for a pair of matrices (A,B) is a scalar lambda or a ratio alpha/beta = lambda, such that A - lambda*B is singular. It is usually represented as the pair (alpha,beta), as there is a reasonable interpretation for beta=0, and even for both being zero. The right eigenvector v(j) corresponding to the eigenvalue lambda(j) of (A,B) satisfies A * v(j) = lambda(j) * B * v(j). The left eigenvector u(j) corresponding to the eigenvalue lambda(j) of (A,B) satisfies u(j)**H * A = lambda(j) * u(j)**H * B . where u(j)**H is the conjugate-transpose of u(j).
- Parameters:
JOBVL – [in]
JOBVL is CHARACTER*1
= ‘N’: do not compute the left generalized eigenvectors;
= ‘V’: compute the left generalized eigenvectors.JOBVR – [in]
JOBVR is CHARACTER*1
= ‘N’: do not compute the right generalized eigenvectors;
= ‘V’: compute the right generalized eigenvectors.N – [in]
N is INTEGER
The order of the matrices A, B, VL, and VR. N >= 0.
A – [inout]
A is REAL array, dimension (LDA, N)
On entry, the matrix A in the pair (A,B). On exit, A has been overwritten.
LDA – [in]
LDA is INTEGER
The leading dimension of A. LDA >= fla_max(1,N).
B – [inout]
B is REAL array, dimension (LDB, N)
On entry, the matrix B in the pair (A,B). On exit, B has been overwritten.
LDB – [in]
LDB is INTEGER
The leading dimension of B. LDB >= fla_max(1,N).
ALPHAR – [out] ALPHAR is REAL array, dimension (N)
ALPHAI – [out] ALPHAI is REAL array, dimension (N)
BETA – [out]
BETA is REAL array, dimension (N)
On exit, (ALPHAR(j) + ALPHAI(j)*i)/BETA(j), j=1,…,N, will be the generalized eigenvalues. If ALPHAI(j) is zero, then the j-th eigenvalue is real; if positive, then the j-th and (j+1)-st eigenvalues are a complex conjugate pair, with ALPHAI(j+1) negative.
Note: the quotients ALPHAR(j)/BETA(j) and ALPHAI(j)/BETA(j) may easily over- or underflow, and BETA(j) may even be zero. Thus, the user should avoid naively computing the ratio alpha/beta. However, ALPHAR and ALPHAI will be always less than and usually comparable with norm(A) in magnitude, and BETA always less than and usually comparable with norm(B).VL – [out]
VL is REAL array, dimension (LDVL,N)
If JOBVL = ‘V’, the left eigenvectors u(j) are stored one after another in the columns of VL, in the same order as their eigenvalues. If the j-th eigenvalue is real, then u(j) = VL(:,j), the j-th column of VL. If the j-th and (j+1)-th eigenvalues form a complex conjugate pair, then u(j) = VL(:,j)+i*VL(:,j+1) and u(j+1) = VL(:,j)-i*VL(:,j+1). Each eigenvector is scaled so the largest component has abs(real part)+abs(imag. part)=1.
Not referenced if JOBVL = ‘N’.LDVL – [in]
LDVL is INTEGER
The leading dimension of the matrix VL. LDVL >= 1, and if JOBVL = ‘V’, LDVL >= N.
VR – [out]
VR is REAL array, dimension (LDVR,N)
If JOBVR = ‘V’, the right eigenvectors v(j) are stored one after another in the columns of VR, in the same order as their eigenvalues. If the j-th eigenvalue is real, then v(j) = VR(:,j), the j-th column of VR. If the j-th and (j+1)-th eigenvalues form a complex conjugate pair, then v(j) = VR(:,j)+i*VR(:,j+1) and v(j+1) = VR(:,j)-i*VR(:,j+1). Each eigenvector is scaled so the largest component has abs(real part)+abs(imag. part)=1.
Not referenced if JOBVR = ‘N’.LDVR – [in]
LDVR is INTEGER
The leading dimension of the matrix VR. LDVR >= 1, and if JOBVR = ‘V’, LDVR >= N.
WORK – [out]
WORK is REAL array, dimension (MAX(1,LWORK))
On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
LWORK – [in]
LWORK is INTEGER
The dimension of the array WORK. LWORK >= fla_max(1,8*N). For good performance, LWORK must 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.INFO – [out]
INFO is INTEGER
= 0: successful exit
< 0: if INFO = -i, the i-th argument had an illegal value.
= 1,…,N:
The QZ iteration failed. No eigenvectors have been calculated, but ALPHAR(j), ALPHAI(j), and BETA(j) should be correct for j=INFO+1,…,N.
> N: =N+1: other than QZ iteration failed in SHGEQZ. =N+2: error return from STGEVC.
-
template<typename T>
GGEVX#
- group ggevx
Functions
-
template<typename T>
void ggevx(char *balanc, char *jobvl, char *jobvr, char *sense, integer *n, T *a, integer *lda, T *b, integer *ldb, T *alphar, T *alphai, T *beta, T *vl, integer *ldvl, T *vr, integer *ldvr, integer *ilo, integer *ihi, T *lscale, T *rscale, T *abnrm, T *bbnrm, T *rconde, T *rcondv, T *work, integer *lwork, integer *iwork, logical *bwork, integer *info)# GGEVX computes the eigenvalues and, optionally, the left and/or right eigenvectors for GE matrices.
Purpose:
SGGEVX computes for a pair of N-by-N real nonsymmetric matrices (A,B) the generalized eigenvalues, and optionally, the left and/or right generalized eigenvectors. Optionally also, it computes a balancing transformation to improve the conditioning of the eigenvalues and eigenvectors (ILO, IHI, LSCALE, RSCALE, ABNRM, and BBNRM), reciprocal condition numbers for the eigenvalues (RCONDE), and reciprocal condition numbers for the right eigenvectors (RCONDV). A generalized eigenvalue for a pair of matrices (A,B) is a scalar lambda or a ratio alpha/beta = lambda, such that A - lambda*B is singular. It is usually represented as the pair (alpha,beta), as there is a reasonable interpretation for beta=0, and even for both being zero. The right eigenvector v(j) corresponding to the eigenvalue lambda(j) of (A,B) satisfies A * v(j) = lambda(j) * B * v(j) . The left eigenvector u(j) corresponding to the eigenvalue lambda(j) of (A,B) satisfies u(j)**H * A = lambda(j) * u(j)**H * B. where u(j)**H is the conjugate-transpose of u(j).
- Parameters:
BALANC – [in]
BALANC is CHARACTER*1
Specifies the balance option to be performed.
= ‘N’: do not diagonally scale or permute;
= ‘P’: permute only;
= ‘S’: scale only;
= ‘B’: both permute and scale.
Computed reciprocal condition numbers will be for the matrices after permuting and/or balancing. Permuting does not change condition numbers (in exact arithmetic), but balancing does.JOBVL – [in]
JOBVL is CHARACTER*1
= ‘N’: do not compute the left generalized eigenvectors;
= ‘V’: compute the left generalized eigenvectors.JOBVR – [in]
JOBVR is CHARACTER*1
= ‘N’: do not compute the right generalized eigenvectors;
= ‘V’: compute the right generalized eigenvectors.SENSE – [in]
SENSE is CHARACTER*1
Determines which reciprocal condition numbers are computed.
= ‘N’: none are computed;
= ‘E’: computed for eigenvalues only;
= ‘V’: computed for eigenvectors only;
= ‘B’: computed for eigenvalues and eigenvectors.
N – [in]
N is INTEGER
The order of the matrices A, B, VL, and VR. N >= 0.
A – [inout]
A is REAL array, dimension (LDA, N)
On entry, the matrix A in the pair (A,B).
On exit, A has been overwritten. If JOBVL=’V’ or JOBVR=’V’ or both, then A contains the first part of the real Schur form of the “balanced” versions of the input A and B.LDA – [in]
LDA is INTEGER
The leading dimension of A. LDA >= fla_max(1,N).
B – [inout]
B is REAL array, dimension (LDB, N)
On entry, the matrix B in the pair (A,B).
On exit, B has been overwritten. If JOBVL=’V’ or JOBVR=’V’ or both, then B contains the second part of the real Schur form of the “balanced” versions of the input A and B.LDB – [in]
LDB is INTEGER
The leading dimension of B. LDB >= fla_max(1,N).
ALPHAR – [out] ALPHAR is REAL array, dimension (N)
ALPHAI – [out] ALPHAI is REAL array, dimension (N)
BETA – [out]
BETA is REAL array, dimension (N)
On exit, (ALPHAR(j) + ALPHAI(j)*i)/BETA(j), j=1,…,N, will be the generalized eigenvalues. If ALPHAI(j) is zero, then the j-th eigenvalue is real; if positive, then the j-th and (j+1)-st eigenvalues are a complex conjugate pair, with ALPHAI(j+1) negative.
Note: the quotients ALPHAR(j)/BETA(j) and ALPHAI(j)/BETA(j) may easily over- or underflow, and BETA(j) may even be zero. Thus, the user should avoid naively computing the ratio ALPHA/BETA. However, ALPHAR and ALPHAI will be always less than and usually comparable with norm(A) in magnitude, and BETA always less than and usually comparable with norm(B).VL – [out]
VL is REAL array, dimension (LDVL,N)
If JOBVL = ‘V’, the left eigenvectors u(j) are stored one after another in the columns of VL, in the same order as their eigenvalues. If the j-th eigenvalue is real, then u(j) = VL(:,j), the j-th column of VL. If the j-th and (j+1)-th eigenvalues form a complex conjugate pair, then u(j) = VL(:,j)+i*VL(:,j+1) and u(j+1) = VL(:,j)-i*VL(:,j+1). Each eigenvector will be scaled so the largest component have abs(real part) + abs(imag. part) = 1.
Not referenced if JOBVL = ‘N’.LDVL – [in]
LDVL is INTEGER
The leading dimension of the matrix VL. LDVL >= 1, and if JOBVL = ‘V’, LDVL >= N.
VR – [out]
VR is REAL array, dimension (LDVR,N)
If JOBVR = ‘V’, the right eigenvectors v(j) are stored one after another in the columns of VR, in the same order as their eigenvalues. If the j-th eigenvalue is real, then v(j) = VR(:,j), the j-th column of VR. If the j-th and (j+1)-th eigenvalues form a complex conjugate pair, then v(j) = VR(:,j)+i*VR(:,j+1) and v(j+1) = VR(:,j)-i*VR(:,j+1). Each eigenvector will be scaled so the largest component have abs(real part) + abs(imag. part) = 1.
Not referenced if JOBVR = ‘N’.LDVR – [in]
LDVR is INTEGER
The leading dimension of the matrix VR. LDVR >= 1, and if JOBVR = ‘V’, LDVR >= N.
ILO – [out] ILO is INTEGER
IHI – [out]
IHI is INTEGER
ILO and IHI are integer values such that on exit A(i,j) = 0 and B(i,j) = 0 if i > j and j = 1,…,ILO-1 or i = IHI+1,…,N. If BALANC = ‘N’ or ‘S’, ILO = 1 and IHI = N.
LSCALE – [out]
LSCALE is REAL array, dimension (N)
Details of the permutations and scaling factors applied to the left side of A and B. If PL(j) is the index of the row interchanged with row j, and DL(j) is the scaling factor applied to row j, then
LSCALE(j) = PL(j) for j = 1,…,ILO-1
= DL(j) for j = ILO,…,IHI
= PL(j) for j = IHI+1,…,N.
The order in which the interchanges are made is N to IHI+1, then 1 to ILO-1.
RSCALE – [out]
RSCALE is REAL array, dimension (N)
Details of the permutations and scaling factors applied to the right side of A and B. If PR(j) is the index of the column interchanged with column j, and DR(j) is the scaling factor applied to column j, then
RSCALE(j) = PR(j) for j = 1,…,ILO-1
= DR(j) for j = ILO,…,IHI
= PR(j) for j = IHI+1,…,N
The order in which the interchanges are made is N to IHI+1, then 1 to ILO-1.
ABNRM – [out]
ABNRM is REAL
The one-norm of the balanced matrix A.
BBNRM – [out]
BBNRM is REAL
The one-norm of the balanced matrix B.
RCONDE – [out]
RCONDE is REAL array, dimension (N)
If SENSE = ‘E’ or ‘B’, the reciprocal condition numbers of the eigenvalues, stored in consecutive elements of the array. For a complex conjugate pair of eigenvalues two consecutive elements of RCONDE are set to the same value. Thus RCONDE(j), RCONDV(j), and the j-th columns of VL and VR all correspond to the j-th eigenpair.
If SENSE = ‘N’ or ‘V’, RCONDE is not referenced.RCONDV – [out]
RCONDV is REAL array, dimension (N)
If SENSE = ‘V’ or ‘B’, the estimated reciprocal condition numbers of the eigenvectors, stored in consecutive elements of the array. For a complex eigenvector two consecutive elements of RCONDV are set to the same value. If the eigenvalues cannot be reordered to compute RCONDV(j), RCONDV(j) is set to 0; this can only occur when the true value would be very small anyway.
If SENSE = ‘N’ or ‘E’, RCONDV is not referenced.WORK – [out]
WORK is REAL array, dimension (MAX(1,LWORK))
On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
LWORK – [in]
LWORK is INTEGER
The dimension of the array WORK. LWORK >= fla_max(1,2*N).
If BALANC = ‘S’ or ‘B’, or JOBVL = ‘V’, or JOBVR = ‘V’, LWORK >= fla_max(1,6*N).
If SENSE = ‘E’, LWORK >= fla_max(1,10*N).
If SENSE = ‘V’ or ‘B’, LWORK >= 2*N*N+8*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.
IWORK – [out]
IWORK is INTEGER array, dimension (N+6)
If SENSE = ‘E’, IWORK is not referenced.
BWORK – [out]
BWORK is LOGICAL array, dimension (N)
If SENSE = ‘N’, BWORK is not referenced.
INFO – [out]
INFO is INTEGER
= 0: successful exit
< 0: if INFO = -i, the i-th argument had an illegal value.
= 1,…,N:
The QZ iteration failed. No eigenvectors have been calculated, but ALPHAR(j), ALPHAI(j), and BETA(j) should be correct for j=INFO+1,…,N.
> N: =N+1: other than QZ iteration failed in SHGEQZ.
=N+2: error return from STGEVC.
-
template<typename T, typename Ta>
void ggevx(char *balanc, char *jobvl, char *jobvr, char *sense, integer *n, T *a, integer *lda, T *b, integer *ldb, T *alpha, T *beta, T *vl, integer *ldvl, T *vr, integer *ldvr, integer *ilo, integer *ihi, Ta *lscale, Ta *rscale, Ta *abnrm, Ta *bbnrm, Ta *rconde, Ta *rcondv, T *work, integer *lwork, Ta *rwork, integer *iwork, logical *bwork, integer *info)#
-
template<typename T>
GGES3#
- group gges3
Functions
-
template<typename T>
void gges3(char *jobvsl, char *jobvsr, char *sort, void *selctg, integer *n, T *a, integer *lda, T *b, integer *ldb, integer *sdim, T *alphar, T *alphai, T *beta, T *vsl, integer *ldvsl, T *vsr, integer *ldvsr, T *work, integer *lwork, logical *bwork, integer *info)# GGES3 computes the eigenvalues, the Schur form, and, optionally, the matrix of Schur vectors for GE matrices (blocked algorithm)
Purpose:
GGES3 computes for a pair of N-by-N real nonsymmetric matrices (A,B), the generalized eigenvalues, the generalized real Schur form (S,T), optionally, the left and/or right matrices of Schur vectors (VSL and VSR). This gives the generalized Schur factorization (A,B) = ( (VSL)*S*(VSR)**T, (VSL)*T*(VSR)**T) Optionally, it also orders the eigenvalues so that a selected cluster of eigenvalues appears in the leading diagonal blocks of the upper quasi-triangular matrix S and the upper triangular matrix T.The leading columns of VSL and VSR then form an orthonormal basis for the corresponding left and right eigenspaces (deflating subspaces). (If only the generalized eigenvalues are needed, use the driver SGGEV instead, which is faster.) A generalized eigenvalue for a pair of matrices (A,B) is a scalar w or a ratio alpha/beta = w, such that A - w*B is singular. It is usually represented as the pair (alpha,beta), as there is a reasonable interpretation for beta=0 or both being zero. A pair of matrices (S,T) is in generalized real Schur form if T is upper triangular with non-negative diagonal and S is block upper triangular with 1-by-1 and 2-by-2 blocks. 1-by-1 blocks correspond to real generalized eigenvalues, while 2-by-2 blocks of S will be "standardized" by making the corresponding elements of T have the form: [ a 0 ] [ 0 b ] and the pair of corresponding 2-by-2 blocks in S and T will have a complex conjugate pair of generalized eigenvalues.
- Parameters:
JOBVSL – [in]
JOBVSL is CHARACTER*1
= ‘N’: do not compute the left Schur vectors;
= ‘V’: compute the left Schur vectors.JOBVSR – [in]
JOBVSR is CHARACTER*1
= ‘N’: do not compute the right Schur vectors;
= ‘V’: compute the right Schur vectors.SORT – [in]
SORT is CHARACTER*1
Specifies whether or not to order the eigenvalues on the diagonal of the generalized Schur form.
= ‘N’: Eigenvalues are not ordered;
= ‘S’: Eigenvalues are ordered (see SELCTG);
SELCTG – [in]
SELCTG is a LOGICAL FUNCTION of three REAL arguments
SELCTG must be declared EXTERNAL in the calling subroutine. If SORT = ‘N’, SELCTG is not referenced. If SORT = ‘S’, SELCTG is used to select eigenvalues to sort to the top left of the Schur form.
An eigenvalue (ALPHAR(j)+ALPHAI(j))/BETA(j) is selected if SELCTG(ALPHAR(j),ALPHAI(j),BETA(j)) is true; i.e. if either one of a complex conjugate pair of eigenvalues is selected, then both complex eigenvalues are selected.
Note that in the ill-conditioned case, a selected complex eigenvalue may no longer satisfy SELCTG(ALPHAR(j),ALPHAI(j), BETA(j)) = .TRUE. after ordering. INFO is to be set to N+2 in this case.
N – [in]
N is INTEGER
The order of the matrices A, B, VSL, and VSR. N >= 0.
A – [inout]
A is REAL array, dimension (LDA, N)
On entry, the first of the pair of matrices. On exit, A has been overwritten by its generalized Schur form S.
LDA – [in]
LDA is INTEGER
The leading dimension of A. LDA >= fla_max(1,N).
B – [inout]
B is REAL array, dimension (LDB, N)
On entry, the second of the pair of matrices. On exit, B has been overwritten by its generalized Schur form T.
LDB – [in]
LDB is INTEGER
The leading dimension of B. LDB >= fla_max(1,N).
SDIM – [out]
SDIM is INTEGER
If SORT = ‘N’, SDIM = 0.
If SORT = ‘S’, SDIM = number of eigenvalues (after sorting) for which SELCTG is true. (Complex conjugate pairs for which SELCTG is true for either eigenvalue count as 2.)ALPHAR – [out] ALPHAR is REAL array, dimension (N)
ALPHAI – [out] ALPHAI is REAL array, dimension (N)
BETA – [out]
BETA is REAL array, dimension (N)
On exit, (ALPHAR(j) + ALPHAI(j)*i)/BETA(j), j=1,…,N, will be the generalized eigenvalues. ALPHAR(j) + ALPHAI(j)*i, and BETA(j),j=1,…,N are the diagonals of the complex Schur form (S,T) that would result if the 2-by-2 diagonal blocks of the real Schur form of (A,B) were further reduced to triangular form using 2-by-2 complex unitary transformations. If ALPHAI(j) is zero, then the j-th eigenvalue is real; if positive, then the j-th and (j+1)-st eigenvalues are a complex conjugate pair, with ALPHAI(j+1) negative.
Note: the quotients ALPHAR(j)/BETA(j) and ALPHAI(j)/BETA(j) may easily over- or underflow, and BETA(j) may even be zero. Thus, the user should avoid naively computing the ratio. However, ALPHAR and ALPHAI will be always less than and usually comparable with norm(A) in magnitude, and BETA always less than and usually comparable with norm(B).VSL – [out]
VSL is REAL array, dimension (LDVSL,N)
If JOBVSL = ‘V’, VSL will contain the left Schur vectors. Not referenced if JOBVSL = ‘N’.
LDVSL – [in]
LDVSL is INTEGER
The leading dimension of the matrix VSL. LDVSL >=1, and if JOBVSL = ‘V’, LDVSL >= N.
VSR – [out]
VSR is REAL array, dimension (LDVSR,N)
If JOBVSR = ‘V’, VSR will contain the right Schur vectors. Not referenced if JOBVSR = ‘N’.
LDVSR – [in]
LDVSR is INTEGER
The leading dimension of the matrix VSR. LDVSR >= 1, and if JOBVSR = ‘V’, LDVSR >= N.
WORK – [out]
WORK is REAL array, dimension (MAX(1,LWORK))
On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
LWORK – [in]
LWORK is INTEGER
The dimension of the array WORK.
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.BWORK – [out]
BWORK is LOGICAL array, dimension (N)
Not referenced if SORT = ‘N’.
INFO – [out]
INFO is INTEGER
= 0: successful exit
< 0: if INFO = -i, the i-th argument had an illegal value.
= 1,…,N:
The QZ iteration failed. (A,B) are not in Schur form, but ALPHAR(j), ALPHAI(j), and BETA(j) should be correct for j=INFO+1,…,N.
> N: =N+1: other than QZ iteration failed in SHGEQZ.
=N+2: after reordering, roundoff changed values of some complex eigenvalues so that leading eigenvalues in the Generalized Schur form no longer satisfy SELCTG=.TRUE. This could also be caused due to scaling.
=N+3: reordering failed in STGSEN.
-
template<typename T>
GGES#
- group gges
Functions
-
template<typename T>
void gges(char *jobvsl, char *jobvsr, char *sort, void *selctg, integer *n, T *a, integer *lda, T *b, integer *ldb, integer *sdim, T *alphar, T *alphai, T *beta, T *vsl, integer *ldvsl, T *vsr, integer *ldvsr, T *work, integer *lwork, logical *bwork, integer *info)# GGES computes the eigenvalues, the Schur form, and, optionally, the matrix of Schur vectors for GE matrices.
Purpose:
GGES computes for a pair of N-by-N real nonsymmetric matrices (A,B), the generalized eigenvalues, the generalized real Schur form (S,T), optionally, the left and/or right matrices of Schur vectors (VSL and VSR). This gives the generalized Schur factorization (A,B) = ( (VSL)*S*(VSR)**T, (VSL)*T*(VSR)**T) Optionally, it also orders the eigenvalues so that a selected cluster of eigenvalues appears in the leading diagonal blocks of the upper quasi-triangular matrix S and the upper triangular matrix T.The leading columns of VSL and VSR then form an orthonormal basis for the corresponding left and right eigenspaces (deflating subspaces). (If only the generalized eigenvalues are needed, use the driver SGGEV instead, which is faster.) A generalized eigenvalue for a pair of matrices (A,B) is a scalar w or a ratio alpha/beta = w, such that A - w*B is singular. It is usually represented as the pair (alpha,beta), as there is a reasonable interpretation for beta=0 or both being zero. A pair of matrices (S,T) is in generalized real Schur form if T is upper triangular with non-negative diagonal and S is block upper triangular with 1-by-1 and 2-by-2 blocks. 1-by-1 blocks correspond to real generalized eigenvalues, while 2-by-2 blocks of S will be "standardized" by making the corresponding elements of T have the form: [ a 0 ] [ 0 b ] and the pair of corresponding 2-by-2 blocks in S and T will have a complex conjugate pair of generalized eigenvalues.
- Parameters:
JOBVSL – [in]
JOBVSL is CHARACTER*1
= ‘N’: do not compute the left Schur vectors;
= ‘V’: compute the left Schur vectors.JOBVSR – [in]
JOBVSR is CHARACTER*1
= ‘N’: do not compute the right Schur vectors;
= ‘V’: compute the right Schur vectors.SORT – [in]
SORT is CHARACTER*1
Specifies whether or not to order the eigenvalues on the diagonal of the generalized Schur form.
= ‘N’: Eigenvalues are not ordered;
= ‘S’: Eigenvalues are ordered (see SELCTG);
SELCTG – [in]
SELCTG is a LOGICAL FUNCTION of three REAL arguments SELCTG must be declared EXTERNAL in the calling subroutine.
If SORT = ‘N’, SELCTG is not referenced.
If SORT = ‘S’, SELCTG is used to select eigenvalues to sort to the top left of the Schur form.
An eigenvalue (ALPHAR(j)+ALPHAI(j))/BETA(j) is selected if SELCTG(ALPHAR(j),ALPHAI(j),BETA(j)) is true; i.e. if either one of a complex conjugate pair of eigenvalues is selected, then both complex eigenvalues are selected.
Note that in the ill-conditioned case, a selected complex eigenvalue may no longer satisfy SELCTG(ALPHAR(j),ALPHAI(j), BETA(j)) = .TRUE. after ordering. INFO is to be set to N+2 in this case.N – [in]
N is INTEGER
The order of the matrices A, B, VSL, and VSR. N >= 0.
A – [inout]
A is REAL array, dimension (LDA, N)
On entry, the first of the pair of matrices.
On exit, A has been overwritten by its generalized Schur form S.LDA – [in]
LDA is INTEGER
The leading dimension of A. LDA >= fla_max(1,N).
B – [inout]
B is REAL array, dimension (LDB, N)
On entry, the second of the pair of matrices.
On exit, B has been overwritten by its generalized Schur form T.LDB – [in]
LDB is INTEGER
The leading dimension of B. LDB >= fla_max(1,N).
SDIM – [out]
SDIM is INTEGER
If SORT = ‘N’, SDIM = 0.
If SORT = ‘S’, SDIM = number of eigenvalues (after sorting) for which SELCTG is true. (Complex conjugate pairs for which SELCTG is true for either eigenvalue count as 2.)ALPHAR – [out] ALPHAR is REAL array, dimension (N)
ALPHAI – [out] ALPHAI is REAL array, dimension (N)
BETA – [out]
BETA is REAL array, dimension (N)
On exit, (ALPHAR(j) + ALPHAI(j)*i)/BETA(j), j=1,…,N, will be the generalized eigenvalues. ALPHAR(j) + ALPHAI(j)*i, and BETA(j),j=1,…,N are the diagonals of the complex Schur form (S,T) that would result if the 2-by-2 diagonal blocks of the real Schur form of (A,B) were further reduced to triangular form using 2-by-2 complex unitary transformations. If ALPHAI(j) is zero, then the j-th eigenvalue is real; if positive, then the j-th and (j+1)-st eigenvalues are a complex conjugate pair, with ALPHAI(j+1) negative.
Note: the quotients ALPHAR(j)/BETA(j) and ALPHAI(j)/BETA(j) may easily over- or underflow, and BETA(j) may even be zero. Thus, the user should avoid naively computing the ratio. However, ALPHAR and ALPHAI will be always less than and usually comparable with norm(A) in magnitude, and BETA always less than and usually comparable with norm(B).VSL – [out]
VSL is REAL array, dimension (LDVSL,N)
If JOBVSL = ‘V’, VSL will contain the left Schur vectors. Not referenced if JOBVSL = ‘N’.
LDVSL – [in]
LDVSL is INTEGER
The leading dimension of the matrix VSL. LDVSL >=1, and if JOBVSL = ‘V’, LDVSL >= N.
VSR – [out]
VSR is REAL array, dimension (LDVSR,N)
If JOBVSR = ‘V’, VSR will contain the right Schur vectors. Not referenced if JOBVSR = ‘N’.
LDVSR – [in]
LDVSR is INTEGER
The leading dimension of the matrix VSR. LDVSR >= 1, and if JOBVSR = ‘V’, LDVSR >= N.
WORK – [out]
WORK is REAL array, dimension (MAX(1,LWORK))
On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
LWORK – [in]
LWORK is INTEGER
The dimension of the array WORK.
If N = 0, LWORK >= 1, else LWORK >= fla_max(8*N,6*N+16). For good performance , LWORK must 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.
BWORK – [out]
BWORK is LOGICAL array, dimension (N)
Not referenced if SORT = ‘N’.
INFO – [out]
INFO is INTEGER
= 0: successful exit
< 0: if INFO = -i, the i-th argument had an illegal value.
= 1,…,N: The QZ iteration failed. (A,B) are not in Schur form, but ALPHAR(j), ALPHAI(j), and BETA(j) should be correct for j=INFO+1,…,N.
> N: =N+1: other than QZ iteration failed in SHGEQZ.
=N+2: after reordering, roundoff changed values of some complex eigenvalues so that leading eigenvalues in the Generalized Schur form no longer satisfy SELCTG=.TRUE. This could also be caused due to scaling.
=N+3: reordering failed in STGSEN.
-
template<typename T>
GGESX#
- group ggesx
Functions
-
template<typename T>
void ggesx(char *jobvsl, char *jobvsr, char *sort, void *selctg, char *sense, integer *n, T *a, integer *lda, T *b, integer *ldb, integer *sdim, T *alphar, T *alphai, T *beta, T *vsl, integer *ldvsl, T *vsr, integer *ldvsr, T *rconde, T *rcondv, T *work, integer *lwork, integer *iwork, integer *liwork, logical *bwork, integer *info)# GGESX computes the eigenvalues, the Schur form, and, optionally, the matrix of Schur vectors for GE matrices.
Purpose:
GGESX computes for a pair of N-by-N real nonsymmetric matrices (A,B), the generalized eigenvalues, the real Schur form (S,T), and, optionally, the left and/or right matrices of Schur vectors (VSL and VSR). This gives the generalized Schur factorization (A,B) = ( (VSL) S (VSR)**T, (VSL) T (VSR)**T) Optionally, it also orders the eigenvalues so that a selected cluster of eigenvalues appears in the leading diagonal blocks of the upper quasi-triangular matrix S and the upper triangular matrix T; computes a reciprocal condition number for the average of the selected eigenvalues (RCONDE); and computes a reciprocal condition number for the right and left deflating subspaces corresponding to the selected eigenvalues (RCONDV). The leading columns of VSL and VSR then form an orthonormal basis for the corresponding left and right eigenspaces (deflating subspaces). A generalized eigenvalue for a pair of matrices (A,B) is a scalar w or a ratio alpha/beta = w, such that A - w*B is singular. It is usually represented as the pair (alpha,beta), as there is a reasonable interpretation for beta=0 or for both being zero. A pair of matrices (S,T) is in generalized real Schur form if T is upper triangular with non-negative diagonal and S is block upper triangular with 1-by-1 and 2-by-2 blocks. 1-by-1 blocks correspond to real generalized eigenvalues, while 2-by-2 blocks of S will be "standardized" by making the corresponding elements of T have the form: [ a 0 ] [ 0 b ] and the pair of corresponding 2-by-2 blocks in S and T will have a complex conjugate pair of generalized eigenvalues.
- Parameters:
JOBVSL – [in]
JOBVSL is CHARACTER*1
= ‘N’: do not compute the left Schur vectors;
= ‘V’: compute the left Schur vectors.JOBVSR – [in]
JOBVSR is CHARACTER*1
= ‘N’: do not compute the right Schur vectors;
= ‘V’: compute the right Schur vectors.SORT – [in]
SORT is CHARACTER*1
Specifies whether or not to order the eigenvalues on the diagonal of the generalized Schur form.
= ‘N’: Eigenvalues are not ordered;
= ‘S’: Eigenvalues are ordered (see SELCTG).
SELCTG – [in]
SELCTG is a LOGICAL FUNCTION of three REAL arguments
SELCTG must be declared EXTERNAL in the calling subroutine.
If SORT = ‘N’, SELCTG is not referenced.
If SORT = ‘S’, SELCTG is used to select eigenvalues to sort to the top left of the Schur form.
An eigenvalue (ALPHAR(j)+ALPHAI(j))/BETA(j) is selected if SELCTG(ALPHAR(j),ALPHAI(j),BETA(j)) is true; i.e. if either one of a complex conjugate pair of eigenvalues is selected, then both complex eigenvalues are selected.
Note that a selected complex eigenvalue may no longer satisfy SELCTG(ALPHAR(j),ALPHAI(j),BETA(j)) = .TRUE. after ordering, since ordering may change the value of complex eigenvalues (especially if the eigenvalue is ill-conditioned), in this case INFO is set to N+3.
SENSE – [in]
SENSE is CHARACTER*1
Determines which reciprocal condition numbers are computed.
= ‘N’: None are computed;
= ‘E’: Computed for average of selected eigenvalues only;
= ‘V’: Computed for selected deflating subspaces only;
= ‘B’: Computed for both.
If SENSE = ‘E’, ‘V’, or ‘B’, SORT must equal ‘S’.N – [in]
N is INTEGER
The order of the matrices A, B, VSL, and VSR. N >= 0.
A – [inout]
A is REAL array, dimension (LDA, N)
On entry, the first of the pair of matrices.
On exit, A has been overwritten by its generalized Schur form S.LDA – [in]
LDA is INTEGER
The leading dimension of A. LDA >= fla_max(1,N).
B – [inout]
B is REAL array, dimension (LDB, N)
On entry, the second of the pair of matrices.
On exit, B has been overwritten by its generalized Schur form T.LDB – [in]
LDB is INTEGER
The leading dimension of B. LDB >= fla_max(1,N).
SDIM – [out]
SDIM is INTEGER
If SORT = ‘N’, SDIM = 0.
If SORT = ‘S’, SDIM = number of eigenvalues (after sorting) for which SELCTG is true. (Complex conjugate pairs for which SELCTG is true for either eigenvalue count as 2.)ALPHAR – [out] ALPHAR is REAL array, dimension (N)
ALPHAI – [out] ALPHAI is REAL array, dimension (N)
BETA – [out]
BETA is REAL array, dimension (N)
On exit, (ALPHAR(j) + ALPHAI(j)*i)/BETA(j), j=1,…,N, will be the generalized eigenvalues. ALPHAR(j) + ALPHAI(j)*i and BETA(j),j=1,…,N are the diagonals of the complex Schur form (S,T) that would result if the 2-by-2 diagonal blocks of the real Schur form of (A,B) were further reduced to triangular form using 2-by-2 complex unitary transformations. If ALPHAI(j) is zero, then the j-th eigenvalue is real; if positive, then the j-th and (j+1)-st eigenvalues are a complex conjugate pair, with ALPHAI(j+1) negative.
Note: the quotients ALPHAR(j)/BETA(j) and ALPHAI(j)/BETA(j) may easily over- or underflow, and BETA(j) may even be zero. Thus, the user should avoid naively computing the ratio. However, ALPHAR and ALPHAI will be always less than and usually comparable with norm(A) in magnitude, and BETA always less than and usually comparable with norm(B).VSL – [out]
VSL is REAL array, dimension (LDVSL,N)
If JOBVSL = ‘V’, VSL will contain the left Schur vectors. Not referenced if JOBVSL = ‘N’.
LDVSL – [in]
LDVSL is INTEGER
The leading dimension of the matrix VSL. LDVSL >=1, and if JOBVSL = ‘V’, LDVSL >= N.
VSR – [out]
VSR is REAL array, dimension (LDVSR,N)
If JOBVSR = ‘V’, VSR will contain the right Schur vectors. Not referenced if JOBVSR = ‘N’.
LDVSR – [in]
LDVSR is INTEGER
The leading dimension of the matrix VSR. LDVSR >= 1, and if JOBVSR = ‘V’, LDVSR >= N.
RCONDE – [out]
RCONDE is REAL array, dimension ( 2)
If SENSE = ‘E’ or ‘B’, RCONDE(1) and RCONDE(2) contain the reciprocal condition numbers for the average of the selected eigenvalues. Not referenced if SENSE = ‘N’ or ‘V’.
RCONDV – [out]
RCONDV is REAL array, dimension ( 2)
If SENSE = ‘V’ or ‘B’, RCONDV(1) and RCONDV(2) contain the reciprocal condition numbers for the selected deflating subspaces. Not referenced if SENSE = ‘N’ or ‘E’.
WORK – [out]
WORK is REAL array, dimension (MAX(1,LWORK))
On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
LWORK – [in]
LWORK is INTEGER
The dimension of the array WORK.
If N = 0, LWORK >= 1, else if SENSE = ‘E’, ‘V’, or ‘B’, LWORK >= fla_max( 8*N, 6*N+16, 2*SDIM*(N-SDIM) ), else LWORK >= fla_max( 8*N, 6*N+16 ).
Note that 2*SDIM*(N-SDIM) <= N*N/2. Note also that an error is only returned if LWORK < fla_max( 8*N, 6*N+16), but if SENSE = ‘E’ or ‘V’ or ‘B’ this may not be large enough.
If LWORK = -1, then a workspace query is assumed; the routine only calculates the bound on the optimal size of the WORK array and the minimum size of the IWORK array, returns these values as the first entries of the WORK and IWORK arrays, and no error message related to LWORK or LIWORK is issued by XERBLA.IWORK – [out]
IWORK is INTEGER array, dimension (MAX(1,LIWORK))
On exit, if INFO = 0, IWORK(1) returns the minimum LIWORK.
LIWORK – [in]
LIWORK is INTEGER
The dimension of the array IWORK.
If SENSE = ‘N’ or N = 0, LIWORK >= 1, otherwise LIWORK >= N+6.
If LIWORK = -1, then a workspace query is assumed; the routine only calculates the bound on the optimal size of the WORK array and the minimum size of the IWORK array, returns these values as the first entries of the WORK and IWORK arrays, and no error message related to LWORK or LIWORK is issued by XERBLA.
BWORK – [out]
BWORK is LOGICAL array, dimension (N)
Not referenced if SORT = ‘N’.
INFO – [out]
INFO is INTEGER
= 0: successful exit
< 0: if INFO = -i, the i-th argument had an illegal value.
= 1,…,N:
The QZ iteration failed. (A,B) are not in Schur form, but ALPHAR(j), ALPHAI(j), and BETA(j) should be correct for j=INFO+1,…,N.
> N: =N+1: other than QZ iteration failed in SHGEQZ
=N+2: after reordering, roundoff changed values of some complex eigenvalues so that leading eigenvalues in the Generalized Schur form no longer satisfy SELCTG=.TRUE. This could also be caused due to scaling.
=N+3: reordering failed in STGSEN.
-
template<typename T, typename Ta>
void ggesx(char *jobvsl, char *jobvsr, char *sort, void *selctg, char *sense, integer *n, T *a, integer *lda, T *b, integer *ldb, integer *sdim, T *alpha, T *beta, T *vsl, integer *ldvsl, T *vsr, integer *ldvsr, Ta *rconde, Ta *rcondv, T *work, integer *lwork, Ta *rwork, integer *iwork, integer *liwork, logical *bwork, integer *info)#
-
template<typename T>
GEBAL#
- group gebal
Functions
-
template<typename T>
void gebal(char *job, integer *n, T *a, integer *lda, integer *ilo, integer *ihi, T *scale, integer *info)# GEBAL It balances a real matrix
Purpose:
GEBAL balances a general real matrix A. This involves, first, permuting A by a similarity transformation to isolate eigenvalues in the first 1 to ILO-1 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 1-norm of the matrix, and improve the accuracy of the computed eigenvalues and/or eigenvectors.
- Parameters:
JOB – [in]
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.
N – [in]
N is INTEGER
The order of the matrix A. N >= 0.
A – [inout]
A 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.LDA – [in]
LDA is INTEGER
The leading dimension of the array A. LDA >= fla_max(1,N).
ILO – [out] ILO is INTEGER
IHI – [out]
IHI is INTEGER
ILO and IHI are set to integers such that on exit A(i,j) = 0 if i > j and j = 1,…,ILO-1 or I = IHI+1,…,N. If JOB = ‘N’ or ‘S’, ILO = 1 and IHI = N.
SCALE – [out]
SCALE 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,…,ILO-1
= 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 ILO-1.INFO – [out]
INFO is INTEGER
= 0: successful exit.
< 0: if INFO = -i, the i-th argument had an illegal value.
-
template<typename T>
GEHRD#
- group gehrd
Functions
-
template<typename T>
void gehrd(integer *n, integer *ilo, integer *ihi, T *a, integer *lda, T *tau, T *work, integer *lwork, integer *info)# Reduction to upper Hessenberg form.
Purpose:
Reduction of a real general matrix a to upper Hessenberg form H by an orthogonal similarity transformation: Q**T * A * Q = H .
Further Details
The matrix Q is represented as a product of (ihi-ilo) elementary reflectors Q = H(ilo) H(ilo+1) . . . H(ihi-1). 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, vi denotes an element of the vector defining H(i).
- Parameters:
n – [in]
n is integer*
The order of the matrix a. n >= 0.
ilo – [in] ilo is integer*
ihi – [in]
ihi is integer*
It is assumed that A is already upper triangular in rows and columns 1:ilo-1 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.
a – [inout]
a is float/double/COMPLEX/COMPLEX*16 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.lda – [in]
lda is integer*
The leading dimension of the array a. lda >= fla_max(1,n).
tau – [out]
tau is float/double/COMPLEX/COMPLEX*16 array, dimension (n-1)
The scalar factors of the elementary reflectors (see Further Details). Elements 1:ilo-1 and ihi:N-1 of tau are set to zero.
WORK – [out]
WORK is COMPLEX array, dimension (LWORK)
On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
LWORK – [in]
LWORK is INTEGER
The length of the array WORK. LWORK >= fla_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.
INFO – [out]
INFO is INTEGER
= 0: successful exit
< 0: if INFO = -i, the i-th argument had an illegal value.
-
template<typename T>
GEHD2#
- group gehd2
Functions
-
template<typename T>
void gehd2(integer *n, integer *ilo, integer *ihi, T *a, integer *lda, T *tau, T *work, integer *info)# Reduction to upper Hessenberg form using an unblocked algorithm.
Purpose:
Reduction of a real general matrix a to upper Hessenberg form H by an orthogonal similarity transformation: Q**T * A * Q = H .
Further Details
The matrix Q is represented as a product of (ihi-ilo) elementary reflectors Q = H(ilo) H(ilo+1) . . . H(ihi-1). 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, vi denotes an element of the vector defining H(i).
- Parameters:
n – [in]
n is integer*
The order of the matrix a. n >= 0.
ilo – [in] ilo is integer*
ihi – [in]
ihi is integer*
It is assumed that A is already upper triangular in rows and columns 1:ilo-1 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 <= fla_max(1,n).
a – [inout]
a is float/double/COMPLEX/COMPLEX*16 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.lda – [in]
lda is integer*
The leading dimension of the array a. lda >= fla_max(1,n).
tau – [out]
tau is float/double/COMPLEX/COMPLEX*16 array, dimension (n-1)
The scalar factors of the elementary reflectors (see Further Details).
WORK – [out] WORK is COMPLEX array, dimension (N)
INFO – [out]
INFO is INTEGER
= 0: successful exit
< 0: if INFO = -i, the i-th argument had an illegal value.
-
template<typename T>
LAHR2#
- group lahr2
Functions
-
template<typename T>
void lahr2(integer *n, integer *k, integer *nb, T *a, integer *lda, T *tau, T *t, integer *ldt, T *y, integer *ldy)# LAHR2 reduces the specified number of first columns of a general
rectangular matrix A so that elements below the specified subdiagonal
are zero, and returns auxiliary matrices which are needed to apply the
transformation to the unreduced part of A.
Purpose:
LAHR2 reduces the first NB columns of A real general n-BY-(n-k+1) matrix A so that elements below the k-th subdiagonal are zero. The reduction is performed by an orthogonal similarity transformation Q**T * A * Q. The routine returns the matrices V and T which determine Q as a block reflector I - V*T*V**T, and also the matrix Y = A * V * T. This is an auxiliary routine called by GEHRD.
- Parameters:
N – [in]
N is INTEGER
The order of the matrix A.
K – [in]
K is INTEGER
The offset for the reduction. Elements below the k-th subdiagonal in the first NB columns are reduced to zero. K < N.
NB – [in]
NB is INTEGER
The number of columns to be reduced.
A – [inout]
A is REAL array, dimension (LDA,N-K+1)
On entry, the n-by-(n-k+1) general matrix A.
On exit, the elements on and above the k-th subdiagonal in the first NB columns are overwritten with the corresponding elements of the reduced matrix; the elements below the k-th subdiagonal, with the array TAU, represent the matrix Q as a product of elementary reflectors. The other columns of A are unchanged. See Further Details.LDA – [in]
LDA is INTEGER
The leading dimension of the array A. LDA >= fla_max(1,N).
TAU – [out]
TAU is REAL array, dimension (NB)
The scalar factors of the elementary reflectors. See Further Details.
T – [out]
T is REAL array, dimension (LDT,NB)
The upper triangular matrix T.
LDT – [in]
LDT is INTEGER
The leading dimension of the array T. LDT >= NB.
Y – [out]
Y is REAL array, dimension (LDY,NB)
The n-by-nb matrix Y.
LDY – [in]
LDY is INTEGER
The leading dimension of the array Y. LDY >= N.
-
template<typename T>
GHR#
- group ghr
Functions
-
template<typename T>
void orghr(integer *n, integer *ilo, integer *ihi, T *a, integer *lda, T *tau, T *work, integer *lwork, integer *info)# ORGHR generates a real orthogonal matrix Q.
Purpose:
ORGHR generates a real orthogonal matrix Q which is defined as the product of IHI-ILO elementary reflectors of order N, as returned by SGEHRD: Q = H(ilo) H(ilo+1) . . . H(ihi-1).
- Parameters:
N – [in]
N is INTEGER
The order of the matrix Q. N >= 0.
ILO – [in] ILO is INTEGER
IHI – [in]
IHI is INTEGER
ILO and IHI must have the same values as in the previous call of SGEHRD. Q is equal to the unit matrix except in the submatrix Q(ilo+1:ihi,ilo+1:ihi).
1 <= ILO <= IHI <= N, if N > 0; ILO=1 and IHI=0, if N=0.A – [inout]
A is REAL array, dimension (LDA,N)
On entry, the vectors which define the elementary reflectors, as returned by SGEHRD.
On exit, the N-by-N orthogonal matrix Q.LDA – [in]
LDA is INTEGER
The leading dimension of the array A. LDA >= fla_max(1,N).
TAU – [in]
TAU is REAL array, dimension (N-1)
TAU(i) must contain the scalar factor of the elementary reflector H(i), as returned by SGEHRD.
WORK – [out]
WORK is REAL array, dimension (MAX(1,LWORK))
On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
LWORK – [in]
LWORK is INTEGER
The dimension of the array WORK. LWORK >= IHI-ILO. For optimum performance LWORK >= (IHI-ILO)*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.INFO – [out]
INFO is INTEGER
= 0: successful exit
< 0: if INFO = -i, the i-th argument had an illegal value
-
template<typename T>
MHR#
- group mhr
Functions
-
template<typename T>
void ormhr(char *side, char *trans, integer *m, integer *n, integer *ilo, integer *ihi, T *a, integer *lda, T *tau, T *c, integer *ldc, T *work, integer *lwork, integer *info)# ORMHR overwrites the general real M-by-N matrix C.
Purpose:
ORMHR overwrites the general real M-by-N 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 of order nq, with nq = m if SIDE = 'L' and nq = n if SIDE = 'R'. Q is defined as the product of IHI-ILO elementary reflectors, as returned by SGEHRD: Q = H(ilo) H(ilo+1) . . . H(ihi-1).
- Parameters:
SIDE – [in]
SIDE is CHARACTER*1
= ‘L’: apply Q or Q**T from the Left;
= ‘R’: apply Q or Q**T from the Right.TRANS – [in]
TRANS is CHARACTER*1
= ‘N’: No transpose, apply Q;
= ‘T’: Transpose, apply Q**T.M – [in]
M is INTEGER
The number of rows of the matrix C. M >= 0.
N – [in]
N is INTEGER
The number of columns of the matrix C. N >= 0.
ILO – [in] ILO is INTEGER
IHI – [in]
IHI is INTEGER
ILO and IHI must have the same values as in the previous call of SGEHRD. Q is equal to the unit matrix except in the submatrix Q(ilo+1:ihi,ilo+1:ihi).
If SIDE = ‘L’, then 1 <= ILO <= IHI <= M, if M > 0, and ILO = 1 and IHI = 0, if M = 0;
if SIDE = ‘R’, then 1 <= ILO <= IHI <= N, if N > 0, and ILO = 1 and IHI = 0, if N = 0.
A – [in]
A is REAL array, dimension
(LDA,M) if SIDE = ‘L’
(LDA,N) if SIDE = ‘R’
The vectors which define the elementary reflectors, as returned by SGEHRD.
LDA – [in]
LDA is INTEGER
The leading dimension of the array A.
LDA >= fla_max(1,M) if SIDE = ‘L’; LDA >= fla_max(1,N) if SIDE = ‘R’.TAU – [in]
TAU is REAL array, dimension
(M-1) if SIDE = ‘L’
(N-1) if SIDE = ‘R’
TAU(i) must contain the scalar factor of the elementary reflector H(i), as returned by SGEHRD.
C – [inout]
C is REAL array, dimension (LDC,N)
On entry, the M-by-N matrix C.
On exit, C is overwritten by Q*C or Q**T*C or C*Q**T or C*Q.LDC – [in]
LDC is INTEGER
The leading dimension of the array C. LDC >= fla_max(1,M).
WORK – [out]
WORK is REAL array, dimension (MAX(1,LWORK))
On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
LWORK – [in]
LWORK is INTEGER
The dimension of the array WORK.
If SIDE = ‘L’, LWORK >= fla_max(1,N);
if SIDE = ‘R’, LWORK >= fla_max(1,M).
For optimum performance LWORK >= N*NB if SIDE = ‘L’, and LWORK >= M*NB if SIDE = ‘R’, 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.
INFO – [out]
INFO is INTEGER
= 0: successful exit
< 0: if INFO = -i, the i-th argument had an illegal value
-
template<typename T>
GEBAK#
- group gebak
Functions
-
template<typename T>
void gebak(char *job, char *side, integer *n, integer *ilo, integer *ihi, T *scale, integer *m, T *v, integer *ldv, integer *info)# GEBAK Forms right left vectors of real general matrix
None#
GEBAK forms the right or left eigenvectors of a real general matrix by backward transformation on the computed eigenvectors of the balanced matrix output by GEBAL.
- Parameters:
JOB – [in]
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.SIDE – [in]
SIDE is CHARACTER*1
= ‘R’: V contains right eigenvectors;
= ‘L’: V contains left eigenvectors.N – [in]
N is INTEGER
The number of rows of the matrix V. N >= 0.
ILO – [in] ILO is INTEGER
IHI – [in]
IHI 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.SCALE – [in]
SCALE is REAL array, dimension (N)
Details of the permutation and scaling factors, as returned by SGEBAL.
M – [in]
M is INTEGER
The number of columns of the matrix V. M >= 0.
V – [inout]
V 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.LDV – [in]
LDV is INTEGER
The leading dimension of the array V. LDV >= fla_max(1,N).
INFO – [out]
INFO is INTEGER
= 0: successful exit
< 0: if INFO = -i, the i-th argument had an illegal value.
-
template<typename T>
HSEQR#
- group hseqr
Functions
-
template<typename T>
void hseqr(char *job, char *compz, integer *n, integer *ilo, integer *ihi, T *h, integer *ldh, T *wr, T *wi, T *z, integer *ldz, T *work, integer *lwork, integer *info)# HSEQR computes the eigenvalues of a Hessenberg matrix H.
Purpose:
HSEQR computes the eigenvalues of a Hessenberg matrix H and, optionally, the matrices T and Z from the Schur decomposition H = Z T Z**T, where T is an upper quasi-triangular matrix (the Schur form), and Z is the orthogonal matrix of Schur vectors. Optionally Z may be postmultiplied into an input orthogonal matrix Q so that this routine can give the Schur factorization of a matrix A which has been reduced to the Hessenberg form H by the orthogonal matrix Q: A = Q*H*Q**T = (QZ)*T*(QZ)**T.
- Parameters:
JOB – [in]
JOB is CHARACTER*1
= ‘E’: compute eigenvalues only;
= ‘S’: compute eigenvalues and the Schur form T.COMPZ – [in]
COMPZ is CHARACTER*1
= ‘N’: no Schur vectors are computed;
= ‘I’: Z is initialized to the unit matrix and the matrix Z of Schur vectors of H is returned;
= ‘V’: Z must contain an orthogonal matrix Q on entry, and the product Q*Z is returned.
N – [in]
N is INTEGER
The order of the matrix H. N >= 0.
ILO – [in] ILO is INTEGER
IHI – [in]
IHI is INTEGER
It is assumed that H is already upper triangular in rows and columns 1:ILO-1 and IHI+1:N. ILO and IHI are normally set by a previous call to SGEBAL, and then passed to ZGEHRD when the matrix output by SGEBAL is reduced to Hessenberg form. Otherwise ILO and IHI should be set to 1 and N respectively. If N > 0, then 1 <= ILO <= IHI <= N. If N = 0, then ILO = 1 and IHI = 0.
H – [inout]
H is REAL array, dimension (LDH,N)
On entry, the upper Hessenberg matrix H.
On exit, if INFO = 0 and JOB = ‘S’, then H contains the upper quasi-triangular matrix T from the Schur decomposition (the Schur form); 2-by-2 diagonal blocks (corresponding to complex conjugate pairs of eigenvalues) are returned in standard form, with H(i,i) = H(i+1,i+1) and H(i+1,i)*H(i,i+1) < 0. If INFO = 0 and JOB = ‘E’, the contents of H are unspecified on exit. (The output value of H when INFO > 0 is given under the description of INFO below.)
Unlike earlier versions of SHSEQR, this subroutine may explicitly H(i,j) = 0 for i > j and j = 1, 2, … ILO-1 or j = IHI+1, IHI+2, … N.
LDH – [in]
LDH is INTEGER
The leading dimension of the array H. LDH >= fla_max(1,N).
WR – [out] WR is REAL array, dimension (N)
WI – [out]
WI is REAL array, dimension (N)
The real and imaginary parts, respectively, of the computed eigenvalues. If two eigenvalues are computed as a complex conjugate pair, they are stored in consecutive elements of WR and WI, say the i-th and (i+1)th, with WI(i) > 0 and WI(i+1) < 0. If JOB = ‘S’, the eigenvalues are stored in the same order as on the diagonal of the Schur form returned in H, with WR(i) = H(i,i) and, if H(i:i+1,i:i+1) is a 2-by-2 diagonal block, WI(i) = sqrt(-H(i+1,i)*H(i,i+1)) and WI(i+1) = -WI(i).
Z – [inout]
Z is REAL array, dimension (LDZ,N)
If COMPZ = ‘N’, Z is not referenced.
If COMPZ = ‘I’, on entry Z need not be set and on exit,
if INFO = 0, Z contains the orthogonal matrix Z of the Schur vectors of H. If COMPZ = ‘V’, on entry Z must contain an N-by-N matrix Q, which is assumed to be equal to the unit matrix except for the submatrix Z(ILO:IHI,ILO:IHI).
On exit, if INFO = 0, Z contains Q*Z. Normally Q is the orthogonal matrix generated by SORGHR after the call to SGEHRD which formed the Hessenberg matrix H. (The output value of Z when INFO > 0 is given under the description of INFO below.)LDZ – [in]
LDZ is INTEGER
The leading dimension of the array Z. if COMPZ = ‘I’ or COMPZ = ‘V’, then LDZ >= MAX(1,N). Otherwise, LDZ >= 1.
WORK – [out]
WORK is REAL array, dimension (LWORK)
On exit, if INFO = 0, WORK(1) returns an estimate of the optimal value for LWORK.
LWORK – [in]
LWORK is INTEGER
The dimension of the array WORK. LWORK >= fla_max(1,N) is sufficient and delivers very good and sometimes optimal performance. However, LWORK as large as 11*N may be required for optimal performance. A workspace query is recommended to determine the optimal workspace size.
If LWORK = -1, then SHSEQR does a workspace query. In this case, SHSEQR checks the input parameters and estimates the optimal workspace size for the given values of N, ILO and IHI. The estimate is returned in WORK(1). No error message related to LWORK is issued by XERBLA. Neither H nor Z are accessed.INFO – [out]
INFO is INTEGER
= 0: successful exit
< 0: if INFO = -i, the i-th argument had an illegal value
> 0: if INFO = i, SHSEQR failed to compute all of the eigenvalues. Elements 1:ilo-1 and i+1:n of WR and WI contain those eigenvalues which have been successfully computed. (Failures are rare.)
If INFO > 0 and JOB = ‘E’, then on exit, the remaining unconverged eigenvalues are the eigen- values of the upper Hessenberg matrix rows and columns ILO through INFO of the final, output value of H.
If INFO > 0 and JOB = ‘S’, then on exit
(*) (initial value of H)*U = U*(final value of H)
where U is an orthogonal matrix. The final value of H is upper Hessenberg and quasi-triangular in rows and columns INFO+1 through IHI.
If INFO > 0 and COMPZ = ‘V’, then on exit
(final value of Z) = (initial value of Z)*U
where U is the orthogonal matrix in (*) (regard- less of the value of JOB.)
If INFO > 0 and COMPZ = ‘I’, then on exit (final value of Z) = U where U is the orthogonal matrix in (*) (regard- less of the value of JOB.)
If INFO > 0 and COMPZ = ‘N’, then Z is not accessed.
-
template<typename T>
HSEIN#
- group hsein
Functions
-
template<typename T>
void hsein(char *job, char *eigsrc, char *initv, logical *select, integer *n, T *h, integer *ldh, T *wr, T *wi, T *vl, integer *ldvl, T *vr, integer *ldvr, integer *mm, integer *m, T *work, integer *ifaill, integer *ifailr, integer *info)# HSEIN uses inverse iteration to find specified right and/or left
eigenvectors of a real upper Hessenberg matrix H.
Purpose:
HSEIN uses inverse iteration to find specified right and/or left eigenvectors of a real upper Hessenberg matrix H. The right eigenvector x and the left eigenvector y of the matrix H corresponding to an eigenvalue w are defined by: H * x = w * x, y**h * H = w * y**h where y**h denotes the conjugate transpose of the vector y.
- Parameters:
SIDE – [in]
SIDE is CHARACTER*1
= ‘R’: compute right eigenvectors only;
= ‘L’: compute left eigenvectors only;
= ‘B’: compute both right and left eigenvectors.
EIGSRC – [in]
EIGSRC is CHARACTER*1
Specifies the source of eigenvalues supplied in (WR,WI):
= ‘Q’: the eigenvalues were found using SHSEQR; thus, if H has zero subdiagonal elements, and so is block-triangular, then the j-th eigenvalue can be assumed to be an eigenvalue of the block containing the j-th row/column. This property allows SHSEIN to perform inverse iteration on just one diagonal block.
= ‘N’: no assumptions are made on the correspondence between eigenvalues and diagonal blocks. In this case, SHSEIN must always perform inverse iteration using the whole matrix H.
INITV – [in]
INITV is CHARACTER*1
= ‘N’: no initial vectors are supplied;
= ‘U’: user-supplied initial vectors are stored in the arrays VL and/or VR.SELECT – [inout]
SELECT is LOGICAL array, dimension (N)
Specifies the eigenvectors to be computed. To select the real eigenvector corresponding to a real eigenvalue WR(j), SELECT(j) must be set to .TRUE.. To select the complex eigenvector corresponding to a complex eigenvalue (WR(j),WI(j)), with complex conjugate (WR(j+1),WI(j+1)), either SELECT(j) or SELECT(j+1) or both must be set to .TRUE.; then on exit SELECT(j) is .TRUE. and SELECT(j+1) is .FALSE..
N – [in]
N is INTEGER
The order of the matrix H. N >= 0.
H – [in]
H is REAL array, dimension (LDH,N)
The upper Hessenberg matrix H. If a NaN is detected in H, the routine will return with INFO=-6.
LDH – [in]
LDH is INTEGER
The leading dimension of the array H. LDH >= fla_max(1,N).
WR – [inout] WR is REAL array, dimension (N)
WI – [in]
WI is REAL array, dimension (N)
On entry, the real and imaginary parts of the eigenvalues of H; a complex conjugate pair of eigenvalues must be stored in consecutive elements of WR and WI.
On exit, WR may have been altered since close eigenvalues are perturbed slightly in searching for independent eigenvectors.VL – [inout]
VL is REAL array, dimension (LDVL,MM)
On entry, if INITV = ‘U’ and SIDE = ‘L’ or ‘B’, VL must contain starting vectors for the inverse iteration for the left eigenvectors; the starting vector for each eigenvector must be in the same column(s) in which the eigenvector will be stored.
On exit, if SIDE = ‘L’ or ‘B’, the left eigenvectors specified by SELECT will be 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. If SIDE = ‘R’, VL is not referenced.LDVL – [in]
LDVL is INTEGER
The leading dimension of the array VL.
LDVL >= fla_max(1,N) if SIDE = ‘L’ or ‘B’; LDVL >= 1 otherwise.VR – [inout]
VR is REAL array, dimension (LDVR,MM)
On entry, if INITV = ‘U’ and SIDE = ‘R’ or ‘B’, VR must contain starting vectors for the inverse iteration for the right eigenvectors; the starting vector for each eigenvector must be in the same column(s) in which the eigenvector will be stored.
On exit, if SIDE = ‘R’ or ‘B’, the right eigenvectors specified by SELECT will be 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. If SIDE = ‘L’, VR is not referenced.LDVR – [in]
LDVR is INTEGER
The leading dimension of the array VR. LDVR >= fla_max(1,N) if SIDE = ‘R’ or ‘B’; LDVR >= 1 otherwise.
MM – [in]
MM is INTEGER
The number of columns in the arrays VL and/or VR. MM >= M.
M – [out]
M is INTEGER
The number of columns in the arrays VL and/or VR required to store the eigenvectors; each selected real eigenvector occupies one column and each selected complex eigenvector occupies two columns.
IFAILL – [out]
IFAILL is INTEGER array, dimension (MM)
If SIDE = ‘L’ or ‘B’, IFAILL(i) = j > 0 if the left eigenvector in the i-th column of VL (corresponding to the eigenvalue w(j)) failed to converge; IFAILL(i) = 0 if the eigenvector converged satisfactorily. If the i-th and (i+1)th columns of VL hold a complex eigenvector, then IFAILL(i) and IFAILL(i+1) are set to the same value.
If SIDE = ‘R’, IFAILL is not referenced.IFAILR – [out]
IFAILR is INTEGER array, dimension (MM)
If SIDE = ‘R’ or ‘B’, IFAILR(i) = j > 0 if the right eigenvector in the i-th column of VR (corresponding to the eigenvalue w(j)) failed to converge; IFAILR(i) = 0 if the eigenvector converged satisfactorily. If the i-th and (i+1)th columns of VR hold a complex eigenvector, then IFAILR(i) and IFAILR(i+1) are set to the same value.
If SIDE = ‘L’, IFAILR is not referenced.WORK – [out] WORK is REAL array, dimension ((N+2)*N)
IFAILL – [out]
IFAILL is INTEGER array, dimension (MM)
If SIDE = ‘L’ or ‘B’, IFAILL(i) = j > 0 if the left eigenvector in the i-th column of VL (corresponding to the eigenvalue w(j)) failed to converge; IFAILL(i) = 0 if the eigenvector converged satisfactorily. If the i-th and (i+1)th columns of VL hold a complex eigenvector, then IFAILL(i) and IFAILL(i+1) are set to the same value.
If SIDE = ‘R’, IFAILL is not referenced.IFAILR – [out]
IFAILR is INTEGER array, dimension (MM)
If SIDE = ‘R’ or ‘B’, IFAILR(i) = j > 0 if the right eigenvector in the i-th column of VR (corresponding to the eigenvalue w(j)) failed to converge; IFAILR(i) = 0 if the eigenvector converged satisfactorily. If the i-th and (i+1)th columns of VR hold a complex eigenvector, then IFAILR(i) and IFAILR(i+1) are set to the same value.
If SIDE = ‘L’, IFAILR is not referenced.INFO – [out]
INFO is INTEGER
= 0: successful exit
< 0: if INFO = -i, the i-th argument had an illegal value
> 0: if INFO = i, i is the number of eigenvectors which failed to converge; see IFAILL and IFAILR for further details.
-
template<typename T>
TREVC#
- group trevc
Functions
-
template<typename T>
void trevc(char *side, char *howmny, logical *select, integer *n, T *t, integer *ldt, T *vl, integer *ldvl, T *vr, integer *ldvr, integer *mm, integer *m, T *work, integer *info)# TREVC computes some or all of the right and/or left eigenvectors of
a real upper quasi-triangular matrix T.
Purpose:
TREVC computes some or all of the right and/or left eigenvectors of a real upper quasi-triangular matrix T. Matrices of this type are produced by the Schur factorization of a real general matrix: A = Q*T*Q**T, as computed by SHSEQR. The right eigenvector x and the left eigenvector y of T corresponding to an eigenvalue w are defined by: T*x = w*x, (y**H)*T = w*(y**H) where y**H denotes the conjugate transpose of y. The eigenvalues are not input to this routine, but are read directly from the diagonal blocks of T. This routine returns the matrices X and/or Y of right and left eigenvectors of T, or the products Q*X and/or Q*Y, where Q is an input matrix. If Q is the orthogonal factor that reduces a matrix A to Schur form T, then Q*X and Q*Y are the matrices of right and left eigenvectors of A.
- Parameters:
SIDE – [in]
SIDE is CHARACTER*1
= ‘R’: compute right eigenvectors only;
= ‘L’: compute left eigenvectors only;
= ‘B’: compute both right and left eigenvectors.
HOWMNY – [in]
HOWMNY 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, as indicated by the logical array SELECT.
SELECT – [inout]
SELECT 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’.N – [in]
N is INTEGER
The order of the matrix T. N >= 0.
T – [in]
T is REAL array, dimension (LDT,N)
The upper quasi-triangular matrix T in Schur canonical form.
LDT – [in]
LDT is INTEGER
The leading dimension of the array T. LDT >= fla_max(1,N).
VL – [inout]
VL is REAL array, dimension (LDVL,MM)
On entry, if SIDE = ‘L’ or ‘B’ and HOWMNY = ‘B’, VL must contain an N-by-N matrix Q (usually the orthogonal matrix Q of Schur vectors returned by SHSEQR).
On exit, if SIDE = ‘L’ or ‘B’, VL contains:
if HOWMNY = ‘A’, the matrix Y of left eigenvectors of T;
if HOWMNY = ‘B’, the matrix Q*Y;
if HOWMNY = ‘S’, the left eigenvectors of T 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’.LDVL – [in]
LDVL is INTEGER
The leading dimension of the array VL. LDVL >= 1, and if SIDE = ‘L’ or ‘B’, LDVL >= N.
VR – [inout]
VR is REAL array, dimension (LDVR,MM)
On entry, if SIDE = ‘R’ or ‘B’ and HOWMNY = ‘B’, VR must contain an N-by-N matrix Q (usually the orthogonal matrix Q of Schur vectors returned by SHSEQR).
On exit, if SIDE = ‘R’ or ‘B’, VR contains:
if HOWMNY = ‘A’, the matrix X of right eigenvectors of T;
if HOWMNY = ‘B’, the matrix Q*X;
if HOWMNY = ‘S’, the right eigenvectors of T 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’.
LDVR – [in]
LDVR is INTEGER
The leading dimension of the array VR. LDVR >= 1, and if SIDE = ‘R’ or ‘B’, LDVR >= N.
MM – [in]
MM is INTEGER
The number of columns in the arrays VL and/or VR. MM >= M.
M – [out]
M 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.WORK – [out] WORK is REAL array, dimension (3*N)
INFO – [out]
INFO is INTEGER
= 0: successful exit
< 0: if INFO = -i, the i-th argument had an illegal value
-
template<typename T>
TREVC3#
- group trevc3
Functions
-
template<typename T>
void trevc3(char *side, char *howmny, logical *select, integer *n, T *t, integer *ldt, T *vl, integer *ldvl, T *vr, integer *ldvr, integer *mm, integer *m, T *work, integer *lwork, integer *info)# TREVC3 computes some or all of the right and/or left eigenvectors
of a real upper quasi-triangular matrix T.
Purpose:
TREVC3 computes some or all of the right and/or left eigenvectors of a complex upper triangular matrix T. Matrices of this type are produced by the Schur factorization of a complex general matrix: A = Q*T*Q**H, as computed by CHSEQR. The right eigenvector x and the left eigenvector y of T corresponding to an eigenvalue w are defined by: T*x = w*x, (y**H)*T = w*(y**H) where y**H denotes the conjugate transpose of the vector y. The eigenvalues are not input to this routine, but are read directly from the diagonal of T. This routine returns the matrices X and/or Y of right and left eigenvectors of T, or the products Q*X and/or Q*Y, where Q is an input matrix. If Q is the unitary factor that reduces a matrix A to Schur form T, then Q*X and Q*Y are the matrices of right and left eigenvectors of A. This uses a Level 3 BLAS version of the back transformation.
- Parameters:
SIDE – [in]
SIDE is CHARACTER*1
= ‘R’: compute right eigenvectors only;
= ‘L’: compute left eigenvectors only;
= ‘B’: compute both right and left eigenvectors.
HOWMNY – [in]
HOWMNY is CHARACTER*1
= ‘A’: compute all right and/or left eigenvectors;
= ‘B’: compute all right and/or left eigenvectors, backtransformed using the matrices supplied in VR and/or VL;
= ‘S’: compute selected right and/or left eigenvectors, as indicated by the logical array SELECT.
SELECT – [in]
SELECT is LOGICAL array, dimension (N)
If HOWMNY = ‘S’, SELECT specifies the eigenvectors to be computed.
The eigenvector corresponding to the j-th eigenvalue is computed if SELECT(j) = .TRUE.. Not referenced if HOWMNY = ‘A’ or ‘B’.N – [in]
N is INTEGER
The order of the matrix T. N >= 0.
T – [inout]
T is COMPLEX array, dimension (LDT,N)
The upper triangular matrix T. T is modified, but restored on exit.
LDT – [in]
LDT is INTEGER
The leading dimension of the array T. LDT >= fla_max(1,N).
VL – [inout]
VL is COMPLEX array, dimension (LDVL,MM)
On entry, if SIDE = ‘L’ or ‘B’ and HOWMNY = ‘B’, VL must contain an N-by-N matrix Q (usually the unitary matrix Q of Schur vectors returned by CHSEQR).
On exit, if SIDE = ‘L’ or ‘B’, VL contains:
if HOWMNY = ‘A’, the matrix Y of left eigenvectors of T;
if HOWMNY = ‘B’, the matrix Q*Y;
if HOWMNY = ‘S’, the left eigenvectors of T specified by SELECT, stored consecutively in the columns of VL, in the same order as their eigenvalues.
Not referenced if SIDE = ‘R’.LDVL – [in]
LDVL is INTEGER
The leading dimension of the array VL.
LDVL >= 1, and if SIDE = ‘L’ or ‘B’, LDVL >= N.VR – [inout]
VR is COMPLEX array, dimension (LDVR,MM)
On entry, if SIDE = ‘R’ or ‘B’ and HOWMNY = ‘B’, VR must contain an N-by-N matrix Q (usually the unitary matrix Q of Schur vectors returned by CHSEQR).
On exit, if SIDE = ‘R’ or ‘B’, VR contains:
if HOWMNY = ‘A’, the matrix X of right eigenvectors of T;
if HOWMNY = ‘B’, the matrix Q*X;
if HOWMNY = ‘S’, the right eigenvectors of T specified by SELECT, stored consecutively in the columns of VR, in the same order as their eigenvalues.
Not referenced if SIDE = ‘L’.LDVR – [in]
LDVR is INTEGER
The leading dimension of the array VR.
LDVR >= 1, and if SIDE = ‘R’ or ‘B’, LDVR >= N.MM – [in]
MM is INTEGER
The number of columns in the arrays VL and/or VR. MM >= M.
M – [out]
M 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 eigenvector occupies one column.WORK – [out] WORK is COMPLEX array, dimension (MAX(1,LWORK))
LWORK – [in]
LWORK is INTEGER
The dimension of array WORK. LWORK >= fla_max(1,2*N).
For optimum performance, LWORK >= N + 2*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.
RWORK – [out] RWORK is REAL array, dimension (LRWORK)
LRWORK – [in]
LRWORK is INTEGER
The dimension of array RWORK. LRWORK >= fla_max(1,N).
If LRWORK = -1, then a workspace query is assumed; the routine only calculates the optimal size of the RWORK array, returns this value as the first entry of the RWORK array, and no error message related to LRWORK is issued by XERBLA.INFO – [out]
INFO is INTEGER
= 0: successful exit
< 0: if INFO = -i, the i-th argument had an illegal value
-
template<typename T>
LALN2#
- group laln2
Functions
-
template<typename T>
void laln2(logical *ltrans, integer *na, integer *nw, float *smin, float *ca, float *a, integer *lda, float *d1, float *d2, float *b, integer *ldb, float *wr, float *wi, float *x, integer *ldx, float *scale, float *xnorm, integer *info)# LALN2 solves a 1-by-1 or 2-by-2 linear system of equations of the specified form.
Purpose:
LALN2 solves a system of the form (ca A - w D) X = s B or (ca A**T - w D) X = s B with possible scaling ("s") and perturbation of A. (A**T means A-transpose.) A is an NA x NA real matrix, ca is a real scalar, D is an NA x NA real diagonal matrix, w is a real or complex value, and X and B are NA x 1 matrices -- real if w is real, complex if w is complex. NA may be 1 or 2. If w is complex, X and B are represented as NA x 2 matrices, the first column of each being the real part and the second being the imaginary part. "s" is a scaling factor (<= 1), computed by SLALN2, which is so chosen that X can be computed without overflow. X is further scaled if necessary to assure that norm(ca A - w D)*norm(X) is less than overflow. If both singular values of (ca A - w D) are less than SMIN, SMIN*identity will be used instead of (ca A - w D). If only one singular value is less than SMIN, one element of (ca A - w D) will be perturbed enough to make the smallest singular value roughly SMIN. If both singular values are at least SMIN, (ca A - w D) will not be perturbed. In any case, the perturbation will be at most some small multiple of fla_max(SMIN, ulp*norm(ca A - w D)). The singular values are computed by infinity-norm approximations, and thus will only be correct to a factor of 2 or so. Note: all input quantities are assumed to be smaller than overflow by a reasonable factor. (See BIGNUM.)
- Parameters:
LTRANS – [in]
LTRANS is LOGICAL
=.TRUE.: A-transpose will be used.
=.FALSE.: A will be used (not transposed.)NA – [in]
NA is INTEGER
The size of the matrix A. It may (only) be 1 or 2.
NW – [in]
NW is INTEGER
1 if “w” is real, 2 if “w” is complex. It may only be 1 or 2.
SMIN – [in]
SMIN is REAL
The desired lower bound on the singular values of A. This should be a safe distance away from underflow or overflow, say, between (underflow/machine precision) and (machine precision * overflow). (See BIGNUM and ULP.)
CA – [in]
CA is REAL
The coefficient c, which A is multiplied by.
A – [in]
A is REAL array, dimension (LDA,NA)
The NA x NA matrix A.
LDA – [in]
LDA is INTEGER
The leading dimension of A. It must be at least NA.
D1 – [in]
D1 is REAL
The 1,1 element in the diagonal matrix D.
D2 – [in]
D2 is REAL
The 2,2 element in the diagonal matrix D. Not used if NA=1.
B – [in]
B is REAL array, dimension (LDB,NW)
The NA x NW matrix B (right-hand side). If NW=2 (“w” is complex), column 1 contains the real part of B and column 2 contains the imaginary part.
LDB – [in]
LDB is INTEGER
The leading dimension of B. It must be at least NA.
WR – [in]
WR is REAL
The real part of the scalar “w”.
WI – [in]
WI is REAL
The imaginary part of the scalar “w”. Not used if NW=1.
X – [out]
X is REAL array, dimension (LDX,NW)
The NA x NW matrix X (unknowns), as computed by SLALN2. If NW=2 (“w” is complex), on exit, column 1 will contain the real part of X and column 2 will contain the imaginary part.
LDX – [in]
LDX is INTEGER
The leading dimension of X. It must be at least NA.
SCALE – [out]
SCALE is REAL
The scale factor that B must be multiplied by to insure that overflow does not occur when computing X. Thus, (ca A - w D) X will be SCALE*B, not B (ignoring perturbations of A.) It will be at most 1.
XNORM – [out]
XNORM is REAL
The infinity-norm of X, when X is regarded as an NA x NW real matrix.
INFO – [out]
INFO is INTEGER
An error flag. It will be set to zero if no error occurs, a negative number if an argument is in error, or a positive number if ca A - w D had to be perturbed. The possible values are:
= 0: No error occurred, and (ca A - w D) did not have to be perturbed.
= 1: (ca A - w D) had to be perturbed to make its smallest (or only) singular value greater than SMIN.
NOTE: In the interests of speed, this routine does not check the inputs for errors.
-
template<typename T>
TRSYL#
- group trsyl
Functions
-
template<typename T>
void trsyl(char *transa, char *transb, integer *isgn, integer *m, integer *n, T *a, integer *lda, T *b, integer *ldb, T *c, integer *ldc, T *scale, integer *info)# Solving Sylvester matrix equation.
Purpose:
Solution for real Sylvester matrix equation: op(A)*X + X*op(B) = scale*C or op(A)*X - X*op(B) = scale*C, where op(A) = A or A**T, and a and b are both upper quasi- triangular. A is M-by-M and B is n-by-n; the right hand side C and the solution X are m-by-n; and scale is an output scale factor, set <= 1 to avoid overflow in X. a and b must be in Schur canonical form (as returned by SHSEQR), that is, block upper triangular with 1-by-1 and 2-by-2 diagonal blocks; each 2-by-2 diagonal block has its diagonal elements equal and its off-diagonal elements of opposite sign.
- Parameters:
transa – [in]
transa is char*
Specifies the option op(A):
= ‘N’: op(A) = A (No transpose)
= ‘T’: op(A) = A**T (Transpose)
= ‘C’: op(A) = A**H (Conjugate transpose = Transpose)transb – [in]
transb is char*
Specifies the option op(B):
= ‘N’: op(B) = B (No transpose)
= ‘T’: op(B) = B**T (Transpose)
= ‘C’: op(B) = B**H (Conjugate transpose = Transpose)isgn – [in]
isgn is integer*
Specifies the sign in the equation:
= +1: solve op(A)*X + X*op(B) = scale*C
= -1: solve op(A)*X - X*op(B) = scale*C
m – [in]
m is integer*
The order of the matrix a, and the number of rows in the matrices X and C. m >= 0.
n – [in]
n is integer*
The order of the matrix b, and the number of columns in the matrices X and C. n >= 0.
a – [in]
a is float/double array, dimension (lda,m)
The upper quasi-triangular matrix a, in Schur canonical form.
lda – [in]
lda is integer*
The leading dimension of the array a. lda >= fla_max(1,m).
b – [in]
b is float/double array, dimension (ldb,n)
The upper quasi-triangular matrix b, in Schur canonical form.
ldb – [in]
ldb is integer*
The leading dimension of the array b. ldb >= fla_max(1,n).
c – [inout]
c is float/double array, dimension (ldc,n)
On entry, the m-by-n right hand side matrix c.
On exit, c is overwritten by the solution matrix X.ldc – [in]
ldc is integer*
The leading dimension of the array c. ldc >= fla_max(1,m)
scale – [out]
scale is float/double*
The scale factor, scale, set <= 1 to avoid overflow in X
INFO – [out]
INFO is INTEGER
= 0: successful exit
< 0: if INFO = -i, the i-th argument had an illegal value
= 1: A and B have common or very close eigenvalues; perturbed values were used to solve the equation (but the matrices A and B are unchanged).
-
template<typename T>
TRSNA#
- group trsna
Functions
TRSNA estimates reciprocal condition numbers for specified eigenvalues.
Purpose:
TRSNA estimates reciprocal condition numbers for specified eigenvalues and/or right eigenvectors of a real upper quasi-triangular matrix T (or of any matrix Q*T*Q**T with Q orthogonal). T must be in Schur canonical form (as returned by SHSEQR), that is, block upper triangular with 1-by-1 and 2-by-2 diagonal blocks; each 2-by-2 diagonal block has its diagonal elements equal and its off-diagonal elements of opposite sign.
- Parameters:
JOB – [in]
JOB is CHARACTER*1
Specifies whether condition numbers are required for eigenvalues (S) or eigenvectors (SEP):
= ‘E’: for eigenvalues only (S);
= ‘V’: for eigenvectors only (SEP);
= ‘B’: for both eigenvalues and eigenvectors (S and SEP).HOWMNY – [in]
HOWMNY is CHARACTER*1
= ‘A’: compute condition numbers for all eigenpairs;
= ‘S’: compute condition numbers for selected eigenpairs specified by the array SELECT.SELECT – [in]
SELECT is LOGICAL array, dimension (N)
If HOWMNY = ‘S’, SELECT specifies the eigenpairs for which condition numbers are required. To select condition numbers for the eigenpair corresponding to a real eigenvalue w(j), SELECT(j) must be set to .TRUE.. To select condition numbers corresponding to a complex conjugate pair of eigenvalues w(j) and w(j+1), either SELECT(j) or SELECT(j+1) or both, must be set to .TRUE..
If HOWMNY = ‘A’, SELECT is not referenced.N – [in]
N is INTEGER
The order of the matrix T. N >= 0.
T – [in]
T is REAL array, dimension (LDT,N)
The upper quasi-triangular matrix T, in Schur canonical form.
LDT – [in]
LDT is INTEGER
The leading dimension of the array T. LDT >= fla_max(1,N).
VL – [in]
VL is REAL array, dimension (LDVL,M)
If JOB = ‘E’ or ‘B’, VL must contain left eigenvectors of T (or of any Q*T*Q**T with Q orthogonal), corresponding to the eigenpairs specified by HOWMNY and SELECT. The eigenvectors must be stored in consecutive columns of VL, as returned by SHSEIN or STREVC.
If JOB = ‘V’, VL is not referenced.LDVL – [in]
LDVL is INTEGER
The leading dimension of the array VL. LDVL >= 1; and if JOB = ‘E’ or ‘B’, LDVL >= N.
VR – [in]
VR is REAL array, dimension (LDVR,M)
If JOB = ‘E’ or ‘B’, VR must contain right eigenvectors of T (or of any Q*T*Q**T with Q orthogonal), corresponding to the eigenpairs specified by HOWMNY and SELECT. The eigenvectors must be stored in consecutive columns of VR, as returned by SHSEIN or STREVC.
If JOB = ‘V’, VR is not referenced.LDVR – [in]
LDVR is INTEGER
The leading dimension of the array VR.
LDVR >= 1; and if JOB = ‘E’ or ‘B’, LDVR >= N.S – [out]
S is REAL array, dimension (MM)
If JOB = ‘E’ or ‘B’, the reciprocal condition numbers of the selected eigenvalues, stored in consecutive elements of the array. For a complex conjugate pair of eigenvalues two consecutive elements of S are set to the same value. Thus S(j), SEP(j), and the j-th columns of VL and VR all correspond to the same eigenpair (but not in general the j-th eigenpair, unless all eigenpairs are selected).
If JOB = ‘V’, S is not referenced.SEP – [out]
SEP is REAL array, dimension (MM)
If JOB = ‘V’ or ‘B’, the estimated reciprocal condition numbers of the selected eigenvectors, stored in consecutive elements of the array. For a complex eigenvector two consecutive elements of SEP are set to the same value. If the eigenvalues cannot be reordered to compute SEP(j), SEP(j) is set to 0; this can only occur when the true value would be very small anyway.
If JOB = ‘E’, SEP is not referenced.MM – [in]
MM is INTEGER
The number of elements in the arrays S (if JOB = ‘E’ or ‘B’) and/or SEP (if JOB = ‘V’ or ‘B’). MM >= M.
M – [out]
M is INTEGER
The number of elements of the arrays S and/or SEP actually used to store the estimated condition numbers. If HOWMNY = ‘A’, M is set to N.
WORK – [out]
WORK is REAL array, dimension (LDWORK,N+6)
If JOB = ‘E’, WORK is not referenced.
LDWORK – [in]
LDWORK is INTEGER
The leading dimension of the array WORK. LDWORK >= 1; and if JOB = ‘V’ or ‘B’, LDWORK >= N.
IWORK – [out]
IWORK is INTEGER array, dimension (2*(N-1))
If JOB = ‘E’, IWORK is not referenced.
INFO – [out]
INFO is INTEGER
= 0: successful exit
< 0: if INFO = -i, the i-th argument had an illegal value
LAQTR#
- group laqtr
Functions
-
template<typename T>
void laqtr(logical *ltran, logical *lreal, integer *n, T *t, integer *ldt, T *b, T *w, T *scale, T *x, T *work, integer *info)# LAQTR solves a real quasi-triangular system of equations, or a complex
quasi-triangular system of special form, in real arithmetic.
Purpose:
LAQTR solves the real quasi-triangular system op(T)*p = scale*c, if LREAL = .TRUE. or the complex quasi-triangular systems op(T + iB)*(p+iq) = scale*(c+id), if LREAL = .FALSE. in real arithmetic, where T is upper quasi-triangular. If LREAL = .FALSE., then the first diagonal block of T must be 1 by 1, B is the specially structured matrix B = [ b(1) b(2) ... b(n) ] [ w ] [ w ] [ . ] [ w ] op(A) = A or A**T, A**T denotes the transpose of matrix A. On input, X = [ c ]. On output, X = [ p ]. [ d ] [ q ] This subroutine is designed for the condition number estimation in routine STRSNA.
- Parameters:
LTRAN – [in]
LTRAN is LOGICAL
On entry, LTRAN specifies the option of conjugate transpose:
= .FALSE., op(T+i*B) = T+i*B,
= .TRUE., op(T+i*B) = (T+i*B)**T.
LREAL – [in]
LREAL is LOGICAL
On entry, LREAL specifies the input matrix structure:
= .FALSE., the input is complex
= .TRUE., the input is real
N – [in]
N is INTEGER
On entry, N specifies the order of T+i*B. N >= 0.
T – [in]
T is REAL array, dimension (LDT,N)
On entry, T contains a matrix in Schur canonical form.
If LREAL = .FALSE., then the first diagonal block of T must be 1 by 1.LDT – [in]
LDT is INTEGER
The leading dimension of the matrix T. LDT >= fla_max(1,N).
B – [in]
B is REAL array, dimension (N)
On entry, B contains the elements to form the matrix B as described above.
If LREAL = .TRUE., B is not referenced.W – [in]
W is REAL
On entry, W is the diagonal element of the matrix B. If LREAL = .TRUE., W is not referenced.
SCALE – [out]
SCALE is REAL
On exit, SCALE is the scale factor.
X – [inout]
X is REAL array, dimension (2*N)
On entry, X contains the right hand side of the system. On exit, X is overwritten by the solution.
WORK – [out] WORK is REAL array, dimension (N)
INFO – [out]
INFO is INTEGER
On exit, INFO is set to
0: successful exit.
1: the some diagonal 1 by 1 block has been perturbed by a small number SMIN to keep nonsingularity.
2: the some diagonal 2 by 2 block has been perturbed by a small number in SLALN2 to keep nonsingularity.
NOTE: In the interests of speed, this routine does not check the inputs for errors.
-
template<typename T>
TREXC#
- group trexc
Functions
-
template<typename T>
void trexc(char *compq, integer *n, T *t, integer *ldt, T *q, integer *ldq, integer *ifst, integer *ilst, T *work, integer *info)# TREXC reorders the real Schur factorization of a real matrix A = Q*T*Q**T.
Purpose:
TREXC reorders the real Schur factorization of a real matrix A = Q*T*Q**T, so that the diagonal block of T with row index IFST is moved to row ILST. The real Schur form T is reordered by an orthogonal similarity transformation Z**T*T*Z, and optionally the matrix Q of Schur vectors is updated by postmultiplying it with Z. T must be in Schur canonical form (as returned by SHSEQR), that is, block upper triangular with 1-by-1 and 2-by-2 diagonal blocks; each 2-by-2 diagonal block has its diagonal elements equal and its off-diagonal elements of opposite sign.
- Parameters:
COMPQ – [in]
COMPQ is CHARACTER*1
= ‘V’: update the matrix Q of Schur vectors;
= ‘N’: do not update Q.N – [in]
N is INTEGER
The order of the matrix T. N >= 0. If N == 0 arguments ILST and IFST may be any value.
T – [inout]
T is REAL array, dimension (LDT,N)
On entry, the upper quasi-triangular matrix T, in Schur Schur canonical form.
On exit, the reordered upper quasi-triangular matrix, again in Schur canonical form.LDT – [in]
LDT is INTEGER
The leading dimension of the array T. LDT >= fla_max(1,N).
Q – [inout]
Q is REAL array, dimension (LDQ,N)
On entry, if COMPQ = ‘V’, the matrix Q of Schur vectors. On exit, if COMPQ = ‘V’, Q has been postmultiplied by the orthogonal transformation matrix Z which reorders T. If COMPQ = ‘N’, Q is not referenced.
LDQ – [in]
LDQ is INTEGER
The leading dimension of the array Q. LDQ >= 1, and if COMPQ = ‘V’, LDQ >= fla_max(1,N).
IFST – [inout] IFST is INTEGER
ILST – [inout]
ILST is INTEGER
Specify the reordering of the diagonal blocks of T. The block with row index IFST is moved to row ILST, by a sequence of transpositions between adjacent blocks. On exit, if IFST pointed on entry to the second row of a 2-by-2 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 <= N; 1 <= ILST <= N.
WORK – [out] WORK is REAL array, dimension (N)
INFO – [out]
INFO is INTEGER
= 0: successful exit
< 0: if INFO = -i, the i-th argument had an illegal value
= 1: two adjacent blocks were too close to swap (the problem is very ill-conditioned); T may have been partially reordered, and ILST points to the first row of the current position of the block being moved.
-
template<typename T>
TRSEN#
- group trsen
Functions
-
template<typename T>
void trsen(char *job, char *compq, logical *select, integer *n, T *t, integer *ldt, T *q, integer *ldq, T *wr, T *wi, integer *m, T *s, T *sep, T *work, integer *lwork, integer *iwork, integer *liwork, integer *info)# TRSEN reorders the real Schur factorization of a real matrix A = Q*T*Q**T.
Purpose:
TRSEN reorders the real Schur factorization of a real matrix A = Q*T*Q**T, so that a selected cluster of eigenvalues appears in the leading diagonal blocks of the upper quasi-triangular matrix T, and the leading columns of Q form an orthonormal basis of the corresponding right invariant subspace. Optionally the routine computes the reciprocal condition numbers of the cluster of eigenvalues and/or the invariant subspace. T must be in Schur canonical form (as returned by SHSEQR), that is, block upper triangular with 1-by-1 and 2-by-2 diagonal blocks; each 2-by-2 diagonal block has its diagonal elements equal and its off-diagonal elements of opposite sign.
- Parameters:
JOB – [in]
JOB is CHARACTER*1
Specifies whether condition numbers are required for the cluster of eigenvalues (S) or the invariant subspace (SEP):
= ‘N’: none;
= ‘E’: for eigenvalues only (S);
= ‘V’: for invariant subspace only (SEP);
= ‘B’: for both eigenvalues and invariant subspace (S and SEP).
COMPQ – [in]
COMPQ is CHARACTER*1
= ‘V’: update the matrix Q of Schur vectors;
= ‘N’: do not update Q.SELECT – [in]
SELECT is LOGICAL array, dimension (N)
SELECT specifies the eigenvalues in the selected cluster. To select a real eigenvalue w(j), SELECT(j) must be set to .TRUE.. To select a complex conjugate pair of eigenvalues w(j) and w(j+1), corresponding to a 2-by-2 diagonal block, either SELECT(j) or SELECT(j+1) or both must be set to .TRUE.; a complex conjugate pair of eigenvalues must be either both included in the cluster or both excluded.
N – [in]
N is INTEGER
The order of the matrix T. N >= 0.
T – [inout]
T is REAL array, dimension (LDT,N)
On entry, the upper quasi-triangular matrix T, in Schur canonical form.
On exit, T is overwritten by the reordered matrix T, again in Schur canonical form, with the selected eigenvalues in the leading diagonal blocks.LDT – [in]
LDT is INTEGER
The leading dimension of the array T. LDT >= fla_max(1,N).
Q – [inout]
Q is REAL array, dimension (LDQ,N)
On entry, if COMPQ = ‘V’, the matrix Q of Schur vectors.
On exit, if COMPQ = ‘V’, Q has been postmultiplied by the orthogonal transformation matrix which reorders T; the leading M columns of Q form an orthonormal basis for the specified invariant subspace.
If COMPQ = ‘N’, Q is not referenced.
LDQ – [in]
LDQ is INTEGER
The leading dimension of the array Q. LDQ >= 1; and if COMPQ = ‘V’, LDQ >= N.
WR – [out] WR is REAL array, dimension (N)
WI – [out]
WI is REAL array, dimension (N)
The real and imaginary parts, respectively, of the reordered eigenvalues of T. The eigenvalues are stored in the same order as on the diagonal of T, with WR(i) = T(i,i) and, if T(i:i+1,i:i+1) is a 2-by-2 diagonal block, WI(i) > 0 and WI(i+1) = -WI(i). Note that if a complex eigenvalue is sufficiently ill-conditioned, then its value may differ significantly from its value before reordering.
M – [out]
M is INTEGER
The dimension of the specified invariant subspace.
0 < = M <= N.S – [out]
S is REAL
If JOB = ‘E’ or ‘B’, S is a lower bound on the reciprocal condition number for the selected cluster of eigenvalues. S cannot underestimate the true reciprocal condition number by more than a factor of sqrt(N). If M = 0 or N, S = 1.
If JOB = ‘N’ or ‘V’, S is not referenced.SEP – [out]
SEP is REAL
If JOB = ‘V’ or ‘B’, SEP is the estimated reciprocal condition number of the specified invariant subspace. If M = 0 or N, SEP = norm(T).
If JOB = ‘N’ or ‘E’, SEP is not referenced.WORK – [out]
WORK is REAL array, dimension (MAX(1,LWORK))
On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
LWORK – [in]
LWORK is INTEGER
The dimension of the array WORK.
If JOB = ‘N’, LWORK >= fla_max(1,N);
if JOB = ‘E’, LWORK >= fla_max(1,M*(N-M));
if JOB = ‘V’ or ‘B’, LWORK >= fla_max(1,2*M*(N-M)).
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.
IWORK – [out]
IWORK is INTEGER array, dimension (MAX(1,LIWORK))
On exit, if INFO = 0, IWORK(1) returns the optimal LIWORK.
LIWORK – [in]
LIWORK is INTEGER
The dimension of the array IWORK.
If JOB = ‘N’ or ‘E’, LIWORK >= 1;
if JOB = ‘V’ or ‘B’, LIWORK >= fla_max(1,M*(N-M)).
If LIWORK = -1, then a workspace query is assumed; the routine only calculates the optimal size of the IWORK array, returns this value as the first entry of the IWORK array, and no error message related to LIWORK is issued by XERBLA.INFO – [out]
INFO is INTEGER
= 0: successful exit
< 0: if INFO = -i, the i-th argument had an illegal value
= 1: reordering of T failed because some eigenvalues are too close to separate (the problem is very ill-conditioned); T may have been partially reordered, and WR and WI contain the eigenvalues in the same order as in T; S and SEP (if requested) are set to zero.
-
template<typename T>
LAEXC#
- group laexc
Functions
-
template<typename T>
void laexc(logical *wantq, integer *n, T *t, integer *ldt, T *q, integer *ldq, integer *j1, integer *n1, integer *n2, T *work, integer *info)# LAEXC swaps adjacent diagonal blocks of a real upper quasi-triangular
matrix in Schur canonical form, by an orthogonal similarity transformation.
Purpose:
LAEXC swaps adjacent diagonal blocks T11 and T22 of order 1 or 2 in an upper quasi-triangular matrix T by an orthogonal similarity transformation. T must be in Schur canonical form, that is, block upper triangular with 1-by-1 and 2-by-2 diagonal blocks; each 2-by-2 diagonal block has its diagonal elemnts equal and its off-diagonal elements of opposite sign.
- Parameters:
WANTQ – [in]
WANTQ is LOGICAL
= .TRUE. : accumulate the transformation in the matrix Q;
= .FALSE.: do not accumulate the transformation.N – [in]
N is INTEGER
The order of the matrix T. N >= 0.
T – [inout]
T is REAL array, dimension (LDT,N)
On entry, the upper quasi-triangular matrix T, in Schur canonical form.
On exit, the updated matrix T, again in Schur canonical form.LDT – [in]
LDT is INTEGER
The leading dimension of the array T. LDT >= fla_max(1,N).
Q – [inout]
Q is REAL array, dimension (LDQ,N)
On entry, if WANTQ is .TRUE., the orthogonal matrix Q. On exit, if WANTQ is .TRUE., the updated matrix Q.
If WANTQ is .FALSE., Q is not referenced.LDQ – [in]
LDQ is INTEGER
The leading dimension of the array Q. LDQ >= 1; and if WANTQ is .TRUE., LDQ >= N.
J1 – [in]
J1 is INTEGER
The index of the first row of the first block T11.
N1 – [in]
N1 is INTEGER
The order of the first block T11. N1 = 0, 1 or 2.
N2 – [in]
N2 is INTEGER
The order of the second block T22. N2 = 0, 1 or 2.
WORK – [out] WORK is REAL array, dimension (N)
INFO – [out]
INFO is INTEGER
= 0: successful exit
= 1: the transformed matrix T would be too far from Schur form; the blocks are not swapped and T and Q are unchanged.
-
template<typename T>
LANV2#
- group lanv2
Functions
-
template<typename T>
void lanv2(T *a, T *b, T *c, T *d, T *rt1r, T *rt1i, T *rt2r, T *rt2i, T *cs, T *sn)# LANV2 computes the Schur factorization of a real 2-by-2 nonsymmetric matrix in standard form.
Purpose:
LANV2 computes the Schur factorization of a real 2-by-2 nonsymmetric matrix in standard form: [ A B ] = [ CS -SN ] [ AA BB ] [ CS SN ] [ C D ] [ SN CS ] [ CC DD ] [-SN CS ] where either 1) CC = 0 so that AA and DD are real eigenvalues of the matrix, or 2) AA = DD and BB*CC < 0, so that AA + or - sqrt(BB*CC) are complex conjugate eigenvalues.
- Parameters:
A – [inout] A is REAL
B – [inout] B is REAL
C – [inout] C is REAL
D – [inout]
D is REAL
On entry, the elements of the input matrix. On exit, they are overwritten by the elements of the standardised Schur form.
RT1R – [out] RT1R is REAL
RT1I – [out] RT1I is REAL
RT2R – [out] RT2R is REAL
RT2I – [out]
RT2I is REAL
The real and imaginary parts of the eigenvalues. If the eigenvalues are a complex conjugate pair, RT1I > 0.
CS – [out] CS is REAL
SN – [out]
SN is REAL
Parameters of the rotation matrix.
-
template<typename T>
LAEIN#
- group laein
Functions
-
template<typename T>
void laein(logical *rightv, logical *noinit, integer *n, T *h, integer *ldh, T *wr, T *wi, T *vr, T *vi, T *b, integer *ldb, T *work, T *eps3, T *smlnum, T *bignum, integer *info)# LAEIN computes a specified right or left eigenvector of an upper Hessenberg matrix by inverse iteration.
Purpose:
LAEIN uses inverse iteration to find a right or left eigenvector corresponding to the eigenvalue (WR,WI) of a real upper Hessenberg matrix H.
- Parameters:
RIGHTV – [in]
RIGHTV is LOGICAL
= .TRUE. : compute right eigenvector;
= .FALSE.: compute left eigenvector.NOINIT – [in]
NOINIT is LOGICAL
= .TRUE. : no initial vector supplied in (VR,VI).
= .FALSE.: initial vector supplied in (VR,VI).N – [in]
N is INTEGER
The order of the matrix H. N >= 0.
H – [in]
H is REAL array, dimension (LDH,N)
The upper Hessenberg matrix H.
LDH – [in]
LDH is INTEGER
The leading dimension of the array H. LDH >= fla_max(1,N).
WR – [in] WR is REAL
WI – [in]
WI is REAL
The real and imaginary parts of the eigenvalue of H whose corresponding right or left eigenvector is to be computed.
VR – [inout] VR is REAL array, dimension (N)
VI – [inout]
VI is REAL array, dimension (N)
On entry, if NOINIT = .FALSE. and WI = 0.0, VR must contain a real starting vector for inverse iteration using the real eigenvalue WR; if NOINIT = .FALSE. and WI.ne.0.0, VR and VI must contain the real and imaginary parts of a complex starting vector for inverse iteration using the complex eigenvalue (WR,WI); otherwise VR and VI need not be set. On exit, if WI = 0.0 (real eigenvalue), VR contains the computed real eigenvector; if WI.ne.0.0 (complex eigenvalue), VR and VI contain the real and imaginary parts of the computed complex eigenvector. The eigenvector is normalized so that the component of largest magnitude has magnitude 1; here the magnitude of a complex number (x,y) is taken to be |x| + |y|. VI is not referenced if WI = 0.0.
B – [out] B is REAL array, dimension (LDB,N)
LDB – [in]
LDB is INTEGER
The leading dimension of the array B. LDB >= N+1.
WORK – [out] WORK is REAL array, dimension (N)
EPS3 – [in]
EPS3 is REAL
A small machine-dependent value which is used to perturb close eigenvalues, and to replace zero pivots.
SMLNUM – [in]
SMLNUM is REAL
A machine-dependent value close to the underflow threshold.
BIGNUM – [in]
BIGNUM is REAL
A machine-dependent value close to the overflow threshold.
INFO – [out]
INFO is INTEGER
= 0: successful exit
= 1: inverse iteration did not converge; VR is set to the last iterate, and so is VI if WI.ne.0.0.
-
template<typename T>
LAHQR#
- group lahqr
Functions
-
template<typename T>
void lahqr(logical *wantt, logical *wantz, integer *n, integer *ilo, integer *ihi, T *h, integer *ldh, T *wr, T *wi, integer *iloz, integer *ihiz, T *z, integer *ldz, integer *info)# LAHQR computes the eigenvalues and Schur factorization of an upper
Hessenberg matrix, using the double-shift/single-shift QR algorithm.
Purpose:
LAHQR is an auxiliary routine called by SHSEQR to update the eigenvalues and Schur decomposition already computed by SHSEQR, by dealing with the Hessenberg submatrix in rows and columns ILO to IHI.
- Parameters:
WANTT – [in]
WANTT is LOGICAL
= .TRUE. : the full Schur form T is required;
= .FALSE.: only eigenvalues are required.WANTZ – [in]
WANTZ is LOGICAL
= .TRUE. : the matrix of Schur vectors Z is required;
= .FALSE.: Schur vectors are not required.N – [in]
N is INTEGER
The order of the matrix H. N >= 0.
ILO – [in] ILO is INTEGER
IHI – [in]
IHI is INTEGER
It is assumed that H is already upper quasi-triangular in rows and columns IHI+1:N, and that H(ILO,ILO-1) = 0 (unless ILO = 1). SLAHQR works primarily with the Hessenberg submatrix in rows and columns ILO to IHI, but applies transformations to all of H if WANTT is .TRUE..
1 <= ILO <= fla_max(1,IHI); IHI <= N.H – [inout]
H is REAL array, dimension (LDH,N)
On entry, the upper Hessenberg matrix H.
On exit, if INFO is zero and if WANTT is .TRUE., H is upper quasi-triangular in rows and columns ILO:IHI, with any 2-by-2 diagonal blocks in standard form. If INFO is zero and WANTT is .FALSE., the contents of H are unspecified on exit. The output state of H if INFO is nonzero is given below under the description of INFO.LDH – [in]
LDH is INTEGER
The leading dimension of the array H. LDH >= fla_max(1,N).
WR – [out] WR is REAL array, dimension (N)
WI – [out]
WI is REAL array, dimension (N)
The real and imaginary parts, respectively, of the computed eigenvalues ILO to IHI are stored in the corresponding elements of WR and WI. If two eigenvalues are computed as a complex conjugate pair, they are stored in consecutive elements of WR and WI, say the i-th and (i+1)th, with WI(i) > 0 and WI(i+1) < 0. If WANTT is .TRUE., the eigenvalues are stored in the same order as on the diagonal of the Schur form returned in H, with WR(i) = H(i,i), and, if H(i:i+1,i:i+1) is a 2-by-2 diagonal block,
WI(i) = sqrt(H(i+1,i)*H(i,i+1)) and WI(i+1) = -WI(i).ILOZ – [in] ILOZ is INTEGER
IHIZ – [in]
IHIZ is INTEGER
Specify the rows of Z to which transformations must be applied if WANTZ is .TRUE..
1 <= ILOZ <= ILO; IHI <= IHIZ <= N.Z – [inout]
Z is REAL array, dimension (LDZ,N)
If WANTZ is .TRUE., on entry Z must contain the current matrix Z of transformations accumulated by SHSEQR, and on exit Z has been updated; transformations are applied only to the submatrix Z(ILOZ:IHIZ,ILO:IHI).
If WANTZ is .FALSE., Z is not referenced.LDZ – [in]
LDZ is INTEGER
The leading dimension of the array Z. LDZ >= fla_max(1,N).
INFO – [out]
INFO is INTEGER
= 0: successful exit
> 0: If INFO = i, SLAHQR failed to compute all the eigenvalues ILO to IHI in a total of 30 iterations per eigenvalue; elements i+1:ihi of WR and WI contain those eigenvalues which have been successfully computed.
If INFO > 0 and WANTT is .FALSE., then on exit, the remaining unconverged eigenvalues are the eigenvalues of the upper Hessenberg matrix rows and columns ILO through INFO of the final, output value of H.
If INFO > 0 and WANTT is .TRUE., then on exit (*) (initial value of H)*U = U*(final value of H) where U is an orthogonal matrix. The final value of H is upper Hessenberg and triangular in rows and columns INFO+1 through IHI.
If INFO > 0 and WANTZ is .TRUE., then on exit (final value of Z) = (initial value of Z)*U where U is the orthogonal matrix in (*) (regardless of the value of WANTT.)
-
template<typename T>
LAQR0#
- group laqr0
Functions
-
template<typename T>
void laqr0(logical *wantt, logical *wantz, integer *n, integer *ilo, integer *ihi, T *h, integer *ldh, T *wr, T *wi, integer *iloz, integer *ihiz, T *z, integer *ldz, T *work, integer *lwork, integer *info)# LAQR0 computes the eigenvalues of a Hessenberg matrix, and optionally the matrices from the Schur decomposition.
Purpose:
LAQR0 computes the eigenvalues of a Hessenberg matrix H and, optionally, the matrices T and Z from the Schur decomposition H = Z T Z**T, where T is an upper quasi-triangular matrix (the Schur form), and Z is the orthogonal matrix of Schur vectors. Optionally Z may be postmultiplied into an input orthogonal matrix Q so that this routine can give the Schur factorization of a matrix A which has been reduced to the Hessenberg form H by the orthogonal matrix Q: A = Q*H*Q**T = (QZ)*T*(QZ)**T.
- Parameters:
WANTT – [in]
WANTT is LOGICAL
= .TRUE. : the full Schur form T is required;
= .FALSE.: only eigenvalues are required.WANTZ – [in]
WANTZ is LOGICAL
= .TRUE. : the matrix of Schur vectors Z is required;
= .FALSE.: Schur vectors are not required.N – [in]
N is INTEGER
The order of the matrix H. N >= 0.
ILO – [in] ILO is INTEGER
IHI – [in]
IHI is INTEGER
It is assumed that H is already upper triangular in rows and columns 1:ILO-1 and IHI+1:N and, if ILO > 1, H(ILO,ILO-1) is zero. ILO and IHI are normally set by a previous call to SGEBAL, and then passed to SGEHRD when the matrix output by SGEBAL is reduced to Hessenberg form. Otherwise, ILO and IHI should be set to 1 and N, respectively. If N > 0, then 1 <= ILO <= IHI <= N. If N = 0, then ILO = 1 and IHI = 0.
H – [inout]
H is REAL array, dimension (LDH,N)
On entry, the upper Hessenberg matrix H.
On exit, if INFO = 0 and WANTT is .TRUE., then H contains the upper quasi-triangular matrix T from the Schur decomposition (the Schur form); 2-by-2 diagonal blocks (corresponding to complex conjugate pairs of eigenvalues) are returned in standard form, with H(i,i) = H(i+1,i+1) and H(i+1,i)*H(i,i+1) < 0. If INFO = 0 and WANTT is .FALSE., then the contents of H are unspecified on exit. (The output value of H when INFO > 0 is given under the description of INFO below.)
This subroutine may explicitly set H(i,j) = 0 for i > j and j = 1, 2, … ILO-1 or j = IHI+1, IHI+2, … N.
LDH – [in]
LDH is INTEGER
The leading dimension of the array H. LDH >= fla_max(1,N).
WR – [out] WR is REAL array, dimension (IHI)
WI – [out]
WI is REAL array, dimension (IHI)
The real and imaginary parts, respectively, of the computed eigenvalues of H(ILO:IHI,ILO:IHI) are stored in WR(ILO:IHI) and WI(ILO:IHI). If two eigenvalues are computed as a complex conjugate pair, they are stored in consecutive elements of WR and WI, say the i-th and (i+1)th, with WI(i) > 0 and WI(i+1) < 0. If WANTT is .TRUE., then the eigenvalues are stored in the same order as on the diagonal of the Schur form returned in H, with WR(i) = H(i,i) and, if H(i:i+1,i:i+1) is a 2-by-2 diagonal block, WI(i) = sqrt(-H(i+1,i)*H(i,i+1)) and WI(i+1) = -WI(i).
ILOZ – [in] ILOZ is INTEGER
IHIZ – [in]
IHIZ is INTEGER
Specify the rows of Z to which transformations must be applied if WANTZ is .TRUE..
1 <= ILOZ <= ILO; IHI <= IHIZ <= N.Z – [inout]
Z is REAL array, dimension (LDZ,IHI)
If WANTZ is .FALSE., then Z is not referenced.
If WANTZ is .TRUE., then Z(ILO:IHI,ILOZ:IHIZ) is replaced by Z(ILO:IHI,ILOZ:IHIZ)*U where U is the orthogonal Schur factor of H(ILO:IHI,ILO:IHI). (The output value of Z when INFO > 0 is given under the description of INFO below.)LDZ – [in]
LDZ is INTEGER
The leading dimension of the array Z. if WANTZ is .TRUE. then LDZ >= MAX(1,IHIZ). Otherwise, LDZ >= 1.
WORK – [out]
WORK is REAL array, dimension LWORK
On exit, if LWORK = -1, WORK(1) returns an estimate of the optimal value for LWORK.
LWORK – [in]
LWORK is INTEGER
The dimension of the array WORK. LWORK >= fla_max(1,N) is sufficient, but LWORK typically as large as 6*N may be required for optimal performance. A workspace query to determine the optimal workspace size is recommended.
If LWORK = -1, then SLAQR0 does a workspace query. In this case, SLAQR0 checks the input parameters and estimates the optimal workspace size for the given values of N, ILO and IHI. The estimate is returned in WORK(1). No error message related to LWORK is issued by XERBLA. Neither H nor Z are accessed.INFO – [out]
INFO is INTEGER = 0: successful exit
> 0: if INFO = i, SLAQR0 failed to compute all of the eigenvalues. Elements 1:ilo-1 and i+1:n of WR and WI contain those eigenvalues which have been successfully computed. (Failures are rare.)
If INFO > 0 and WANT is .FALSE., then on exit, the remaining unconverged eigenvalues are the eigen- values of the upper Hessenberg matrix rows and columns ILO through INFO of the final, output value of H.
If INFO > 0 and WANTT is .TRUE., then on exit
(*) (initial value of H)*U = U*(final value of H)
where U is an orthogonal matrix. The final value of H is upper Hessenberg and quasi-triangular in rows and columns INFO+1 through IHI.
If INFO > 0 and WANTZ is .TRUE., then on exit
(final value of Z(ILO:IHI,ILOZ:IHIZ) = (initial value of Z(ILO:IHI,ILOZ:IHIZ)*U
where U is the orthogonal matrix in (*) (regard- less of the value of WANTT.)
If INFO > 0 and WANTZ is .FALSE., then Z is not accessed.
-
template<typename T>
LAQR1#
- group laqr1
Functions
-
template<typename T>
void laqr1(integer *n, T *h, integer *ldh, T *sr1, T *si1, T *sr2, T *si2, T *v)# LAQR1 sets a scalar multiple of the first column of the product of 2-by-2 or 3-by-3 matrix H and specified shifts.
Purpose:
Given a 2-by-2 or 3-by-3 matrix H, SLAQR1 sets v to a scalar multiple of the first column of the product (*) K = (H - (sr1 + i*si1)*I)*(H - (sr2 + i*si2)*I) scaling to avoid overflows and most underflows. It is assumed that either 1) sr1 = sr2 and si1 = -si2 or 2) si1 = si2 = 0. This is useful for starting double implicit shift bulges in the QR algorithm.
- Parameters:
N – [in]
N is INTEGER
Order of the matrix H. N must be either 2 or 3.
H – [in]
H is REAL array, dimension (LDH,N)
The 2-by-2 or 3-by-3 matrix H in (*).
LDH – [in]
LDH is INTEGER
The leading dimension of H as declared in the calling procedure. LDH >= N
SR1 – [in] SR1 is REAL
SI1 – [in] SI1 is REAL
SR2 – [in] SR2 is REAL
SI2 – [in]
SI2 is REAL
The shifts in (*).
V – [out]
V is REAL array, dimension (N)
A scalar multiple of the first column of the matrix K in (*).
-
template<typename T>
LAQR2#
- group laqr2
Functions
-
template<typename T>
void laqr2(logical *wantt, logical *wantz, integer *n, integer *ktop, integer *kbot, integer *nw, T *h, integer *ldh, integer *iloz, integer *ihiz, T *z, integer *ldz, integer *ns, integer *nd, T *sr, T *si, T *v, integer *ldv, integer *nh, T *t, integer *ldt, integer *nv, T *wv, integer *ldwv, T *work, integer *lwork)# LAQR2 performs the orthogonal similarity transformation of a Hessenberg
matrix to detect and deflate fully converged eigenvalues from a trailing
principal submatrix (aggressive early deflation)Purpose:
LAQR2 is identical to SLAQR3 except that it avoids recursion by calling SLAHQR instead of SLAQR4. Aggressive early deflation: This subroutine accepts as input an upper Hessenberg matrix H and performs an orthogonal similarity transformation designed to detect and deflate fully converged eigenvalues from a trailing principal submatrix. On output H has been over- written by a new Hessenberg matrix that is a perturbation of an orthogonal similarity transformation of H. It is to be hoped that the final version of H has many zero subdiagonal entries.
- Parameters:
WANTT – [in]
WANTT is LOGICAL
If .TRUE., then the Hessenberg matrix H is fully updated so that the quasi-triangular Schur factor may be computed (in cooperation with the calling subroutine). If .FALSE., then only enough of H is updated to preserve the eigenvalues.
WANTZ – [in]
WANTZ is LOGICAL
If .TRUE., then the orthogonal matrix Z is updated so so that the orthogonal Schur factor may be computed (in cooperation with the calling subroutine). If .FALSE., then Z is not referenced.
N – [in]
N is INTEGER
The order of the matrix H and (if WANTZ is .TRUE.) the order of the orthogonal matrix Z.
KTOP – [in]
KTOP is INTEGER
It is assumed that either KTOP = 1 or H(KTOP,KTOP-1)=0. KBOT and KTOP together determine an isolated block along the diagonal of the Hessenberg matrix.
KBOT – [in]
KBOT is INTEGER
It is assumed without a check that either KBOT = N or H(KBOT+1,KBOT)=0. KBOT and KTOP together determine an isolated block along the diagonal of the Hessenberg matrix.
NW – [in]
NW is INTEGER
Deflation window size. 1 <= NW <= (KBOT-KTOP+1).
H – [inout]
H is REAL array, dimension (LDH,N)
On input the initial N-by-N section of H stores the Hessenberg matrix undergoing aggressive early deflation.
On output H has been transformed by an orthogonal similarity transformation, perturbed, and the returned to Hessenberg form that (it is to be hoped) has some zero subdiagonal entries.LDH – [in]
LDH is INTEGER
Leading dimension of H just as declared in the calling subroutine. N <= LDH
ILOZ – [in] ILOZ is INTEGER
IHIZ – [in]
IHIZ is INTEGER
Specify the rows of Z to which transformations must be applied if WANTZ is .TRUE.. 1 <= ILOZ <= IHIZ <= N.
Z – [inout]
Z is REAL array, dimension (LDZ,N)
IF WANTZ is .TRUE., then on output, the orthogonal similarity transformation mentioned above has been accumulated into Z(ILOZ:IHIZ,ILOZ:IHIZ) from the right. If WANTZ is .FALSE., then Z is unreferenced.
LDZ – [in]
LDZ is INTEGER
The leading dimension of Z just as declared in the calling subroutine. 1 <= LDZ.
NS – [out]
NS is INTEGER
The number of unconverged (ie approximate) eigenvalues returned in SR and SI that may be used as shifts by the calling subroutine.
ND – [out]
ND is INTEGER
The number of converged eigenvalues uncovered by this subroutine.
SR – [out] SR is REAL array, dimension (KBOT)
SI – [out]
SI is REAL array, dimension (KBOT)
On output, the real and imaginary parts of approximate eigenvalues that may be used for shifts are stored in SR(KBOT-ND-NS+1) through SR(KBOT-ND) and SI(KBOT-ND-NS+1) through SI(KBOT-ND), respectively. The real and imaginary parts of converged eigenvalues are stored in SR(KBOT-ND+1) through SR(KBOT) and SI(KBOT-ND+1) through SI(KBOT), respectively.
V – [out]
V is REAL array, dimension (LDV,NW)
An NW-by-NW work array.
LDV – [in]
LDV is INTEGER
The leading dimension of V just as declared in the calling subroutine. NW <= LDV
NH – [in]
NH is INTEGER
The number of columns of T. NH >= NW.
T – [out] T is REAL array, dimension (LDT,NW)
LDT – [in]
LDT is INTEGER
The leading dimension of T just as declared in the calling subroutine. NW <= LDT
NV – [in]
NV is INTEGER
The number of rows of work array WV available for workspace. NV >= NW.
WV – [out] WV is REAL array, dimension (LDWV,NW)
LDWV – [in]
LDWV is INTEGER
The leading dimension of W just as declared in the calling subroutine. NW <= LDV
WORK – [out]
WORK is REAL array, dimension (LWORK)
On exit, WORK(1) is set to an estimate of the optimal value of LWORK for the given values of N, NW, KTOP and KBOT.
LWORK – [in]
LWORK is INTEGER
The dimension of the work array WORK. LWORK = 2*NW suffices, but greater efficiency may result from larger values of LWORK.
If LWORK = -1, then a workspace query is assumed; SLAQR2 only estimates the optimal workspace size for the given values of N, NW, KTOP and KBOT. The estimate is returned in WORK(1). No error message related to LWORK is issued by XERBLA. Neither H nor Z are accessed.
-
template<typename T>
void laqr2(logical *wantt, logical *wantz, integer *n, integer *ktop, integer *kbot, integer *nw, T *h, integer *ldh, integer *iloz, integer *ihiz, T *z, integer *ldz, integer *ns, integer *nd, T *sh, T *v, integer *ldv, integer *nh, T *t, integer *ldt, integer *nv, T *wv, integer *ldwv, T *work, integer *lwork)#
-
template<typename T>
LAQR3#
- group laqr3
Functions
-
template<typename T>
void laqr3(logical *wantt, logical *wantz, integer *n, integer *ktop, integer *kbot, integer *nw, T *h, integer *ldh, integer *iloz, integer *ihiz, T *z, integer *ldz, integer *ns, integer *nd, T *sr, T *si, T *v, integer *ldv, integer *nh, T *t, integer *ldt, integer *nv, T *wv, integer *ldwv, T *work, integer *lwork)# LAQR3 performs the orthogonal similarity transformation of a Hessenberg
matrix to detect and deflate fully converged eigenvalues from a trailing
principal submatrix (aggressive early deflation).Purpose:
LAQR3 accepts as input an upper Hessenberg matrix H and performs an orthogonal similarity transformation designed to detect and deflate fully converged eigenvalues from a trailing principal submatrix. On output H has been over- written by a new Hessenberg matrix that is a perturbation of an orthogonal similarity transformation of H. It is to be hoped that the final version of H has many zero subdiagonal entries.
- Parameters:
WANTT – [in]
WANTT is LOGICAL
If .TRUE., then the Hessenberg matrix H is fully updated so that the quasi-triangular Schur factor may be computed (in cooperation with the calling subroutine).
If .FALSE., then only enough of H is updated to preserve the eigenvalues.WANTZ – [in]
WANTZ is LOGICAL
If .TRUE., then the orthogonal matrix Z is updated so so that the orthogonal Schur factor may be computed (in cooperation with the calling subroutine).
If .FALSE., then Z is not referenced.N – [in]
N is INTEGER
The order of the matrix H and (if WANTZ is .TRUE.) the order of the orthogonal matrix Z.
KTOP – [in]
KTOP is INTEGER
It is assumed that either KTOP = 1 or H(KTOP,KTOP-1)=0. KBOT and KTOP together determine an isolated block along the diagonal of the Hessenberg matrix.
KBOT – [in]
KBOT is INTEGER
It is assumed without a check that either KBOT = N or H(KBOT+1,KBOT)=0. KBOT and KTOP together determine an isolated block along the diagonal of the Hessenberg matrix.
NW – [in]
NW is INTEGER
Deflation window size. 1 <= NW <= (KBOT-KTOP+1).
H – [inout]
H is REAL array, dimension (LDH,N)
On input the initial N-by-N section of H stores the Hessenberg matrix undergoing aggressive early deflation. On output H has been transformed by an orthogonal similarity transformation, perturbed, and the returned to Hessenberg form that (it is to be hoped) has some zero subdiagonal entries.
LDH – [in]
LDH is INTEGER
Leading dimension of H just as declared in the calling subroutine. N <= LDH
ILOZ – [in] ILOZ is INTEGER
IHIZ – [in]
IHIZ is INTEGER
Specify the rows of Z to which transformations must be applied if WANTZ is .TRUE.. 1 <= ILOZ <= IHIZ <= N.
Z – [inout]
Z is REAL array, dimension (LDZ,N)
IF WANTZ is .TRUE., then on output, the orthogonal similarity transformation mentioned above has been accumulated into Z(ILOZ:IHIZ,ILOZ:IHIZ) from the right.
If WANTZ is .FALSE., then Z is unreferenced.LDZ – [in]
LDZ is INTEGER
The leading dimension of Z just as declared in the calling subroutine. 1 <= LDZ.
NS – [out]
NS is INTEGER
The number of unconverged (ie approximate) eigenvalues returned in SR and SI that may be used as shifts by the calling subroutine.
ND – [out]
ND is INTEGER
The number of converged eigenvalues uncovered by this subroutine.
SR – [out] SR is REAL array, dimension (KBOT)
SI – [out]
SI is REAL array, dimension (KBOT)
On output, the real and imaginary parts of approximate eigenvalues that may be used for shifts are stored in SR(KBOT-ND-NS+1) through SR(KBOT-ND) and SI(KBOT-ND-NS+1) through SI(KBOT-ND), respectively. The real and imaginary parts of converged eigenvalues are stored in SR(KBOT-ND+1) through SR(KBOT) and SI(KBOT-ND+1) through SI(KBOT), respectively.
V – [out]
V is REAL array, dimension (LDV,NW)
An NW-by-NW work array.
LDV – [in]
LDV is INTEGER
The leading dimension of V just as declared in the calling subroutine. NW <= LDV
NH – [in]
NH is INTEGER
The number of columns of T. NH >= NW.
T – [out] T is REAL array, dimension (LDT,NW)
LDT – [in]
LDT is INTEGER
The leading dimension of T just as declared in the calling subroutine. NW <= LDT
NV – [in]
NV is INTEGER
The number of rows of work array WV available for workspace. NV >= NW.
WV – [out] WV is REAL array, dimension (LDWV,NW)
LDWV – [in]
LDWV is INTEGER
The leading dimension of W just as declared in the calling subroutine. NW <= LDV
WORK – [out]
WORK is REAL array, dimension (LWORK)
On exit, WORK(1) is set to an estimate of the optimal value of LWORK for the given values of N, NW, KTOP and KBOT.
LWORK – [in]
LWORK is INTEGER
The dimension of the work array WORK. LWORK = 2*NW suffices, but greater efficiency may result from larger values of LWORK.
If LWORK = -1, then a workspace query is assumed; SLAQR3 only estimates the optimal workspace size for the given values of N, NW, KTOP and KBOT. The estimate is returned in WORK(1). No error message related to LWORK is issued by XERBLA. Neither H nor Z are accessed.
-
template<typename T>
void laqr3(logical *wantt, logical *wantz, integer *n, integer *ktop, integer *kbot, integer *nw, T *h, integer *ldh, integer *iloz, integer *ihiz, T *z, integer *ldz, integer *ns, integer *nd, T *sh, T *v, integer *ldv, integer *nh, T *t, integer *ldt, integer *nv, T *wv, integer *ldwv, T *work, integer *lwork)#
-
template<typename T>
LAQR4#
- group laqr4
Functions
-
template<typename T>
void laqr4(logical *wantt, logical *wantz, integer *n, integer *ilo, integer *ihi, T *h, integer *ldh, T *wr, T *wi, integer *iloz, integer *ihiz, T *z, integer *ldz, T *work, integer *lwork, integer *info)# LAQR4 computes the eigenvalues of a Hessenberg matrix, and optionally the matrices from the Schur decomposition.
Purpose:
LAQR4 implements one level of recursion for SLAQR0. It is a complete implementation of the small bulge multi-shift QR algorithm. It may be called by SLAQR0 and, for large enough deflation window size, it may be called by SLAQR3. This subroutine is identical to SLAQR0 except that it calls SLAQR2 instead of SLAQR3. SLAQR4 computes the eigenvalues of a Hessenberg matrix H and, optionally, the matrices T and Z from the Schur decomposition H = Z T Z**T, where T is an upper quasi-triangular matrix (the Schur form), and Z is the orthogonal matrix of Schur vectors. Optionally Z may be postmultiplied into an input orthogonal matrix Q so that this routine can give the Schur factorization of a matrix A which has been reduced to the Hessenberg form H by the orthogonal matrix Q: A = Q*H*Q**T = (QZ)*T*(QZ)**T.
- Parameters:
WANTT – [in]
WANTT is LOGICAL
= .TRUE. : the full Schur form T is required;
= .FALSE.: only eigenvalues are required.WANTZ – [in]
WANTZ is LOGICAL
= .TRUE. : the matrix of Schur vectors Z is required;
= .FALSE.: Schur vectors are not required.N – [in]
N is INTEGER
The order of the matrix H. N >= 0.
ILO – [in] ILO is INTEGER
IHI – [in]
IHI is INTEGER
It is assumed that H is already upper triangular in rows and columns 1:ILO-1 and IHI+1:N and, if ILO > 1, H(ILO,ILO-1) is zero. ILO and IHI are normally set by a previous call to SGEBAL, and then passed to SGEHRD when the matrix output by SGEBAL is reduced to Hessenberg form. Otherwise, ILO and IHI should be set to 1 and N, respectively. If N > 0, then 1 <= ILO <= IHI <= N.
If N = 0, then ILO = 1 and IHI = 0.H – [inout]
H is REAL array, dimension (LDH,N)
On entry, the upper Hessenberg matrix H.
On exit, if INFO = 0 and WANTT is .TRUE., then H contains the upper quasi-triangular matrix T from the Schur decomposition (the Schur form); 2-by-2 diagonal blocks (corresponding to complex conjugate pairs of eigenvalues) are returned in standard form, with H(i,i) = H(i+1,i+1) and H(i+1,i)*H(i,i+1) < 0. If INFO = 0 and WANTT is .FALSE., then the contents of H are unspecified on exit. (The output value of H when INFO > 0 is given under the description of INFO below.)
This subroutine may explicitly set H(i,j) = 0 for i > j and j = 1, 2, … ILO-1 or j = IHI+1, IHI+2, … N.
LDH – [in]
LDH is INTEGER
The leading dimension of the array H. LDH >= fla_max(1,N).
WR – [out] WR is REAL array, dimension (IHI)
WI – [out]
WI is REAL array, dimension (IHI)
The real and imaginary parts, respectively, of the computed eigenvalues of H(ILO:IHI,ILO:IHI) are stored in WR(ILO:IHI) and WI(ILO:IHI). If two eigenvalues are computed as a complex conjugate pair, they are stored in consecutive elements of WR and WI, say the i-th and (i+1)th, with WI(i) > 0 and WI(i+1) < 0. If WANTT is .TRUE., then the eigenvalues are stored in the same order as on the diagonal of the Schur form returned in H, with WR(i) = H(i,i) and, if H(i:i+1,i:i+1) is a 2-by-2 diagonal block, WI(i) = sqrt(-H(i+1,i)*H(i,i+1)) and WI(i+1) = -WI(i).
ILOZ – [in] ILOZ is INTEGER
IHIZ – [in]
IHIZ is INTEGER
Specify the rows of Z to which transformations must be applied if WANTZ is .TRUE..
1 <= ILOZ <= ILO; IHI <= IHIZ <= N.Z – [inout]
Z is REAL array, dimension (LDZ,IHI)
If WANTZ is .FALSE., then Z is not referenced.
If WANTZ is .TRUE., then Z(ILO:IHI,ILOZ:IHIZ) is replaced by Z(ILO:IHI,ILOZ:IHIZ)*U where U is the orthogonal Schur factor of H(ILO:IHI,ILO:IHI). (The output value of Z when INFO > 0 is given under the description of INFO below.)LDZ – [in]
LDZ is INTEGER
The leading dimension of the array Z. if WANTZ is .TRUE. then LDZ >= MAX(1,IHIZ). Otherwise, LDZ >= 1.
WORK – [out]
WORK is REAL array, dimension LWORK
On exit, if LWORK = -1, WORK(1) returns an estimate of the optimal value for LWORK.
LWORK – [in]
LWORK is INTEGER
The dimension of the array WORK. LWORK >= fla_max(1,N) is sufficient, but LWORK typically as large as 6*N may be required for optimal performance. A workspace query to determine the optimal workspace size is recommended.
If LWORK = -1, then SLAQR4 does a workspace query. In this case, SLAQR4 checks the input parameters and estimates the optimal workspace size for the given values of N, ILO and IHI. The estimate is returned in WORK(1). No error message related to LWORK is issued by XERBLA. Neither H nor Z are accessed.INFO – [out]
INFO is INTEGER
= 0: successful exit
> 0: if INFO = i, SLAQR4 failed to compute all of the eigenvalues. Elements 1:ilo-1 and i+1:n of WR and WI contain those eigenvalues which have been successfully computed. (Failures are rare.)
If INFO > 0 and WANT is .FALSE., then on exit, the remaining unconverged eigenvalues are the eigen- values of the upper Hessenberg matrix rows and columns ILO through INFO of the final, output value of H.
If INFO > 0 and WANTT is .TRUE., then on exit
(*) (initial value of H)*U = U*(final value of H)
where U is a orthogonal matrix. The final value of H is upper Hessenberg and triangular in rows and columns INFO+1 through IHI.
If INFO > 0 and WANTZ is .TRUE., then on exit
(final value of Z(ILO:IHI,ILOZ:IHIZ) = (initial value of Z(ILO:IHI,ILOZ:IHIZ)*U
where U is the orthogonal matrix in (*) (regard- less of the value of WANTT.)
If INFO > 0 and WANTZ is .FALSE., then Z is not accessed.
-
template<typename T>
LAQR5#
- group laqr5
Functions
-
template<typename T>
void laqr5(logical *wantt, logical *wantz, integer *kacc22, integer *n, integer *ktop, integer *kbot, integer *nshfts, T *sr, T *si, T *h, integer *ldh, integer *iloz, integer *ihiz, T *z, integer *ldz, T *v, integer *ldv, T *u, integer *ldu, integer *nv, T *wv, integer *ldwv, integer *nh, T *wh, integer *ldwh)# LAQR5 performs a single small-bulge multi-shift QR sweep.
Purpose:
LAQR5, called by SLAQR0, performs a single small-bulge multi-shift QR sweep.
- Parameters:
WANTT – [in]
WANTT is LOGICAL
WANTT = .true. if the quasi-triangular Schur factor is being computed. WANTT is set to .false. otherwise.
WANTZ – [in]
WANTZ is LOGICAL
WANTZ = .true. if the orthogonal Schur factor is being computed. WANTZ is set to .false. otherwise.
KACC22 – [in]
KACC22 is INTEGER with value 0, 1, or 2.
Specifies the computation mode of far-from-diagonal orthogonal updates.
= 0: SLAQR5 does not accumulate reflections and does not use matrix-matrix multiply to update far-from-diagonal matrix entries.
= 1: SLAQR5 accumulates reflections and uses matrix-matrix multiply to update the far-from-diagonal matrix entries.
= 2: SLAQR5 accumulates reflections, uses matrix-matrix multiply to update the far-from-diagonal matrix entries, and takes advantage of 2-by-2 block structure during matrix multiplies.N – [in]
N is INTEGER
N is the order of the Hessenberg matrix H upon which this subroutine operates.
KTOP – [in] KTOP is INTEGER
KBOT – [in]
KBOT is INTEGER
These are the first and last rows and columns of an isolated diagonal block upon which the QR sweep is to be applied. It is assumed without a check that
either KTOP = 1 or H(KTOP,KTOP-1) = 0
and
either KBOT = N or H(KBOT+1,KBOT) = 0.NSHFTS – [in]
NSHFTS is INTEGER
NSHFTS gives the number of simultaneous shifts. NSHFTS must be positive and even.
SR – [inout] SR is REAL array, dimension (NSHFTS)
SI – [inout]
SI is REAL array, dimension (NSHFTS)
SR contains the real parts and SI contains the imaginary parts of the NSHFTS shifts of origin that define the multi-shift QR sweep. On output SR and SI may be reordered.
H – [inout]
H is REAL array, dimension (LDH,N)
On input H contains a Hessenberg matrix. On output a multi-shift QR sweep with shifts SR(J)+i*SI(J) is applied to the isolated diagonal block in rows and columns KTOP through KBOT.
LDH – [in]
LDH is INTEGER
LDH is the leading dimension of H just as declared in the calling procedure. LDH >= MAX(1,N).
ILOZ – [in] ILOZ is INTEGER
IHIZ – [in]
IHIZ is INTEGER
Specify the rows of Z to which transformations must be applied if WANTZ is .TRUE.. 1 <= ILOZ <= IHIZ <= N
Z – [inout]
Z is REAL array, dimension (LDZ,IHIZ)
If WANTZ = .TRUE., then the QR Sweep orthogonal similarity transformation is accumulated into Z(ILOZ:IHIZ,ILOZ:IHIZ) from the right.
If WANTZ = .FALSE., then Z is unreferenced.LDZ – [in]
LDZ is INTEGER
LDZ is the leading dimension of Z just as declared in the calling procedure. LDZ >= N.
V – [out] V is REAL array, dimension (LDV,NSHFTS/2)
LDV – [in]
LDV is INTEGER
LDV is the leading dimension of V as declared in the calling procedure. LDV >= 3.
U – [out] U is REAL array, dimension (LDU,3*NSHFTS-3)
LDU – [in]
LDU is INTEGER
LDU is the leading dimension of U just as declared in the in the calling subroutine. LDU >= 3*NSHFTS-3.
NV – [in]
NV is INTEGER
NV is the number of rows in WV agailable for workspace. NV >= 1.
WV – [out] WV is REAL array, dimension (LDWV,3*NSHFTS-3)
LDWV – [in] LDWV is INTEGER LDWV is the leading dimension of WV as declared in the in the calling subroutine. LDWV >= NV.
NH – [in] NH is INTEGER NH is the number of columns in array WH available for workspace. NH >= 1.
WH – [out] WH is REAL array, dimension (LDWH,NH)
LDWH – [in]
LDWH is INTEGER
Leading dimension of WH just as declared in the calling procedure. LDWH >= 3*NSHFTS-3.
-
template<typename T>
void laqr5(logical *wantt, logical *wantz, integer *kacc22, integer *n, integer *ktop, integer *kbot, integer *nshfts, T *s, T *h, integer *ldh, integer *iloz, integer *ihiz, T *z, integer *ldz, T *v, integer *ldv, T *u, integer *ldu, integer *nv, T *wv, integer *ldwv, integer *nh, T *wh, integer *ldwh)#
-
template<typename T>
LAQZ0#
- group laqz0
Functions
-
template<typename T>
void laqz0(char *wants, char *wantq, char *wantz, integer *n, integer *ilo, integer *ihi, T *a, integer *lda, T *b, integer *ldb, T *alphar, T *alphai, T *beta, T *q, integer *ldq, T *z, integer *ldz, T *work, integer *lwork, integer *rec, integer *info)# Computes the eigenvalues of a real matrix pair (H,T), where H is an upper Hessenberg matrix and T is upper triangular, using the double-shift QZ method.
Purpose:
LAQZ0 computes the eigenvalues of a real matrix pair (H,T), where H is an upper Hessenberg matrix and T is upper triangular, using the double-shift 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 Hessenberg-triangular 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 quasi-triangular matrix with 1-by-1 and 2-by-2 diagonal blocks. The 1-by-1 blocks correspond to real eigenvalues of the matrix pair (H,T) and the 2-by-2 blocks correspond to complex conjugate pairs of eigenvalues. Additionally, the 2-by-2 upper triangular diagonal blocks of P corresponding to 2-by-2 blocks of S are reduced to positive diagonal form, i.e., if S(j+1,j) is non-zero, 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. 241--256. Ref: B. Kagstrom, D. Kressner, "Multishift Variants of the QZ Algorithm with Aggressive Early Deflation", SIAM J. Numer. Anal., 29(2006), pp. 199--227. Ref: T. Steel, D. Camps, K. Meerbergen, R. Vandebril "A multishift, multipole rational QZ method with agressive early deflation"
- Parameters:
WANTS – [in]
WANTS is CHARACTER*1
= ‘E’: Compute eigenvalues only;
= ‘S’: Compute eigenvalues and the Schur form.WANTQ – [in]
WANTQ 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 (A,B) is returned;
= ‘V’: Q must contain an orthogonal matrix Q1 on entry and the product Q1*Q is returned.
WANTZ – [in]
WANTZ 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 (A,B) is returned;
= ‘V’: Z must contain an orthogonal matrix Z1 on entry and the product Z1*Z is returned.
N – [in]
N is INTEGER
The order of the matrices A, B, Q, and Z. N >= 0.
ILO – [in] ILO is INTEGER
IHI – [in]
IHI is INTEGER
ILO and IHI mark the rows and columns of A which are in Hessenberg form. It is assumed that A is already upper triangular in rows and columns 1:ILO-1 and IHI+1:N.
If N > 0, 1 <= ILO <= IHI <= N; if N = 0, ILO=1 and IHI=0.A – [inout]
A is REAL array, dimension (LDA, N)
On entry, the N-by-N upper Hessenberg matrix A.
On exit, if JOB = ‘S’, A contains the upper quasi-triangular matrix S from the generalized Schur factorization.
If JOB = ‘E’, the diagonal blocks of A match those of S, but the rest of A is unspecified.
LDA – [in]
LDA is INTEGER
The leading dimension of the array A. LDA >= fla_max( 1, N ).
B – [inout]
B is REAL array, dimension (LDB, N)
On entry, the N-by-N upper triangular matrix B.
On exit, if JOB = ‘S’, B contains the upper triangular matrix P from the generalized Schur factorization;
2-by-2 diagonal blocks of P corresponding to 2-by-2 blocks of S are reduced to positive diagonal form, i.e., if A(j+1,j) is non-zero, then B(j+1,j) = B(j,j+1) = 0, B(j,j) > 0, and B(j+1,j+1) > 0.
If JOB = ‘E’, the diagonal blocks of B match those of P, but the rest of B is unspecified.LDB – [in]
LDB is INTEGER
The leading dimension of the array B. LDB >= fla_max( 1, N ).
ALPHAR – [out]
ALPHAR is REAL array, dimension (N)
The real parts of each scalar alpha defining an eigenvalue of GNEP.
ALPHAI – [out]
ALPHAI is REAL array, dimension (N)
The imaginary parts of each scalar alpha defining an eigenvalue of GNEP.
If ALPHAI(j) is zero, then the j-th eigenvalue is real; if positive, then the j-th and (j+1)-st eigenvalues are a complex conjugate pair, with ALPHAI(j+1) = -ALPHAI(j).BETA – [out]
BETA 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 j-th 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.Q – [inout]
Q 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 (A,B), and if COMPQ = ‘V’, the orthogonal matrix of left Schur vectors of (A,B).
Not referenced if COMPQ = ‘N’.
LDQ – [in]
LDQ is INTEGER
The leading dimension of the array Q. LDQ >= 1.
If COMPQ=’V’ or ‘I’, then LDQ >= N.Z – [inout]
Z 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’.
LDZ – [in]
LDZ is INTEGER
The leading dimension of the array Z. LDZ >= 1.
If COMPZ=’V’ or ‘I’, then LDZ >= N.WORK – [out]
WORK is REAL array, dimension (MAX(1,LWORK))
On exit, if INFO >= 0, WORK(1) returns the optimal LWORK.
LWORK – [in]
LWORK is INTEGER
The dimension of the array WORK. LWORK >= fla_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.REC – [in]
REC is INTEGER
REC indicates the current recursion level. Should be set to 0 on first call.
INFO – [in]
INFO is INTEGER
= 0: successful exit
< 0: if INFO = -i, the i-th argument had an illegal value
-
template<typename T>
LAQZ1#
- group laqz1
Functions
-
template<typename T>
void laqz1(T *a, integer *lda, T *b, integer *ldb, T *sr1, T *sr2, T *si, T *beta1, T *beta2, T *v)# Given a 3-by-3 matrix pencil (A,B), LAQZ1 sets v to a scalar multiple of the first column of the product.
Purpose:
Given a 3-by-3 matrix pencil (A,B), LAQZ1 sets v to a scalar multiple of the first column of the product (*) K = (A - (beta2*sr2 - i*si)*B)*B^(-1)*(beta1*A - (sr2 + i*si2)*B)*B^(-1). It is assumed that either 1) sr1 = sr2 or 2) si = 0. This is useful for starting double implicit shift bulges in the QZ algorithm.
- Parameters:
A – [in]
A is REAL array, dimension (LDA,N)
The 3-by-3 matrix A in (*).
LDA – [in]
LDA is INTEGER
The leading dimension of A as declared in the calling procedure.
B – [in]
B is REAL array, dimension (LDB,N)
The 3-by-3 matrix B in (*).
LDB – [in]
LDB is INTEGER
The leading dimension of B as declared in the calling procedure.
SR1 – [in] SR1 is REAL
SR2 – [in] SR2 is REAL
SI – [in] SI is REAL
BETA1 – [in] BETA1 is REAL
BETA2 – [in] BETA2 is REAL
V – [out]
V is REAL array, dimension (N)
A scalar multiple of the first column of the matrix K in (*).
-
template<typename T>
LAQZ2#
- group laqz2
Functions
-
template<typename T>
void laqz2(logical *ilq, logical *ilz, integer *k, integer *istartm, integer *istopm, integer *ihi, T *a, integer *lda, T *b, integer *ldb, integer *nq, integer *qstart, T *q, integer *ldq, integer *nz, integer *zstart, T *z, integer *ldz)# LAQZ2 chases a 2x2 shift bulge in a matrix pencil down a single position.
Purpose:
LAQZ2 chases a 2x2 shift bulge in a matrix pencil down a single position
- Parameters:
ILQ – [in]
ILQ is LOGICAL
Determines whether or not to update the matrix Q
ILZ – [in]
ILZ is LOGICAL
Determines whether or not to update the matrix Z
K – [in]
K is INTEGER
Index indicating the position of the bulge.
On entry, the bulge is located in (A(k+1:k+2,k:k+1),B(k+1:k+2,k:k+1)).
On exit, the bulge is located in (A(k+2:k+3,k+1:k+2),B(k+2:k+3,k+1:k+2)).
ISTARTM – [in] ISTARTM is INTEGER
ISTOPM – [in]
ISTOPM is INTEGER
Updates to (A,B) are restricted to (istartm:k+3,k:istopm). It is assumed without checking that istartm <= k+1 and k+2 <= istopm
IHI – [in] IHI is INTEGER
A – [inout] A is REAL array, dimension (LDA,N)
LDA – [in]
LDA is INTEGER
The leading dimension of A as declared in the calling procedure.
B – [inout] B is REAL array, dimension (LDB,N)
LDB – [in]
LDB is INTEGER
The leading dimension of B as declared in the calling procedure.
NQ – [in]
NQ is INTEGER
The order of the matrix Q
QSTART – [in]
QSTART is INTEGER
Start index of the matrix Q. Rotations are applied To columns k+2-qStart:k+4-qStart of Q.
Q – [inout] Q is REAL array, dimension (LDQ,NQ)
LDQ – [in]
LDQ is INTEGER
The leading dimension of Q as declared in the calling procedure.
NZ – [in]
NZ is INTEGER
The order of the matrix Z
ZSTART – [in]
ZSTART is INTEGER
Start index of the matrix Z. Rotations are applied To columns k+1-qStart:k+3-qStart of Z.
Z – [inout] Z is REAL array, dimension (LDZ,NZ)
LDZ – [in]
LDZ is INTEGER
The leading dimension of Q as declared in the calling procedure.
-
template<typename T, typename Ta>
void laqz2(logical *ilschur, logical *ilq, logical *ilz, integer *n, integer *ilo, integer *ihi, integer *nw, T *a, integer *lda, T *b, integer *ldb, T *q, integer *ldq, T *z, integer *ldz, integer *ns, integer *nd, T *alpha, T *beta, T *qc, integer *ldqc, T *zc, integer *ldzc, T *work, integer *lwork, float *rwork, integer *rec, integer *info)#
-
template<typename T>
LAQZ3#
- group laqz3
Functions
-
template<typename T>
void laqz3(logical *ilschur, logical *ilq, logical *ilz, integer *n, integer *ilo, integer *ihi, integer *nw, T *a, integer *lda, T *b, integer *ldb, T *q, integer *ldq, T *z, integer *ldz, integer *ns, integer *nd, T *alphar, T *alphai, T *beta, T *qc, integer *ldqc, T *zc, integer *ldzc, T *work, integer *lwork, integer *rec, integer *info)# LAQZ3 performs AED.
Purpose:
LAQZ3 performs AED
- Parameters:
ILSCHUR – [in]
ILSCHUR is LOGICAL
Determines whether or not to update the full Schur form
ILQ – [in]
ILQ is LOGICAL
Determines whether or not to update the matrix Q
ILZ – [in]
ILZ is LOGICAL
Determines whether or not to update the matrix Z
N – [in]
N is INTEGER
The order of the matrices A, B, Q, and Z. N >= 0.
ILO – [in] ILO is INTEGER
IHI – [in]
IHI is INTEGER
ILO and IHI mark the rows and columns of (A,B) which are to be normalized
NW – [in]
NW is INTEGER
The desired size of the deflation window.
A – [inout] A is REAL array, dimension (LDA, N)
LDA – [in]
LDA is INTEGER
The leading dimension of the array A. LDA >= fla_max( 1, N ).
B – [inout] B is REAL array, dimension (LDB,N)
LDB – [in]
LDB is INTEGER
The leading dimension of the array B. LDB >= fla_max( 1, N ).
Q – [inout] Q is REAL array, dimension (LDQ,N)
LDQ – [in] LDQ is INTEGER
Z – [inout] Z is REAL array, dimension (LDZ,N)
LDZ – [in] LDZ is INTEGER
NS – [out]
NS is INTEGER
The number of unconverged eigenvalues available to use as shifts.
ND – [out]
ND is INTEGER
The number of converged eigenvalues found.
ALPHAR – [out]
ALPHAR is REAL array, dimension (N)
The real parts of each scalar alpha defining an eigenvalue of GNEP.
ALPHAI – [out]
ALPHAI is REAL array, dimension (N)
The imaginary parts of each scalar alpha defining an eigenvalue of GNEP.
If ALPHAI(j) is zero, then the j-th eigenvalue is real; if positive, then the j-th and (j+1)-st eigenvalues are a complex conjugate pair, with ALPHAI(j+1) = -ALPHAI(j).BETA – [out]
BETA 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 j-th 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.QC – [inout] QC is REAL array, dimension (LDQC, NW)
LDQC – [in] LDQC is INTEGER
ZC – [inout] ZC is REAL array, dimension (LDZC, NW)
LDZ – [in] LDZ is INTEGER
WORK – [out]
WORK is REAL array, dimension (MAX(1,LWORK))
On exit, if INFO >= 0, WORK(1) returns the optimal LWORK.
LWORK – [in]
LWORK is INTEGER
The dimension of the array WORK. LWORK >= fla_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.REC – [in]
REC is INTEGER
REC indicates the current recursion level. Should be set to 0 on first call.
INFO – [out]
INFO is INTEGER
= 0: successful exit
< 0: if INFO = -i, the i-th argument had an illegal value
-
template<typename T>
void laqz3(logical *ilschur, logical *ilq, logical *ilz, integer *n, integer *ilo, integer *ihi, integer *nshifts, integer *nblock_desired, T *alpha, T *beta, T *a, integer *lda, T *b, integer *ldb, T *q, integer *ldq, T *z, integer *ldz, T *qc, integer *ldqc, T *zc, integer *ldzc, T *work, integer *lwork, integer *info)#
-
template<typename T>
LAQZ4#
- group laqz4
Functions
-
template<typename T>
void laqz4(logical *ilschur, logical *ilq, logical *ilz, integer *n, integer *ilo, integer *ihi, integer *nshifts, integer *nblock_desired, T *sr, T *si, T *ss, T *a, integer *lda, T *b, integer *ldb, T *q, integer *ldq, T *z, integer *ldz, T *qc, integer *ldqc, T *zc, integer *ldzc, T *work, integer *lwork, integer *info)# LAQZ4 Executes a single multishift QZ sweep.
Purpose:
LAQZ4 Executes a single multishift QZ sweep
- Parameters:
ILSCHUR – [in]
ILSCHUR is LOGICAL
Determines whether or not to update the full Schur form
ILQ – [in]
ILQ is LOGICAL
Determines whether or not to update the matrix Q
ILZ – [in]
ILZ is LOGICAL
Determines whether or not to update the matrix Z
N – [in]
N is INTEGER
The order of the matrices A, B, Q, and Z. N >= 0.
ILO – [in] ILO is INTEGER
IHI – [in] IHI is INTEGER
NSHIFTS – [in]
NSHIFTS is INTEGER
The desired number of shifts to use
NBLOCK_DESIRED – [in]
NBLOCK_DESIRED is INTEGER
The desired size of the computational windows
SR – [in] SR is REAL array. SR contains the real parts of the shifts to use.
SI – [in] SI is REAL array. SI contains the imaginary parts of the shifts to use.
SS – [in] SS is REAL array. SS contains the scale of the shifts to use.
A – [inout] A is REAL array, dimension (LDA, N)
LDA – [in]
LDA is INTEGER
The leading dimension of the array A. LDA >= fla_max( 1, N ).
B – [inout] B is REAL array, dimension (LDB,N)
LDB – [in]
LDB is INTEGER
The leading dimension of the array B. LDB >= fla_max( 1, N ).
Q – [inout] Q is REAL array, dimension (LDQ,N)
LDQ – [in] LDQ is INTEGER
Z – [inout] Z is REAL array, dimension (LDZ,N)
LDZ – [in] LDZ is INTEGER
QC – [inout] QC is REAL array, dimension (LDQC, NBLOCK_DESIRED)
LDQC – [in] LDQC is INTEGER
ZC – [inout] ZC is REAL array, dimension (LDZC, NBLOCK_DESIRED)
LDZC – [in] LDZC is INTEGER
WORK – [out]
WORK is REAL array, dimension (MAX(1,LWORK))
On exit, if INFO >= 0, WORK(1) returns the optimal LWORK.
LWORK – [in]
LWORK is INTEGER
The dimension of the array WORK. LWORK >= fla_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.INFO – [out]
INFO is INTEGER
= 0: successful exit
< 0: if INFO = -i, the i-th argument had an illegal value
-
template<typename T>
GGBAL#
- group ggbal
Functions
-
template<typename T>
void ggbal(char *job, integer *n, T *a, integer *lda, T *b, integer *ldb, integer *ilo, integer *ihi, T *lscale, T *rscale, T *work, integer *info)# GGBAL balances a pair of general real matrices (A,B)
Purpose:
SGGBAL balances a pair of general real matrices (A,B). This involves, first, permuting A and B by similarity transformations to isolate eigenvalues in the first 1 to ILO$-$1 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 1-norm of the matrices, and improve the accuracy of the computed eigenvalues and/or eigenvectors in the generalized eigenvalue problem A*x = lambda*B*x.
- Parameters:
JOB – [in]
JOB is CHARACTER*1
Specifies the operations to be performed on A and B:
= ‘N’: none: simply set ILO = 1, IHI = N, LSCALE(I) = 1.0 and RSCALE(I) = 1.0 for i = 1,…,N.
= ‘P’: permute only;
= ‘S’: scale only;
= ‘B’: both permute and scale.
N – [in]
N is INTEGER
The order of the matrices A and B. N >= 0.
A – [inout]
A 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.LDA – [in]
LDA is INTEGER
The leading dimension of the array A. LDA >= fla_max(1,N).
B – [inout]
B is REAL array, dimension (LDB,N)
On entry, the input matrix B.
On exit, B is overwritten by the balanced matrix. If JOB = ‘N’, B is not referenced.LDB – [in]
LDB is INTEGER
The leading dimension of the array B. LDB >= fla_max(1,N).
ILO – [out] ILO is INTEGER
IHI – [out]
IHI is INTEGER
ILO and IHI are set to integers such that on exit A(i,j) = 0 and B(i,j) = 0 if i > j and j = 1,…,ILO-1 or i = IHI+1,…,N. If JOB = ‘N’ or ‘S’, ILO = 1 and IHI = N.
LSCALE – [out]
LSCALE is REAL array, dimension (N)
Details of the permutations and scaling factors applied to the left side of A and B. If P(j) is the index of the row interchanged with row j, and D(j) is the scaling factor applied to row j, then
LSCALE(j) = P(j) for J = 1,…,ILO-1
= 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 ILO-1.
RSCALE – [out]
RSCALE is REAL array, dimension (N)
Details of the permutations and scaling factors applied to the right side of A and B. If P(j) is the index of the column interchanged with column j, and D(j) is the scaling factor applied to column j, then
LSCALE(j) = P(j) for J = 1,…,ILO-1
= 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 ILO-1.
WORK – [out]
WORK is REAL array, dimension (lwork)
lwork must be at least fla_max(1,6*N) when JOB = ‘S’ or ‘B’, and at least 1 when JOB = ‘N’ or ‘P’.
INFO – [out]
INFO is INTEGER
= 0: successful exit
< 0: if INFO = -i, the i-th argument had an illegal value.
-
template<typename T>
GGHRD#
- group gghrd
Functions
-
template<typename T>
void gghrd(char *compq, char *compz, integer *n, integer *ilo, integer *ihi, T *a, integer *lda, T *b, integer *ldb, T *q, integer *ldq, T *z, integer *ldz, integer *info)# GGHRD reduces a pair of real matrices (A,B) to generalized upper Hessenberg
form using orthogonal transformations.
Purpose:
GGHRD reduces a pair of real matrices (A,B) to generalized upper Hessenberg form using orthogonal transformations, where A is a general matrix and B is upper triangular. The form of the generalized eigenvalue problem is A*x = lambda*B*x, and B is typically made upper triangular by computing its QR factorization and moving the orthogonal matrix Q to the left side of the equation. This subroutine simultaneously reduces A to a Hessenberg matrix H: Q**T*A*Z = H and transforms B to another upper triangular matrix T: Q**T*B*Z = T in order to reduce the problem to its standard form H*y = lambda*T*y where y = Z**T*x. The orthogonal matrices Q and Z are determined as products of Givens rotations. They may either be formed explicitly, or they may be postmultiplied into input matrices Q1 and Z1, so that Q1 * A * Z1**T = (Q1*Q) * H * (Z1*Z)**T Q1 * B * Z1**T = (Q1*Q) * T * (Z1*Z)**T If Q1 is the orthogonal matrix from the QR factorization of B in the original equation A*x = lambda*B*x, then SGGHD3 reduces the original problem to generalized Hessenberg form. This is a blocked variant of SGGHRD, using matrix-matrix multiplications for parts of the computation to enhance performance.
- Parameters:
COMPQ – [in]
COMPQ is CHARACTER*1
= ‘N’: do not compute Q;
= ‘I’: Q is initialized to the unit matrix, and the orthogonal matrix Q is returned;
= ‘V’: Q must contain an orthogonal matrix Q1 on entry, and the product Q1*Q is returned.
COMPZ – [in]
COMPZ is CHARACTER*1
= ‘N’: do not compute Z;
= ‘I’: Z is initialized to the unit matrix, and the orthogonal matrix Z is returned;
= ‘V’: Z must contain an orthogonal matrix Z1 on entry, and the product Z1*Z is returned.
N – [in]
N is INTEGER
The order of the matrices A and B. N >= 0.
ILO – [in] ILO is INTEGER
IHI – [in]
IHI is INTEGER
ILO and IHI mark the rows and columns of A which are to be reduced. It is assumed that A is already upper triangular in rows and columns 1:ILO-1 and IHI+1:N. ILO and IHI are normally set by a previous call to SGGBAL; otherwise they should be set to 1 and N respectively.
1 <= ILO <= IHI <= N, if N > 0; ILO=1 and IHI=0, if N=0.A – [inout]
A 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 rest is set to zero.LDA – [in]
LDA is INTEGER
The leading dimension of the array A. LDA >= fla_max(1,N).
B – [inout]
B is REAL array, dimension (LDB, N)
On entry, the N-by-N upper triangular matrix B.
On exit, the upper triangular matrix T = Q**T B Z. The elements below the diagonal are set to zero.LDB – [in]
LDB is INTEGER
The leading dimension of the array B. LDB >= fla_max(1,N).
Q – [inout]
Q is REAL array, dimension (LDQ, N)
On entry, if COMPQ = ‘V’, the orthogonal matrix Q1, typically from the QR factorization of B.
On exit, if COMPQ=’I’, the orthogonal matrix Q, and if COMPQ = ‘V’, the product Q1*Q. Not referenced if COMPQ=’N’.LDQ – [in]
LDQ is INTEGER
The leading dimension of the array Q.
LDQ >= N if COMPQ=’V’ or ‘I’; LDQ >= 1 otherwise.Z – [inout]
Z is REAL array, dimension (LDZ, N)
On entry, if COMPZ = ‘V’, the orthogonal matrix Z1.
On exit, if COMPZ=’I’, the orthogonal matrix Z, and if COMPZ = ‘V’, the product Z1*Z. Not referenced if COMPZ=’N’.LDZ – [in]
LDZ is INTEGER
The leading dimension of the array Z.
LDZ >= N if COMPZ=’V’ or ‘I’; LDZ >= 1 otherwise.INFO – [out]
INFO is INTEGER
= 0: successful exit.
< 0: if INFO = -i, the i-th argument had an illegal value.
-
template<typename T>
GGHD3#
- group gghd3
Functions
-
template<typename T>
void gghd3(char *compq, char *compz, integer *n, integer *ilo, integer *ihi, T *a, integer *lda, T *b, integer *ldb, T *q, integer *ldq, T *z, integer *ldz, T *work, integer *lwork, integer *info)# GGHD3 reduces a pair of real matrices (A,B) to generalized upper Hessenberg
form using orthogonal transformations.
Purpose:
GGHD3 reduces a pair of real matrices (A,B) to generalized upper Hessenberg form using orthogonal transformations, where A is a general matrix and B is upper triangular. The form of the generalized eigenvalue problem is A*x = lambda*B*x, and B is typically made upper triangular by computing its QR factorization and moving the orthogonal matrix Q to the left side of the equation. This subroutine simultaneously reduces A to a Hessenberg matrix H: Q**T*A*Z = H and transforms B to another upper triangular matrix T: Q**T*B*Z = T in order to reduce the problem to its standard form H*y = lambda*T*y where y = Z**T*x. The orthogonal matrices Q and Z are determined as products of Givens rotations. They may either be formed explicitly, or they may be postmultiplied into input matrices Q1 and Z1, so that Q1 * A * Z1**T = (Q1*Q) * H * (Z1*Z)**T Q1 * B * Z1**T = (Q1*Q) * T * (Z1*Z)**T If Q1 is the orthogonal matrix from the QR factorization of B in the original equation A*x = lambda*B*x, then SGGHD3 reduces the original problem to generalized Hessenberg form. This is a blocked variant of SGGHRD, using matrix-matrix multiplications for parts of the computation to enhance performance.
- Parameters:
COMPQ – [in]
COMPQ is CHARACTER*1
= ‘N’: do not compute Q;
= ‘I’: Q is initialized to the unit matrix, and the orthogonal matrix Q is returned;
= ‘V’: Q must contain an orthogonal matrix Q1 on entry, and the product Q1*Q is returned.
COMPZ – [in]
COMPZ is CHARACTER*1
= ‘N’: do not compute Z;
= ‘I’: Z is initialized to the unit matrix, and the orthogonal matrix Z is returned;
= ‘V’: Z must contain an orthogonal matrix Z1 on entry, and the product Z1*Z is returned.
N – [in]
N is INTEGER
The order of the matrices A and B. N >= 0.
ILO – [in] ILO is INTEGER
IHI – [in]
IHI is INTEGER
ILO and IHI mark the rows and columns of A which are to be reduced. It is assumed that A is already upper triangular in rows and columns 1:ILO-1 and IHI+1:N. ILO and IHI are normally set by a previous call to SGGBAL; otherwise they should be set to 1 and N respectively.
1 <= ILO <= IHI <= N, if N > 0; ILO=1 and IHI=0, if N=0.A – [inout]
A 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 rest is set to zero.LDA – [in]
LDA is INTEGER
The leading dimension of the array A. LDA >= fla_max(1,N).
B – [inout]
B is REAL array, dimension (LDB, N)
On entry, the N-by-N upper triangular matrix B.
On exit, the upper triangular matrix T = Q**T B Z. The elements below the diagonal are set to zero.LDB – [in]
LDB is INTEGER
The leading dimension of the array B. LDB >= fla_max(1,N).
Q – [inout]
Q is REAL array, dimension (LDQ, N)
On entry, if COMPQ = ‘V’, the orthogonal matrix Q1, typically from the QR factorization of B.
On exit, if COMPQ=’I’, the orthogonal matrix Q, and if COMPQ = ‘V’, the product Q1*Q.
Not referenced if COMPQ=’N’.
LDQ – [in]
LDQ is INTEGER
The leading dimension of the array Q.
LDQ >= N if COMPQ=’V’ or ‘I’; LDQ >= 1 otherwise.Z – [inout]
Z is REAL array, dimension (LDZ, N)
On entry, if COMPZ = ‘V’, the orthogonal matrix Z1.
On exit, if COMPZ=’I’, the orthogonal matrix Z, and if COMPZ = ‘V’, the product Z1*Z.
Not referenced if COMPZ=’N’.
LDZ – [in]
LDZ is INTEGER
The leading dimension of the array Z.
LDZ >= N if COMPZ=’V’ or ‘I’; LDZ >= 1 otherwise.WORK – [out]
WORK is REAL array, dimension (LWORK)
On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
LWORK – [in]
LWORK is INTEGER
The length of the array WORK. LWORK >= 1.
For optimum performance LWORK >= 6*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.
INFO – [out]
INFO is INTEGER
= 0: successful exit.
< 0: if INFO = -i, the i-th argument had an illegal value.
-
template<typename T>
HGEQZ#
- group hgeqz
Functions
-
template<typename T>
void hgeqz(char *job, char *compq, char *compz, integer *n, integer *ilo, integer *ihi, T *h, integer *ldh, T *t, integer *ldt, T *alphar, T *alphai, T *beta, T *q, integer *ldq, T *z, integer *ldz, T *work, integer *lwork, integer *info)# HGEQZ computes the eigenvalues of a real matrix pair (H,T).
Purpose:
HGEQZ computes the eigenvalues of a real matrix pair (H,T), where H is an upper Hessenberg matrix and T is upper triangular, using the double-shift 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 Hessenberg-triangular 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 quasi-triangular matrix with 1-by-1 and 2-by-2 diagonal blocks. The 1-by-1 blocks correspond to real eigenvalues of the matrix pair (H,T) and the 2-by-2 blocks correspond to complex conjugate pairs of eigenvalues. Additionally, the 2-by-2 upper triangular diagonal blocks of P corresponding to 2-by-2 blocks of S are reduced to positive diagonal form, i.e., if S(j+1,j) is non-zero, 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. 241--256.
- Parameters:
JOB – [in]
JOB is CHARACTER*1
= ‘E’: Compute eigenvalues only;
= ‘S’: Compute eigenvalues and the Schur form.COMPQ – [in]
COMPQ 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.
COMPZ – [in]
COMPZ 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.
N – [in]
N is INTEGER
The order of the matrices H, T, Q, and Z. N >= 0.
ILO – [in] ILO is INTEGER
IHI – [in]
IHI 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:ILO-1 and IHI+1:N. If N > 0, 1 <= ILO <= IHI <= N; if N = 0, ILO=1 and IHI=0.
H – [inout]
H is REAL array, dimension (LDH, N)
On entry, the N-by-N upper Hessenberg matrix H.
On exit, if JOB = ‘S’, H contains the upper quasi-triangular 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.LDH – [in]
LDH is INTEGER
The leading dimension of the array H. LDH >= fla_max( 1, N).
T – [inout]
T is REAL array, dimension (LDT, N)
On entry, the N-by-N upper triangular matrix T.
On exit, if JOB = ‘S’, T contains the upper triangular matrix P from the generalized Schur factorization; 2-by-2 diagonal blocks of P corresponding to 2-by-2 blocks of S are reduced to positive diagonal form, i.e., if H(j+1,j) is non-zero, 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.
LDT – [in]
LDT is INTEGER
The leading dimension of the array T. LDT >= fla_max( 1, N).
ALPHAR – [out]
ALPHAR is REAL array, dimension (N)
The real parts of each scalar alpha defining an eigenvalue of GNEP.
ALPHAI – [out]
ALPHAI is REAL array, dimension (N)
The imaginary parts of each scalar alpha defining an eigenvalue of GNEP.
If ALPHAI(j) is zero, then the j-th eigenvalue is real; if positive, then the j-th and (j+1)-st eigenvalues are a complex conjugate pair, with ALPHAI(j+1) = -ALPHAI(j).BETA – [out]
BETA 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 j-th 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.
Q – [inout]
Q 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’.
LDQ – [in]
LDQ is INTEGER
The leading dimension of the array Q. LDQ >= 1. If COMPQ=’V’ or ‘I’, then LDQ >= N.
Z – [inout]
Z 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’.
LDZ – [in]
LDZ is INTEGER
The leading dimension of the array Z. LDZ >= 1. If COMPZ=’V’ or ‘I’, then LDZ >= N.
WORK – [out]
WORK is REAL array, dimension (MAX(1,LWORK))
On exit, if INFO >= 0, WORK(1) returns the optimal LWORK.
LWORK – [in]
LWORK is INTEGER The dimension of the array WORK. LWORK >= fla_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.
INFO – [out]
INFO is INTEGER
= 0: successful exit
< 0: if INFO = -i, the i-th 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=INFO-N+1,…,N should be correct.
-
template<typename T>
GGBAK#
- group ggbak
Functions
-
template<typename T>
void ggbak(char *job, char *side, integer *n, integer *ilo, integer *ihi, T *lscale, T *rscale, integer *m, T *v, integer *ldv, integer *info)# GGBAK forms the right or left eigenvectors of a real generalized eigenvalue problem.
Purpose:
GGBAK forms the right or left eigenvectors of a real generalized eigenvalue problem A*x = lambda*B*x, by backward transformation on the computed eigenvectors of the balanced pair of matrices output by GGBAL.
- Parameters:
JOB – [in]
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 SGGBAL.SIDE – [in]
SIDE is CHARACTER*1
= ‘R’: V contains right eigenvectors;
= ‘L’: V contains left eigenvectors.N – [in]
N is INTEGER
The number of rows of the matrix V. N >= 0.
ILO – [in] ILO is INTEGER
IHI – [in]
IHI is INTEGER
The integers ILO and IHI determined by SGGBAL.
1 <= ILO <= IHI <= N, if N > 0; ILO=1 and IHI=0, if N=0.LSCALE – [in]
LSCALE is REAL array, dimension (N)
Details of the permutations and/or scaling factors applied to the left side of A and B, as returned by SGGBAL.
RSCALE – [in]
RSCALE is REAL array, dimension (N)
Details of the permutations and/or scaling factors applied to the right side of A and B, as returned by SGGBAL.
M – [in]
M is INTEGER
The number of columns of the matrix V. M >= 0.
V – [inout]
V is REAL array, dimension (LDV,M)
On entry, the matrix of right or left eigenvectors to be transformed, as returned by STGEVC.
On exit, V is overwritten by the transformed eigenvectors.LDV – [in]
LDV is INTEGER
The leading dimension of the matrix V. LDV >= fla_max(1,N).
INFO – [out]
INFO is INTEGER
= 0: successful exit.
< 0: if INFO = -i, the i-th argument had an illegal value.
-
template<typename T>
TGSEN#
- group tgsen
Functions
-
template<typename T>
void tgsen(integer *ijob, logical *wantq, logical *wantz, logical *select, integer *n, T *a, integer *lda, T *b, integer *ldb, T *alphar, T *alphai, T *beta, T *q, integer *ldq, T *z, integer *ldz, integer *m, T *pl, T *pr, T *dif, T *work, integer *lwork, integer *iwork, integer *liwork, integer *info)# TGSEN reorders the generalized real Schur decomposition of a real matrix pair.
Purpose:
TGSEN reorders the generalized real Schur decomposition of a real matrix pair (A, B) (in terms of an orthonormal equivalence trans- formation Q**T * (A, B) * Z), so that a selected cluster of eigenvalues appears in the leading diagonal blocks of the upper quasi-triangular matrix A and the upper triangular B. The leading columns of Q and Z form orthonormal bases of the corresponding left and right eigen- spaces (deflating subspaces). (A, B) must be in generalized real Schur canonical form (as returned by SGGES), i.e. A is block upper triangular with 1-by-1 and 2-by-2 diagonal blocks. B is upper triangular. STGSEN also computes the generalized eigenvalues w(j) = (ALPHAR(j) + i*ALPHAI(j))/BETA(j) of the reordered matrix pair (A, B). Optionally, STGSEN computes the estimates of reciprocal condition numbers for eigenvalues and eigenspaces. These are Difu[(A11,B11), (A22,B22)] and Difl[(A11,B11), (A22,B22)], i.e. the separation(s) between the matrix pairs (A11, B11) and (A22,B22) that correspond to the selected cluster and the eigenvalues outside the cluster, resp., and norms of "projections" onto left and right eigenspaces w.r.t. the selected cluster in the (1,1)-block.
- Parameters:
IJOB – [in]
IJOB is INTEGER
Specifies whether condition numbers are required for the cluster of eigenvalues (PL and PR) or the deflating subspaces (Difu and Difl):
=0: Only reorder w.r.t. SELECT. No extras.
=1: Reciprocal of norms of “projections” onto left and right eigenspaces w.r.t. the selected cluster (PL and PR).
=2: Upper bounds on Difu and Difl. F-norm-based estimate (DIF(1:2)).
=3: Estimate of Difu and Difl. 1-norm-based estimate (DIF(1:2)). About 5 times as expensive as IJOB = 2.
=4: Compute PL, PR and DIF (i.e. 0, 1 and 2 above): Economic version to get it all.
=5: Compute PL, PR and DIF (i.e. 0, 1 and 3 above)
WANTQ – [in]
WANTQ is LOGICAL
.TRUE. : update the left transformation matrix Q;
.FALSE.: do not update Q.WANTZ – [in]
WANTZ is LOGICAL
.TRUE. : update the right transformation matrix Z;
.FALSE.: do not update Z.SELECT – [in]
SELECT is LOGICAL array, dimension (N)
SELECT specifies the eigenvalues in the selected cluster. To select a real eigenvalue w(j), SELECT(j) must be set to .TRUE.. To select a complex conjugate pair of eigenvalues w(j) and w(j+1), corresponding to a 2-by-2 diagonal block, either SELECT(j) or SELECT(j+1) or both must be set to .TRUE.; a complex conjugate pair of eigenvalues must be either both included in the cluster or both excluded.
N – [in]
N is INTEGER
The order of the matrices A and B. N >= 0.
A – [inout]
A is REAL array, dimension(LDA,N)
On entry, the upper quasi-triangular matrix A, with (A, B) in generalized real Schur canonical form. On exit, A is overwritten by the reordered matrix A.
LDA – [in]
LDA is INTEGER
The leading dimension of the array A. LDA >= fla_max(1,N).
B – [inout]
B is REAL array, dimension(LDB,N)
On entry, the upper triangular matrix B, with (A, B) in generalized real Schur canonical form.
On exit, B is overwritten by the reordered matrix B.LDB – [in]
LDB is INTEGER
The leading dimension of the array B. LDB >= fla_max(1,N).
ALPHAR – [out] ALPHAR is REAL array, dimension (N)
ALPHAI – [out] ALPHAI is REAL array, dimension (N)
BETA – [out]
BETA is REAL array, dimension (N)
On exit, (ALPHAR(j) + ALPHAI(j)*i)/BETA(j), j=1,…,N, will be the generalized eigenvalues. ALPHAR(j) + ALPHAI(j)*i and BETA(j),j=1,…,N are the diagonals of the complex Schur form (S,T) that would result if the 2-by-2 diagonal blocks of the real generalized Schur form of (A,B) were further reduced to triangular form using complex unitary transformations. If ALPHAI(j) is zero, then the j-th eigenvalue is real; if positive, then the j-th and (j+1)-st eigenvalues are a complex conjugate pair, with ALPHAI(j+1) negative.
Q – [inout]
Q is REAL array, dimension (LDQ,N)
On entry, if WANTQ = .TRUE., Q is an N-by-N matrix.
On exit, Q has been postmultiplied by the left orthogonal transformation matrix which reorder (A, B); The leading M columns of Q form orthonormal bases for the specified pair of left eigenspaces (deflating subspaces).
If WANTQ = .FALSE., Q is not referenced.
LDQ – [in]
LDQ is INTEGER
The leading dimension of the array Q. LDQ >= 1;
and if WANTQ = .TRUE., LDQ >= N.Z – [inout]
Z is REAL array, dimension (LDZ,N)
On entry, if WANTZ = .TRUE., Z is an N-by-N matrix.
On exit, Z has been postmultiplied by the left orthogonal transformation matrix which reorder (A, B); The leading M columns of Z form orthonormal bases for the specified pair of left eigenspaces (deflating subspaces).
If WANTZ = .FALSE., Z is not referenced.
LDZ – [in]
LDZ is INTEGER
The leading dimension of the array Z. LDZ >= 1; If WANTZ = .TRUE., LDZ >= N.
M – [out]
M is INTEGER
The dimension of the specified pair of left and right eigen- spaces (deflating subspaces). 0 <= M <= N.
PL – [out] PL is REAL
PR – [out]
PR is REAL
If IJOB = 1, 4 or 5, PL, PR are lower bounds on the reciprocal of the norm of “projections” onto left and right eigenspaces with respect to the selected cluster.
0 < PL, PR <= 1.
If M = 0 or M = N, PL = PR = 1.
If IJOB = 0, 2 or 3, PL and PR are not referenced.DIF – [out]
DIF is REAL array, dimension (2).
If IJOB >= 2, DIF(1:2) store the estimates of Difu and Difl. If IJOB = 2 or 4, DIF(1:2) are F-norm-based upper bounds on Difu and Difl. If IJOB = 3 or 5, DIF(1:2) are 1-norm-based estimates of Difu and Difl.
If M = 0 or N, DIF(1:2) = F-norm([A, B]).
If IJOB = 0 or 1, DIF is not referenced.
WORK – [out]
WORK is REAL array, dimension (MAX(1,LWORK))
On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
LWORK – [in]
LWORK is INTEGER
The dimension of the array WORK. LWORK >= 4*N+16.
If IJOB = 1, 2 or 4, LWORK >= MAX(4*N+16, 2*M*(N-M)).
If IJOB = 3 or 5, LWORK >= MAX(4*N+16, 4*M*(N-M)).
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.IWORK – [out]
IWORK is INTEGER array, dimension (MAX(1,LIWORK))
On exit, if INFO = 0, IWORK(1) returns the optimal LIWORK.
LIWORK – [in]
LIWORK is INTEGER
The dimension of the array IWORK. LIWORK >= 1.
If IJOB = 1, 2 or 4, LIWORK >= N+6.
If IJOB = 3 or 5, LIWORK >= MAX(2*M*(N-M), N+6).
If LIWORK = -1, then a workspace query is assumed; the routine only calculates the optimal size of the IWORK array, returns this value as the first entry of the IWORK array, and no error message related to LIWORK is issued by XERBLA.INFO – [out]
INFO is INTEGER
=0: Successful exit.
<0: If INFO = -i, the i-th argument had an illegal value.
=1: Reordering of (A, B) failed because the transformed matrix pair (A, B) would be too far from generalized Schur form; the problem is very ill-conditioned. (A, B) may have been partially reordered. If requested, 0 is returned in DIF(*), PL and PR.
-
template<typename T, typename Ta>
void tgsen(integer *ijob, logical *wantq, logical *wantz, logical *select, integer *n, T *a, integer *lda, T *b, integer *ldb, T *alpha, T *beta, T *q, integer *ldq, T *z, integer *ldz, integer *m, Ta *pl, Ta *pr, Ta *dif, T *work, integer *lwork, integer *iwork, integer *liwork, integer *info)#
-
template<typename T>
TGSNA#
- group tgsna
Functions
TGSNA estimates reciprocal condition numbers for specified
eigenvalues and/or eigenvectors of a matrix pair.
Purpose:
TGSNA estimates reciprocal condition numbers for specified eigenvalues and/or eigenvectors of a matrix pair (A, B) in generalized real Schur canonical form (or of any matrix pair (Q*A*Z**T, Q*B*Z**T) with orthogonal matrices Q and Z, where Z**T denotes the transpose of Z. (A, B) must be in generalized real Schur form (as returned by SGGES), i.e. A is block upper triangular with 1-by-1 and 2-by-2 diagonal blocks. B is upper triangular.
- Parameters:
JOB – [in]
JOB is CHARACTER*1
Specifies whether condition numbers are required for eigenvalues (S) or eigenvectors (DIF):
= ‘E’: for eigenvalues only (S);
= ‘V’: for eigenvectors only (DIF);
= ‘B’: for both eigenvalues and eigenvectors (S and DIF).HOWMNY – [in]
HOWMNY is CHARACTER*1
= ‘A’: compute condition numbers for all eigenpairs;
= ‘S’: compute condition numbers for selected eigenpairs specified by the array SELECT.SELECT – [in]
SELECT is LOGICAL array, dimension (N)
If HOWMNY = ‘S’, SELECT specifies the eigenpairs for which condition numbers are required. To select condition numbers for the eigenpair corresponding to a real eigenvalue w(j), SELECT(j) must be set to .TRUE.. To select condition numbers corresponding to a complex conjugate pair of eigenvalues w(j) and w(j+1), either SELECT(j) or SELECT(j+1) or both, must be set to .TRUE..
If HOWMNY = ‘A’, SELECT is not referenced.N – [in]
N is INTEGER
The order of the square matrix pair (A, B). N >= 0.
A – [in]
A is REAL array, dimension (LDA,N)
The upper quasi-triangular matrix A in the pair (A,B).
LDA – [in]
LDA is INTEGER
The leading dimension of the array A. LDA >= fla_max(1,N).
B – [in]
B is REAL array, dimension (LDB,N)
The upper triangular matrix B in the pair (A,B).
LDB – [in]
LDB is INTEGER
The leading dimension of the array B. LDB >= fla_max(1,N).
VL – [in]
VL is REAL array, dimension (LDVL,M)
If JOB = ‘E’ or ‘B’, VL must contain left eigenvectors of (A, B), corresponding to the eigenpairs specified by HOWMNY and SELECT. The eigenvectors must be stored in consecutive columns of VL, as returned by STGEVC.
If JOB = ‘V’, VL is not referenced.LDVL – [in]
LDVL is INTEGER
The leading dimension of the array VL. LDVL >= 1. If JOB = ‘E’ or ‘B’, LDVL >= N.
VR – [in]
VR is REAL array, dimension (LDVR,M)
If JOB = ‘E’ or ‘B’, VR must contain right eigenvectors of (A, B), corresponding to the eigenpairs specified by HOWMNY and SELECT. The eigenvectors must be stored in consecutive columns ov VR, as returned by STGEVC.
If JOB = ‘V’, VR is not referenced.LDVR – [in]
LDVR is INTEGER
The leading dimension of the array VR. LDVR >= 1. If JOB = ‘E’ or ‘B’, LDVR >= N.
S – [out]
S is REAL array, dimension (MM)
If JOB = ‘E’ or ‘B’, the reciprocal condition numbers of the selected eigenvalues, stored in consecutive elements of the array. For a complex conjugate pair of eigenvalues two consecutive elements of S are set to the same value. Thus S(j), DIF(j), and the j-th columns of VL and VR all correspond to the same eigenpair (but not in general the j-th eigenpair, unless all eigenpairs are selected).
If JOB = ‘V’, S is not referenced.DIF – [out]
DIF is REAL array, dimension (MM)
If JOB = ‘V’ or ‘B’, the estimated reciprocal condition numbers of the selected eigenvectors, stored in consecutive elements of the array. For a complex eigenvector two consecutive elements of DIF are set to the same value. If the eigenvalues cannot be reordered to compute DIF(j), DIF(j) is set to 0; this can only occur when the true value would be very small anyway.
If JOB = ‘E’, DIF is not referenced.MM – [in]
MM is INTEGER
The number of elements in the arrays S and DIF. MM >= M.
M – [out]
M is INTEGER
The number of elements of the arrays S and DIF used to store the specified condition numbers; for each selected real eigenvalue one element is used, and for each selected complex conjugate pair of eigenvalues, two elements are used. If HOWMNY = ‘A’, M is set to N.
WORK – [out]
WORK is REAL array, dimension (MAX(1,LWORK))
On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
LWORK – [in]
LWORK is INTEGER
The dimension of the array WORK. LWORK >= fla_max(1,N). If JOB = ‘V’ or ‘B’ LWORK >= 2*N*(N+2)+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.IWORK – [out] IWORK is INTEGER array, dimension (N + 6) If JOB = ‘E’, IWORK is not referenced.
INFO – [out]
INFO is INTEGER
=0: Successful exit
<0: If INFO = -i, the i-th argument had an illegal value
TGSYL#
- group tgsyl
Functions
-
template<typename T>
void tgsyl(char *trans, integer *ijob, integer *m, integer *n, T *a, integer *lda, T *b, integer *ldb, T *c, integer *ldc, T *d, integer *ldd, T *e, integer *lde, T *f, integer *ldf, T *scale, T *dif, T *work, integer *lwork, integer *iwork, integer *info)# TGSYL solves the generalized Sylvester equation.
Purpose:
TGSYL solves the generalized Sylvester equation: A * R - L * B = scale * C (1) D * R - L * E = scale * F where R and L are unknown m-by-n matrices, (A, D), (B, E) and (C, F) are given matrix pairs of size m-by-m, n-by-n and m-by-n, respectively, with real entries. (A, D) and (B, E) must be in generalized (real) Schur canonical form, i.e. A, B are upper quasi triangular and D, E are upper triangular. The solution (R, L) overwrites (C, F). 0 <= SCALE <= 1 is an output scaling factor chosen to avoid overflow. In matrix notation (1) is equivalent to solve Zx = scale b, where Z is defined as Z = [ kron(In, A) -kron(B**T, Im) ] (2) [ kron(In, D) -kron(E**T, Im) ]. Here Ik is the identity matrix of size k and X**T is the transpose of X. kron(X, Y) is the Kronecker product between the matrices X and Y. If TRANS = 'T', STGSYL solves the transposed system Z**T*y = scale*b, which is equivalent to solve for R and L in A**T * R + D**T * L = scale * C (3) R * B**T + L * E**T = scale * -F This case (TRANS = 'T') is used to compute an one-norm-based estimate of Dif[(A,D), (B,E)], the separation between the matrix pairs (A,D) and (B,E), using SLACON. If IJOB >= 1, STGSYL computes a Frobenius norm-based estimate of Dif[(A,D),(B,E)]. That is, the reciprocal of a lower bound on the reciprocal of the smallest singular value of Z. See [1-2] for more information. This is a level 3 BLAS algorithm.
- Parameters:
TRANS – [in]
TRANS is CHARACTER*1
= ‘N’: solve the generalized Sylvester equation (1). = ‘T’: solve the ‘transposed’ system (3).
IJOB – [in]
IJOB is INTEGER
Specifies what kind of functionality to be performed.
= 0: solve (1) only.
= 1: The functionality of 0 and 3.
= 2: The functionality of 0 and 4.
= 3: Only an estimate of Dif[(A,D), (B,E)] is computed. (look ahead strategy IJOB = 1 is used).
= 4: Only an estimate of Dif[(A,D), (B,E)] is computed. ( SGECON on sub-systems is used).
Not referenced if TRANS = ‘T’.
M – [in]
M is INTEGER
The order of the matrices A and D, and the row dimension of the matrices C, F, R and L.
N – [in]
N is INTEGER
The order of the matrices B and E, and the column dimension of the matrices C, F, R and L.
A – [in]
A is REAL array, dimension (LDA, M)
The upper quasi triangular matrix A.
LDA – [in]
LDA is INTEGER
The leading dimension of the array A. LDA >= fla_max(1, M).
B – [in]
B is REAL array, dimension (LDB, N)
The upper quasi triangular matrix B.
LDB – [in]
LDB is INTEGER
The leading dimension of the array B. LDB >= fla_max(1, N).
C – [inout]
C is REAL array, dimension (LDC, N)
On entry, C contains the right-hand-side of the first matrix equation in (1) or (3).
On exit, if IJOB = 0, 1 or 2, C has been overwritten by the solution R. If IJOB = 3 or 4 and TRANS = ‘N’, C holds R, the solution achieved during the computation of the Dif-estimate.LDC – [in]
LDC is INTEGER
The leading dimension of the array C. LDC >= fla_max(1, M).
D – [in]
D is REAL array, dimension (LDD, M)
The upper triangular matrix D.
LDD – [in]
LDD is INTEGER
The leading dimension of the array D. LDD >= fla_max(1, M).
E – [in]
E is REAL array, dimension (LDE, N)
The upper triangular matrix E.
LDE – [in]
LDE is INTEGER
The leading dimension of the array E. LDE >= fla_max(1, N).
F – [inout]
F is REAL array, dimension (LDF, N)
On entry, F contains the right-hand-side of the second matrix equation in (1) or (3).
On exit, if IJOB = 0, 1 or 2, F has been overwritten by the solution L. If IJOB = 3 or 4 and TRANS = ‘N’, F holds L, the solution achieved during the computation of the Dif-estimate.LDF – [in]
LDF is INTEGER
The leading dimension of the array F. LDF >= fla_max(1, M).
DIF – [out]
DIF is REAL
On exit DIF is the reciprocal of a lower bound of the reciprocal of the Dif-function, i.e. DIF is an upper bound of Dif[(A,D), (B,E)] = sigma_min(Z), where Z as in (2). IF IJOB = 0 or TRANS = ‘T’, DIF is not touched.
SCALE – [out]
SCALE is REAL
On exit SCALE is the scaling factor in (1) or (3). If 0 < SCALE < 1, C and F hold the solutions R and L, resp., to a slightly perturbed system but the input matrices A, B, D and E have not been changed. If SCALE = 0, C and F hold the solutions R and L, respectively, to the homogeneous system with C = F = 0. Normally, SCALE = 1.
WORK – [out]
WORK is REAL array, dimension (MAX(1,LWORK))
On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
LWORK – [in]
LWORK is INTEGER
The dimension of the array WORK. LWORK > = 1. If IJOB = 1 or 2 and TRANS = ‘N’, LWORK >= fla_max(1,2*M*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.IWORK – [out] IWORK is INTEGER array, dimension (M+N+6)
INFO – [out]
INFO is INTEGER
=0: successful exit
<0: If INFO = -i, the i-th argument had an illegal value.
>0: (A, D) and (B, E) have common or close eigenvalues.
-
template<typename T>
TGSY2#
- group tgsy2
Functions
-
template<typename T>
void tgsy2(char *trans, integer *ijob, integer *m, integer *n, T *a, integer *lda, T *b, integer *ldb, T *c, integer *ldc, T *d, integer *ldd, T *e, integer *lde, T *f, integer *ldf, T *scale, T *rdsum, T *rdscal, integer *iwork, integer *pq, integer *info)# TGSY2 solves the generalized Sylvester equation (unblocked algorithm)
Purpose:
TGSY2 solves the generalized Sylvester equation: A * R - L * B = scale * C (1) D * R - L * E = scale * F, using Level 1 and 2 BLAS. where R and L are unknown M-by-N matrices, (A, D), (B, E) and (C, F) are given matrix pairs of size M-by-M, N-by-N and M-by-N, respectively, with real entries. (A, D) and (B, E) must be in generalized Schur canonical form, i.e. A, B are upper quasi triangular and D, E are upper triangular. The solution (R, L) overwrites (C, F). 0 <= SCALE <= 1 is an output scaling factor chosen to avoid overflow. In matrix notation solving equation (1) corresponds to solve Z*x = scale*b, where Z is defined as Z = [ kron(In, A) -kron(B**T, Im) ] (2) [ kron(In, D) -kron(E**T, Im) ], Ik is the identity matrix of size k and X**T is the transpose of X. kron(X, Y) is the Kronecker product between the matrices X and Y. In the process of solving (1), we solve a number of such systems where Dim(In), Dim(In) = 1 or 2. If TRANS = 'T', solve the transposed system Z**T*y = scale*b for y, which is equivalent to solve for R and L in A**T * R + D**T * L = scale * C (3) R * B**T + L * E**T = scale * -F This case is used to compute an estimate of Dif[(A, D), (B, E)] = sigma_min(Z) using reverse communication with SLACON. STGSY2 also (IJOB >= 1) contributes to the computation in STGSYL of an upper bound on the separation between to matrix pairs. Then the input (A, D), (B, E) are sub-pencils of the matrix pair in STGSYL. See STGSYL for details.
- Parameters:
TRANS – [in]
TRANS is CHARACTER*1
= ‘N’: solve the generalized Sylvester equation (1).
= ‘T’: solve the ‘transposed’ system (3).IJOB – [in]
IJOB is INTEGER
Specifies what kind of functionality to be performed.
= 0: solve (1) only.
= 1: A contribution from this subsystem to a Frobenius norm-based estimate of the separation between two matrix pairs is computed. (look ahead strategy is used).
= 2: A contribution from this subsystem to a Frobenius norm-based estimate of the separation between two matrix pairs is computed. (SGECON on sub-systems is used.)
Not referenced if TRANS = ‘T’.
M – [in]
M is INTEGER
On entry, M specifies the order of A and D, and the row dimension of C, F, R and L.
N – [in]
N is INTEGER
On entry, N specifies the order of B and E, and the column dimension of C, F, R and L.
A – [in]
A is REAL array, dimension (LDA, M)
On entry, A contains an upper quasi triangular matrix.
LDA – [in]
LDA is INTEGER
The leading dimension of the matrix A. LDA >= fla_max(1, M).
B – [in]
B is REAL array, dimension (LDB, N)
On entry, B contains an upper quasi triangular matrix.
LDB – [in]
LDB is INTEGER
The leading dimension of the matrix B. LDB >= fla_max(1, N).
C – [inout]
C is REAL array, dimension (LDC, N)
On entry, C contains the right-hand-side of the first matrix equation in (1).
On exit, if IJOB = 0, C has been overwritten by the solution R.LDC – [in]
LDC is INTEGER
The leading dimension of the matrix C. LDC >= fla_max(1, M).
D – [in]
D is REAL array, dimension (LDD, M)
On entry, D contains an upper triangular matrix.
LDD – [in]
LDD is INTEGER
The leading dimension of the matrix D. LDD >= fla_max(1, M).
E – [in]
E is REAL array, dimension (LDE, N)
On entry, E contains an upper triangular matrix.
LDE – [in]
LDE is INTEGER
The leading dimension of the matrix E. LDE >= fla_max(1, N).
F – [inout]
F is REAL array, dimension (LDF, N)
On entry, F contains the right-hand-side of the second matrix equation in (1).
On exit, if IJOB = 0, F has been overwritten by the solution L.LDF – [in]
LDF is INTEGER
The leading dimension of the matrix F. LDF >= fla_max(1, M).
SCALE – [out]
SCALE is REAL
On exit, 0 <= SCALE <= 1. If 0 < SCALE < 1, the solutions R and L (C and F on entry) will hold the solutions to a slightly perturbed system but the input matrices A, B, D and E have not been changed. If SCALE = 0, R and L will hold the solutions to the homogeneous system with C = F = 0. Normally, SCALE = 1.
RDSUM – [inout]
RDSUM is REAL
On entry, the sum of squares of computed contributions to the Dif-estimate under computation by STGSYL, where the scaling factor RDSCAL (see below) has been factored out. On exit, the corresponding sum of squares updated with the contributions from the current sub-system. If TRANS = ‘T’ RDSUM is not touched.
NOTE: RDSUM only makes sense when STGSY2 is called by STGSYL.RDSCAL – [inout]
RDSCAL is REAL
On entry, scaling factor used to prevent overflow in RDSUM.
On exit, RDSCAL is updated w.r.t. the current contributions in RDSUM. If TRANS = ‘T’, RDSCAL is not touched.
NOTE: RDSCAL only makes sense when STGSY2 is called by STGSYL.
IWORK – [out] IWORK is INTEGER array, dimension (M+N+2)
PQ – [out]
PQ is INTEGER
On exit, the number of subsystems (of size 2-by-2, 4-by-4 and 8-by-8) solved by this routine.
INFO – [out]
INFO is INTEGER
On exit, if INFO is set to
=0: Successful exit
<0: If INFO = -i, the i-th argument had an illegal value.
>0: The matrix pairs (A, D) and (B, E) have common or very close eigenvalues.
-
template<typename T>
M22#
- group m22
Functions
-
template<typename T>
void orm22(char *side, char *trans, integer *m, integer *n, integer *n1, integer *n2, T *q, integer *ldq, T *c, integer *ldc, T *work, integer *lwork, integer *info)# ORM22 multiplies a general matrix by a banded orthogonal matrix.
Purpose:
ORM22 overwrites the general real M-by-N 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 of order NQ, with NQ = M if SIDE = 'L' and NQ = N if SIDE = 'R'. The orthogonal matrix Q processes a 2-by-2 block structure [ Q11 Q12 ] Q = [ ] [ Q21 Q22 ], where Q12 is an N1-by-N1 lower triangular matrix and Q21 is an N2-by-N2 upper triangular matrix.
- Parameters:
SIDE – [in]
SIDE is CHARACTER*1
= ‘L’: apply Q or Q**T from the Left;
= ‘R’: apply Q or Q**T from the Right.TRANS – [in]
TRANS is CHARACTER*1
= ‘N’: apply Q (No transpose);
= ‘C’: apply Q**T (Conjugate transpose).M – [in]
M is INTEGER
The number of rows of the matrix C. M >= 0.
N – [in]
N is INTEGER
The number of columns of the matrix C. N >= 0.
N1 – [in]
N2 – [in]
N1 is INTEGER
N2 is INTEGER
The dimension of Q12 and Q21, respectively. N1, N2 >= 0. The following requirement must be satisfied:
N1 + N2 = M if SIDE = ‘L’ and N1 + N2 = N if SIDE = ‘R’.
Q – [in]
Q is REAL array, dimension
(LDQ,M) if SIDE = ‘L’
(LDQ,N) if SIDE = ‘R’LDQ – [in]
LDQ is INTEGER
The leading dimension of the array Q.
LDQ >= fla_max(1,M) if SIDE = ‘L’; LDQ >= fla_max(1,N) if SIDE = ‘R’.C – [inout]
C is REAL array, dimension (LDC,N)
On entry, the M-by-N matrix C.
On exit, C is overwritten by Q*C or Q**T*C or C*Q**T or C*Q.LDC – [in]
LDC is INTEGER
The leading dimension of the array C. LDC >= fla_max(1,M).
WORK – [out]
WORK is REAL array, dimension (MAX(1,LWORK))
On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
LWORK – [in]
LWORK is INTEGER
The dimension of the array WORK.
If SIDE = ‘L’, LWORK >= fla_max(1,N);
if SIDE = ‘R’, LWORK >= fla_max(1,M).
For optimum performance LWORK >= M*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.
INFO – [out]
INFO is INTEGER
= 0: successful exit
< 0: if INFO = -i, the i-th argument had an illegal value
-
template<typename T>
LAGV2#
- group lagv2
Functions
-
template<typename T>
void lagv2(T *a, integer *lda, T *b, integer *ldb, T *alphar, T *alphai, T *beta, T *csl, T *snl, T *csr, T *snr)# LAGV2 computes the Generalized Schur factorization of a real 2-by-2
matrix pencil (A,B) where B is upper triangular.
Purpose:
LAGV2 computes the Generalized Schur factorization of a real 2-by-2 matrix pencil (A,B) where B is upper triangular. This routine computes orthogonal (rotation) matrices given by CSL, SNL and CSR, SNR such that 1) if the pencil (A,B) has two real eigenvalues (include 0/0 or 1/0 types), then [ a11 a12 ] := [ CSL SNL ] [ a11 a12 ] [ CSR -SNR ] [ 0 a22 ] [ -SNL CSL ] [ a21 a22 ] [ SNR CSR ] [ b11 b12 ] := [ CSL SNL ] [ b11 b12 ] [ CSR -SNR ] [ 0 b22 ] [ -SNL CSL ] [ 0 b22 ] [ SNR CSR ], 2) if the pencil (A,B) has a pair of complex conjugate eigenvalues, then [ a11 a12 ] := [ CSL SNL ] [ a11 a12 ] [ CSR -SNR ] [ a21 a22 ] [ -SNL CSL ] [ a21 a22 ] [ SNR CSR ] [ b11 0 ] := [ CSL SNL ] [ b11 b12 ] [ CSR -SNR ] [ 0 b22 ] [ -SNL CSL ] [ 0 b22 ] [ SNR CSR ] where b11 >= b22 > 0.
- Parameters:
A – [inout] A is REAL array, dimension (LDA, 2) On entry, the 2 x 2 matrix A. On exit, A is overwritten by the
A-part'' of the generalized Schur form. \n @param[in] LDA LDA is INTEGER \n THe leading dimension of the array A. LDA >= 2. \n @param[in,out] B B is REAL array, dimension (LDB, 2) \n On entry, the upper triangular 2 x 2 matrix B. On exit, B is overwritten by theB-part’’ of the generalized Schur form.LDB – [in]
LDB is INTEGER
THe leading dimension of the array B. LDB >= 2.
ALPHAR – [out] ALPHAR is REAL array, dimension (2)
ALPHAI – [out] ALPHAI is REAL array, dimension (2)
BETA – [out]
BETA is REAL array, dimension (2)
(ALPHAR(k)+i*ALPHAI(k))/BETA(k) are the eigenvalues of the pencil (A,B), k=1,2, i = sqrt(-1). Note that BETA(k) may be zero.
CSL – [out]
CSL is REAL
The cosine of the left rotation matrix.
SNL – [out]
SNL is REAL
The sine of the left rotation matrix.
CSR – [out]
CSR is REAL
The cosine of the right rotation matrix.
SNR – [out]
SNR is REAL
The sine of the right rotation matrix.
-
template<typename T>
TGEVC#
- group tgevc
Functions
-
template<typename T>
void tgevc(char *side, char *howmny, logical *select, integer *n, T *s, integer *lds, T *p, integer *ldp, T *vl, integer *ldvl, T *vr, integer *ldvr, integer *mm, integer *m, T *work, integer *info)# TGEVC computes some or all of the right and/or left eigenvectors
of a pair of real matrices.
Purpose:
TGEVC computes some or all of the right and/or left eigenvectors of a pair of real matrices (S,P), where S is a quasi-triangular 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 – [in]
SIDE is CHARACTER*1
= ‘R’: compute right eigenvectors only;
= ‘L’: compute left eigenvectors only;
= ‘B’: compute both right and left eigenvectors.
HOWMNY – [in]
HOWMNY 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.
SELECT – [in]
SELECT 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’.N – [in]
N is INTEGER
The order of the matrices S and P. N >= 0.
S – [in]
S is REAL array, dimension (LDS,N)
The upper quasi-triangular matrix S from a generalized Schur factorization, as computed by SHGEQZ.
LDS – [in]
LDS is INTEGER
The leading dimension of array S. LDS >= fla_max(1,N).
P – [in]
P is REAL array, dimension (LDP,N)
The upper triangular matrix P from a generalized Schur factorization, as computed by SHGEQZ. 2-by-2 diagonal blocks of P corresponding to 2-by-2 blocks of S must be in positive diagonal form.
LDP – [in]
LDP is INTEGER
The leading dimension of array P. LDP >= fla_max(1,N).
VL – [inout]
VL is REAL array, dimension (LDVL,MM)
On entry, if SIDE = ‘L’ or ‘B’ and HOWMNY = ‘B’, VL must contain an N-by-N 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’.
LDVL – [in]
LDVL is INTEGER
The leading dimension of array VL. LDVL >= 1, and if SIDE = ‘L’ or ‘B’, LDVL >= N.
VR – [inout]
VR is REAL array, dimension (LDVR,MM)
On entry, if SIDE = ‘R’ or ‘B’ and HOWMNY = ‘B’, VR must contain an N-by-N 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’.
LDVR – [in]
LDVR is INTEGER
The leading dimension of the array VR. LDVR >= 1, and if SIDE = ‘R’ or ‘B’, LDVR >= N.
MM – [in]
MM is INTEGER
The number of columns in the arrays VL and/or VR. MM >= M.
M – [out]
M 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.
WORK – [out] WORK is REAL array, dimension (6*N)
INFO – [out]
INFO is INTEGER
= 0: successful exit.
< 0: if INFO = -i, the i-th argument had an illegal value.
> 0: the 2-by-2 block (INFO:INFO+1) does not have a complex eigenvalue.
-
template<typename T>
TGEXC#
- group tgexc
Functions
-
template<typename T>
void tgexc(logical *wantq, logical *wantz, integer *n, T *a, integer *lda, T *b, integer *ldb, T *q, integer *ldq, T *z, integer *ldz, integer *ifst, integer *ilst, integer *info)# TGEXC reorders the generalized real Schur decomposition of a real matrix pair.
Purpose:
TGEXC 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 1-by-1 and 2-by-2 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 – [in]
WANTQ is LOGICAL
.TRUE. : update the left transformation matrix Q;
.FALSE.: do not update Q.WANTZ – [in]
WANTZ is LOGICAL
.TRUE. : update the right transformation matrix Z;
.FALSE.: do not update Z.N – [in]
N is INTEGER
The order of the matrices A and B. N >= 0.
A – [inout]
A 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.LDA – [in]
LDA is INTEGER
The leading dimension of the array A. LDA >= fla_max(1,N).
B – [inout]
B 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).LDB – [in]
LDB is INTEGER
The leading dimension of the array B. LDB >= fla_max(1,N).
Q – [inout]
Q is REAL array, dimension (LDQ,N)
On entry, if WANTQ = .TRUE., the orthogonal matrix Q. On exit, the updated matrix Q.
If WANTQ = .FALSE., Q is not referenced.LDQ – [in]
LDQ is INTEGER
The leading dimension of the array Q. LDQ >= 1. If WANTQ = .TRUE., LDQ >= N.
Z – [inout]
Z 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.LDZ – [in]
LDZ is INTEGER
The leading dimension of the array Z. LDZ >= 1. If WANTZ = .TRUE., LDZ >= N.
IFST – [inout] IFST is INTEGER
ILST – [inout]
ILST 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 2-by-2 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.
WORK – [out]
WORK is REAL array, dimension (MAX(1,LWORK))
On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
LWORK – [in]
LWORK 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.INFO – [out]
INFO is INTEGER
=0: successful exit.
<0: if INFO = -i, the i-th 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.
-
template<typename T>
TGEX2#
- group tgex2
Functions
-
template<typename T>
void tgex2(logical *wantq, logical *wantz, integer *n, T *a, integer *lda, T *b, integer *ldb, T *q, integer *ldq, T *z, integer *ldz, integer *j1, integer *n1, integer *n2, T *work, integer *lwork, integer *info)# TGEX2 swaps adjacent diagonal blocks in an upper (quasi) triangular matrix pair by an orthogonal equivalence transformation.
Purpose:
TGEX2 swaps adjacent diagonal blocks (A11, B11) and (A22, B22) of size 1-by-1 or 2-by-2 in an upper (quasi) triangular matrix pair (A, B) by an orthogonal equivalence transformation. (A, B) must be in generalized real Schur canonical form (as returned by SGGES), i.e. A is block upper triangular with 1-by-1 and 2-by-2 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 – [in]
WANTQ is LOGICAL
.TRUE. : update the left transformation matrix Q; .FALSE.: do not update Q.
WANTZ – [in]
WANTZ is LOGICAL
.TRUE. : update the right transformation matrix Z; .FALSE.: do not update Z.
N – [in]
N is INTEGER
The order of the matrices A and B. N >= 0.
A – [inout]
A is REAL array, dimension (LDA,N)
On entry, the matrix A in the pair (A, B). On exit, the updated matrix A.
LDA – [in]
LDA is INTEGER
The leading dimension of the array A. LDA >= fla_max(1,N).
B – [inout]
B is REAL array, dimension (LDB,N)
On entry, the matrix B in the pair (A, B). On exit, the updated matrix B.
LDB – [in]
LDB is INTEGER
The leading dimension of the array B. LDB >= fla_max(1,N).
Q – [inout]
Q is REAL array, dimension (LDQ,N)
On entry, if WANTQ = .TRUE., the orthogonal matrix Q. On exit, the updated matrix Q. Not referenced if WANTQ = .FALSE..
LDQ – [in]
LDQ is INTEGER
The leading dimension of the array Q. LDQ >= 1. If WANTQ = .TRUE., LDQ >= N.
Z – [inout]
Z is REAL array, dimension (LDZ,N)
On entry, if WANTZ =.TRUE., the orthogonal matrix Z. On exit, the updated matrix Z. Not referenced if WANTZ = .FALSE..
LDZ – [in]
LDZ is INTEGER
The leading dimension of the array Z. LDZ >= 1. If WANTZ = .TRUE., LDZ >= N.
J1 – [in]
J1 is INTEGER
The index to the first block (A11, B11). 1 <= J1 <= N.
N1 – [in]
N1 is INTEGER
The order of the first block (A11, B11). N1 = 0, 1 or 2.
N2 – [in]
N2 is INTEGER
The order of the second block (A22, B22). N2 = 0, 1 or 2.
WORK – [out] WORK is REAL array, dimension (MAX(1,LWORK)).
LWORK – [in]
LWORK is INTEGER
The dimension of the array WORK. LWORK >= MAX(N*(N2+N1), (N2+N1)*(N2+N1)*2)
INFO – [out]
INFO is INTEGER
=0: Successful exit
>0: If INFO = 1, the transformed matrix (A, B) would be too far from generalized Schur form; the blocks are not swapped and (A, B) and (Q, Z) are unchanged. The problem of swapping is too ill-conditioned.
<0: If INFO = -16: LWORK is too small. Appropriate value for LWORK is returned in WORK(1).
-
template<typename T>