1 SUBROUTINE ZHBGV( JOBZ, UPLO, N, KA, KB, AB, LDAB, BB, LDBB, W, Z,
2 $ LDZ, WORK, RWORK, INFO )
3 *
4 * -- LAPACK driver routine (version 3.2) --
5 * -- LAPACK is a software package provided by Univ. of Tennessee, --
6 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
7 * November 2006
8 *
9 * .. Scalar Arguments ..
10 CHARACTER JOBZ, UPLO
11 INTEGER INFO, KA, KB, LDAB, LDBB, LDZ, N
12 * ..
13 * .. Array Arguments ..
14 DOUBLE PRECISION RWORK( * ), W( * )
15 COMPLEX*16 AB( LDAB, * ), BB( LDBB, * ), WORK( * ),
16 $ Z( LDZ, * )
17 * ..
18 *
19 * Purpose
20 * =======
21 *
22 * ZHBGV computes all the eigenvalues, and optionally, the eigenvectors
23 * of a complex generalized Hermitian-definite banded eigenproblem, of
24 * the form A*x=(lambda)*B*x. Here A and B are assumed to be Hermitian
25 * and banded, and B is also positive definite.
26 *
27 * Arguments
28 * =========
29 *
30 * JOBZ (input) CHARACTER*1
31 * = 'N': Compute eigenvalues only;
32 * = 'V': Compute eigenvalues and eigenvectors.
33 *
34 * UPLO (input) CHARACTER*1
35 * = 'U': Upper triangles of A and B are stored;
36 * = 'L': Lower triangles of A and B are stored.
37 *
38 * N (input) INTEGER
39 * The order of the matrices A and B. N >= 0.
40 *
41 * KA (input) INTEGER
42 * The number of superdiagonals of the matrix A if UPLO = 'U',
43 * or the number of subdiagonals if UPLO = 'L'. KA >= 0.
44 *
45 * KB (input) INTEGER
46 * The number of superdiagonals of the matrix B if UPLO = 'U',
47 * or the number of subdiagonals if UPLO = 'L'. KB >= 0.
48 *
49 * AB (input/output) COMPLEX*16 array, dimension (LDAB, N)
50 * On entry, the upper or lower triangle of the Hermitian band
51 * matrix A, stored in the first ka+1 rows of the array. The
52 * j-th column of A is stored in the j-th column of the array AB
53 * as follows:
54 * if UPLO = 'U', AB(ka+1+i-j,j) = A(i,j) for max(1,j-ka)<=i<=j;
55 * if UPLO = 'L', AB(1+i-j,j) = A(i,j) for j<=i<=min(n,j+ka).
56 *
57 * On exit, the contents of AB are destroyed.
58 *
59 * LDAB (input) INTEGER
60 * The leading dimension of the array AB. LDAB >= KA+1.
61 *
62 * BB (input/output) COMPLEX*16 array, dimension (LDBB, N)
63 * On entry, the upper or lower triangle of the Hermitian band
64 * matrix B, stored in the first kb+1 rows of the array. The
65 * j-th column of B is stored in the j-th column of the array BB
66 * as follows:
67 * if UPLO = 'U', BB(kb+1+i-j,j) = B(i,j) for max(1,j-kb)<=i<=j;
68 * if UPLO = 'L', BB(1+i-j,j) = B(i,j) for j<=i<=min(n,j+kb).
69 *
70 * On exit, the factor S from the split Cholesky factorization
71 * B = S**H*S, as returned by ZPBSTF.
72 *
73 * LDBB (input) INTEGER
74 * The leading dimension of the array BB. LDBB >= KB+1.
75 *
76 * W (output) DOUBLE PRECISION array, dimension (N)
77 * If INFO = 0, the eigenvalues in ascending order.
78 *
79 * Z (output) COMPLEX*16 array, dimension (LDZ, N)
80 * If JOBZ = 'V', then if INFO = 0, Z contains the matrix Z of
81 * eigenvectors, with the i-th column of Z holding the
82 * eigenvector associated with W(i). The eigenvectors are
83 * normalized so that Z**H*B*Z = I.
84 * If JOBZ = 'N', then Z is not referenced.
85 *
86 * LDZ (input) INTEGER
87 * The leading dimension of the array Z. LDZ >= 1, and if
88 * JOBZ = 'V', LDZ >= N.
89 *
90 * WORK (workspace) COMPLEX*16 array, dimension (N)
91 *
92 * RWORK (workspace) DOUBLE PRECISION array, dimension (3*N)
93 *
94 * INFO (output) INTEGER
95 * = 0: successful exit
96 * < 0: if INFO = -i, the i-th argument had an illegal value
97 * > 0: if INFO = i, and i is:
98 * <= N: the algorithm failed to converge:
99 * i off-diagonal elements of an intermediate
100 * tridiagonal form did not converge to zero;
101 * > N: if INFO = N + i, for 1 <= i <= N, then ZPBSTF
102 * returned INFO = i: B is not positive definite.
103 * The factorization of B could not be completed and
104 * no eigenvalues or eigenvectors were computed.
105 *
106 * =====================================================================
107 *
108 * .. Local Scalars ..
109 LOGICAL UPPER, WANTZ
110 CHARACTER VECT
111 INTEGER IINFO, INDE, INDWRK
112 * ..
113 * .. External Functions ..
114 LOGICAL LSAME
115 EXTERNAL LSAME
116 * ..
117 * .. External Subroutines ..
118 EXTERNAL DSTERF, XERBLA, ZHBGST, ZHBTRD, ZPBSTF, ZSTEQR
119 * ..
120 * .. Executable Statements ..
121 *
122 * Test the input parameters.
123 *
124 WANTZ = LSAME( JOBZ, 'V' )
125 UPPER = LSAME( UPLO, 'U' )
126 *
127 INFO = 0
128 IF( .NOT.( WANTZ .OR. LSAME( JOBZ, 'N' ) ) ) THEN
129 INFO = -1
130 ELSE IF( .NOT.( UPPER .OR. LSAME( UPLO, 'L' ) ) ) THEN
131 INFO = -2
132 ELSE IF( N.LT.0 ) THEN
133 INFO = -3
134 ELSE IF( KA.LT.0 ) THEN
135 INFO = -4
136 ELSE IF( KB.LT.0 .OR. KB.GT.KA ) THEN
137 INFO = -5
138 ELSE IF( LDAB.LT.KA+1 ) THEN
139 INFO = -7
140 ELSE IF( LDBB.LT.KB+1 ) THEN
141 INFO = -9
142 ELSE IF( LDZ.LT.1 .OR. ( WANTZ .AND. LDZ.LT.N ) ) THEN
143 INFO = -12
144 END IF
145 IF( INFO.NE.0 ) THEN
146 CALL XERBLA( 'ZHBGV ', -INFO )
147 RETURN
148 END IF
149 *
150 * Quick return if possible
151 *
152 IF( N.EQ.0 )
153 $ RETURN
154 *
155 * Form a split Cholesky factorization of B.
156 *
157 CALL ZPBSTF( UPLO, N, KB, BB, LDBB, INFO )
158 IF( INFO.NE.0 ) THEN
159 INFO = N + INFO
160 RETURN
161 END IF
162 *
163 * Transform problem to standard eigenvalue problem.
164 *
165 INDE = 1
166 INDWRK = INDE + N
167 CALL ZHBGST( JOBZ, UPLO, N, KA, KB, AB, LDAB, BB, LDBB, Z, LDZ,
168 $ WORK, RWORK( INDWRK ), IINFO )
169 *
170 * Reduce to tridiagonal form.
171 *
172 IF( WANTZ ) THEN
173 VECT = 'U'
174 ELSE
175 VECT = 'N'
176 END IF
177 CALL ZHBTRD( VECT, UPLO, N, KA, AB, LDAB, W, RWORK( INDE ), Z,
178 $ LDZ, WORK, IINFO )
179 *
180 * For eigenvalues only, call DSTERF. For eigenvectors, call ZSTEQR.
181 *
182 IF( .NOT.WANTZ ) THEN
183 CALL DSTERF( N, W, RWORK( INDE ), INFO )
184 ELSE
185 CALL ZSTEQR( JOBZ, N, W, RWORK( INDE ), Z, LDZ,
186 $ RWORK( INDWRK ), INFO )
187 END IF
188 RETURN
189 *
190 * End of ZHBGV
191 *
192 END
2 $ LDZ, WORK, RWORK, INFO )
3 *
4 * -- LAPACK driver routine (version 3.2) --
5 * -- LAPACK is a software package provided by Univ. of Tennessee, --
6 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
7 * November 2006
8 *
9 * .. Scalar Arguments ..
10 CHARACTER JOBZ, UPLO
11 INTEGER INFO, KA, KB, LDAB, LDBB, LDZ, N
12 * ..
13 * .. Array Arguments ..
14 DOUBLE PRECISION RWORK( * ), W( * )
15 COMPLEX*16 AB( LDAB, * ), BB( LDBB, * ), WORK( * ),
16 $ Z( LDZ, * )
17 * ..
18 *
19 * Purpose
20 * =======
21 *
22 * ZHBGV computes all the eigenvalues, and optionally, the eigenvectors
23 * of a complex generalized Hermitian-definite banded eigenproblem, of
24 * the form A*x=(lambda)*B*x. Here A and B are assumed to be Hermitian
25 * and banded, and B is also positive definite.
26 *
27 * Arguments
28 * =========
29 *
30 * JOBZ (input) CHARACTER*1
31 * = 'N': Compute eigenvalues only;
32 * = 'V': Compute eigenvalues and eigenvectors.
33 *
34 * UPLO (input) CHARACTER*1
35 * = 'U': Upper triangles of A and B are stored;
36 * = 'L': Lower triangles of A and B are stored.
37 *
38 * N (input) INTEGER
39 * The order of the matrices A and B. N >= 0.
40 *
41 * KA (input) INTEGER
42 * The number of superdiagonals of the matrix A if UPLO = 'U',
43 * or the number of subdiagonals if UPLO = 'L'. KA >= 0.
44 *
45 * KB (input) INTEGER
46 * The number of superdiagonals of the matrix B if UPLO = 'U',
47 * or the number of subdiagonals if UPLO = 'L'. KB >= 0.
48 *
49 * AB (input/output) COMPLEX*16 array, dimension (LDAB, N)
50 * On entry, the upper or lower triangle of the Hermitian band
51 * matrix A, stored in the first ka+1 rows of the array. The
52 * j-th column of A is stored in the j-th column of the array AB
53 * as follows:
54 * if UPLO = 'U', AB(ka+1+i-j,j) = A(i,j) for max(1,j-ka)<=i<=j;
55 * if UPLO = 'L', AB(1+i-j,j) = A(i,j) for j<=i<=min(n,j+ka).
56 *
57 * On exit, the contents of AB are destroyed.
58 *
59 * LDAB (input) INTEGER
60 * The leading dimension of the array AB. LDAB >= KA+1.
61 *
62 * BB (input/output) COMPLEX*16 array, dimension (LDBB, N)
63 * On entry, the upper or lower triangle of the Hermitian band
64 * matrix B, stored in the first kb+1 rows of the array. The
65 * j-th column of B is stored in the j-th column of the array BB
66 * as follows:
67 * if UPLO = 'U', BB(kb+1+i-j,j) = B(i,j) for max(1,j-kb)<=i<=j;
68 * if UPLO = 'L', BB(1+i-j,j) = B(i,j) for j<=i<=min(n,j+kb).
69 *
70 * On exit, the factor S from the split Cholesky factorization
71 * B = S**H*S, as returned by ZPBSTF.
72 *
73 * LDBB (input) INTEGER
74 * The leading dimension of the array BB. LDBB >= KB+1.
75 *
76 * W (output) DOUBLE PRECISION array, dimension (N)
77 * If INFO = 0, the eigenvalues in ascending order.
78 *
79 * Z (output) COMPLEX*16 array, dimension (LDZ, N)
80 * If JOBZ = 'V', then if INFO = 0, Z contains the matrix Z of
81 * eigenvectors, with the i-th column of Z holding the
82 * eigenvector associated with W(i). The eigenvectors are
83 * normalized so that Z**H*B*Z = I.
84 * If JOBZ = 'N', then Z is not referenced.
85 *
86 * LDZ (input) INTEGER
87 * The leading dimension of the array Z. LDZ >= 1, and if
88 * JOBZ = 'V', LDZ >= N.
89 *
90 * WORK (workspace) COMPLEX*16 array, dimension (N)
91 *
92 * RWORK (workspace) DOUBLE PRECISION array, dimension (3*N)
93 *
94 * INFO (output) INTEGER
95 * = 0: successful exit
96 * < 0: if INFO = -i, the i-th argument had an illegal value
97 * > 0: if INFO = i, and i is:
98 * <= N: the algorithm failed to converge:
99 * i off-diagonal elements of an intermediate
100 * tridiagonal form did not converge to zero;
101 * > N: if INFO = N + i, for 1 <= i <= N, then ZPBSTF
102 * returned INFO = i: B is not positive definite.
103 * The factorization of B could not be completed and
104 * no eigenvalues or eigenvectors were computed.
105 *
106 * =====================================================================
107 *
108 * .. Local Scalars ..
109 LOGICAL UPPER, WANTZ
110 CHARACTER VECT
111 INTEGER IINFO, INDE, INDWRK
112 * ..
113 * .. External Functions ..
114 LOGICAL LSAME
115 EXTERNAL LSAME
116 * ..
117 * .. External Subroutines ..
118 EXTERNAL DSTERF, XERBLA, ZHBGST, ZHBTRD, ZPBSTF, ZSTEQR
119 * ..
120 * .. Executable Statements ..
121 *
122 * Test the input parameters.
123 *
124 WANTZ = LSAME( JOBZ, 'V' )
125 UPPER = LSAME( UPLO, 'U' )
126 *
127 INFO = 0
128 IF( .NOT.( WANTZ .OR. LSAME( JOBZ, 'N' ) ) ) THEN
129 INFO = -1
130 ELSE IF( .NOT.( UPPER .OR. LSAME( UPLO, 'L' ) ) ) THEN
131 INFO = -2
132 ELSE IF( N.LT.0 ) THEN
133 INFO = -3
134 ELSE IF( KA.LT.0 ) THEN
135 INFO = -4
136 ELSE IF( KB.LT.0 .OR. KB.GT.KA ) THEN
137 INFO = -5
138 ELSE IF( LDAB.LT.KA+1 ) THEN
139 INFO = -7
140 ELSE IF( LDBB.LT.KB+1 ) THEN
141 INFO = -9
142 ELSE IF( LDZ.LT.1 .OR. ( WANTZ .AND. LDZ.LT.N ) ) THEN
143 INFO = -12
144 END IF
145 IF( INFO.NE.0 ) THEN
146 CALL XERBLA( 'ZHBGV ', -INFO )
147 RETURN
148 END IF
149 *
150 * Quick return if possible
151 *
152 IF( N.EQ.0 )
153 $ RETURN
154 *
155 * Form a split Cholesky factorization of B.
156 *
157 CALL ZPBSTF( UPLO, N, KB, BB, LDBB, INFO )
158 IF( INFO.NE.0 ) THEN
159 INFO = N + INFO
160 RETURN
161 END IF
162 *
163 * Transform problem to standard eigenvalue problem.
164 *
165 INDE = 1
166 INDWRK = INDE + N
167 CALL ZHBGST( JOBZ, UPLO, N, KA, KB, AB, LDAB, BB, LDBB, Z, LDZ,
168 $ WORK, RWORK( INDWRK ), IINFO )
169 *
170 * Reduce to tridiagonal form.
171 *
172 IF( WANTZ ) THEN
173 VECT = 'U'
174 ELSE
175 VECT = 'N'
176 END IF
177 CALL ZHBTRD( VECT, UPLO, N, KA, AB, LDAB, W, RWORK( INDE ), Z,
178 $ LDZ, WORK, IINFO )
179 *
180 * For eigenvalues only, call DSTERF. For eigenvectors, call ZSTEQR.
181 *
182 IF( .NOT.WANTZ ) THEN
183 CALL DSTERF( N, W, RWORK( INDE ), INFO )
184 ELSE
185 CALL ZSTEQR( JOBZ, N, W, RWORK( INDE ), Z, LDZ,
186 $ RWORK( INDWRK ), INFO )
187 END IF
188 RETURN
189 *
190 * End of ZHBGV
191 *
192 END