1 *> \brief \b ZLAED0 used by sstedc. Computes all eigenvalues and corresponding eigenvectors of an unreduced symmetric tridiagonal matrix using the divide and conquer method.
3 * =========== DOCUMENTATION ===========
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
9 *> Download ZLAED0 + dependencies
10 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/zlaed0.f">
12 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/zlaed0.f">
14 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/zlaed0.f">
21 * SUBROUTINE ZLAED0( QSIZ, N, D, E, Q, LDQ, QSTORE, LDQS, RWORK,
24 * .. Scalar Arguments ..
25 * INTEGER INFO, LDQ, LDQS, N, QSIZ
27 * .. Array Arguments ..
29 * DOUBLE PRECISION D( * ), E( * ), RWORK( * )
30 * COMPLEX*16 Q( LDQ, * ), QSTORE( LDQS, * )
39 *> Using the divide and conquer method, ZLAED0 computes all eigenvalues
40 *> of a symmetric tridiagonal matrix which is one diagonal block of
41 *> those from reducing a dense or band Hermitian matrix and
42 *> corresponding eigenvectors of the dense or band matrix.
51 *> The dimension of the unitary matrix used to reduce
52 *> the full matrix to tridiagonal form. QSIZ >= N if ICOMPQ = 1.
58 *> The dimension of the symmetric tridiagonal matrix. N >= 0.
63 *> D is DOUBLE PRECISION array, dimension (N)
64 *> On entry, the diagonal elements of the tridiagonal matrix.
65 *> On exit, the eigenvalues in ascending order.
70 *> E is DOUBLE PRECISION array, dimension (N-1)
71 *> On entry, the off-diagonal elements of the tridiagonal matrix.
72 *> On exit, E has been destroyed.
77 *> Q is COMPLEX*16 array, dimension (LDQ,N)
78 *> On entry, Q must contain an QSIZ x N matrix whose columns
79 *> unitarily orthonormal. It is a part of the unitary matrix
80 *> that reduces the full dense Hermitian matrix to a
81 *> (reducible) symmetric tridiagonal matrix.
87 *> The leading dimension of the array Q. LDQ >= max(1,N).
92 *> IWORK is INTEGER array,
93 *> the dimension of IWORK must be at least
95 *> ( lg( N ) = smallest integer k
96 *> such that 2^k >= N )
101 *> RWORK is DOUBLE PRECISION array,
102 *> dimension (1 + 3*N + 2*N*lg N + 3*N**2)
103 *> ( lg( N ) = smallest integer k
104 *> such that 2^k >= N )
107 *> \param[out] QSTORE
109 *> QSTORE is COMPLEX*16 array, dimension (LDQS, N)
110 *> Used to store parts of
111 *> the eigenvector matrix when the updating matrix multiplies
118 *> The leading dimension of the array QSTORE.
125 *> = 0: successful exit.
126 *> < 0: if INFO = -i, the i-th argument had an illegal value.
127 *> > 0: The algorithm failed to compute an eigenvalue while
128 *> working on the submatrix lying in rows and columns
129 *> INFO/(N+1) through mod(INFO,N+1).
135 *> \author Univ. of Tennessee
136 *> \author Univ. of California Berkeley
137 *> \author Univ. of Colorado Denver
140 *> \date September 2012
142 *> \ingroup complex16OTHERcomputational
144 * =====================================================================
145 SUBROUTINE ZLAED0( QSIZ, N, D, E, Q, LDQ, QSTORE, LDQS, RWORK,
148 * -- LAPACK computational routine (version 3.4.2) --
149 * -- LAPACK is a software package provided by Univ. of Tennessee, --
150 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
153 * .. Scalar Arguments ..
154 INTEGER INFO, LDQ, LDQS, N, QSIZ
156 * .. Array Arguments ..
158 DOUBLE PRECISION D( * ), E( * ), RWORK( * )
159 COMPLEX*16 Q( LDQ, * ), QSTORE( LDQS, * )
162 * =====================================================================
164 * Warning: N could be as big as QSIZ!
168 PARAMETER ( TWO = 2.D+0 )
170 * .. Local Scalars ..
171 INTEGER CURLVL, CURPRB, CURR, I, IGIVCL, IGIVNM,
172 $ IGIVPT, INDXQ, IPERM, IPRMPT, IQ, IQPTR, IWREM,
173 $ J, K, LGN, LL, MATSIZ, MSD2, SMLSIZ, SMM1,
174 $ SPM1, SPM2, SUBMAT, SUBPBS, TLVLS
175 DOUBLE PRECISION TEMP
177 * .. External Subroutines ..
178 EXTERNAL DCOPY, DSTEQR, XERBLA, ZCOPY, ZLACRM, ZLAED7
180 * .. External Functions ..
184 * .. Intrinsic Functions ..
185 INTRINSIC ABS, DBLE, INT, LOG, MAX
187 * .. Executable Statements ..
189 * Test the input parameters.
193 * IF( ICOMPQ .LT. 0 .OR. ICOMPQ .GT. 2 ) THEN
195 * ELSE IF( ( ICOMPQ .EQ. 1 ) .AND. ( QSIZ .LT. MAX( 0, N ) ) )
197 IF( QSIZ.LT.MAX( 0, N ) ) THEN
199 ELSE IF( N.LT.0 ) THEN
201 ELSE IF( LDQ.LT.MAX( 1, N ) ) THEN
203 ELSE IF( LDQS.LT.MAX( 1, N ) ) THEN
207 CALL XERBLA( 'ZLAED0', -INFO )
211 * Quick return if possible
216 SMLSIZ = ILAENV( 9, 'ZLAED0', ' ', 0, 0, 0, 0 )
218 * Determine the size and placement of the submatrices, and save in
219 * the leading elements of IWORK.
225 IF( IWORK( SUBPBS ).GT.SMLSIZ ) THEN
226 DO 20 J = SUBPBS, 1, -1
227 IWORK( 2*J ) = ( IWORK( J )+1 ) / 2
228 IWORK( 2*J-1 ) = IWORK( J ) / 2
235 IWORK( J ) = IWORK( J ) + IWORK( J-1 )
238 * Divide the matrix into SUBPBS submatrices of size at most SMLSIZ+1
239 * using rank-1 modifications (cuts).
243 SUBMAT = IWORK( I ) + 1
245 D( SMM1 ) = D( SMM1 ) - ABS( E( SMM1 ) )
246 D( SUBMAT ) = D( SUBMAT ) - ABS( E( SMM1 ) )
251 * Set up workspaces for eigenvalues only/accumulate new vectors
254 TEMP = LOG( DBLE( N ) ) / LOG( TWO )
260 IPRMPT = INDXQ + N + 1
261 IPERM = IPRMPT + N*LGN
262 IQPTR = IPERM + N*LGN
263 IGIVPT = IQPTR + N + 2
264 IGIVCL = IGIVPT + N*LGN
267 IQ = IGIVNM + 2*N*LGN
268 IWREM = IQ + N**2 + 1
269 * Initialize pointers
271 IWORK( IPRMPT+I ) = 1
272 IWORK( IGIVPT+I ) = 1
276 * Solve each submatrix eigenproblem at the bottom of the divide and
285 SUBMAT = IWORK( I ) + 1
286 MATSIZ = IWORK( I+1 ) - IWORK( I )
288 LL = IQ - 1 + IWORK( IQPTR+CURR )
289 CALL DSTEQR( 'I', MATSIZ, D( SUBMAT ), E( SUBMAT ),
290 $ RWORK( LL ), MATSIZ, RWORK, INFO )
291 CALL ZLACRM( QSIZ, MATSIZ, Q( 1, SUBMAT ), LDQ, RWORK( LL ),
292 $ MATSIZ, QSTORE( 1, SUBMAT ), LDQS,
294 IWORK( IQPTR+CURR+1 ) = IWORK( IQPTR+CURR ) + MATSIZ**2
297 INFO = SUBMAT*( N+1 ) + SUBMAT + MATSIZ - 1
301 DO 60 J = SUBMAT, IWORK( I+1 )
307 * Successively merge eigensystems of adjacent submatrices
308 * into eigensystem for the corresponding larger matrix.
310 * while ( SUBPBS > 1 )
314 IF( SUBPBS.GT.1 ) THEN
323 SUBMAT = IWORK( I ) + 1
324 MATSIZ = IWORK( I+2 ) - IWORK( I )
329 * Merge lower order eigensystems (of size MSD2 and MATSIZ - MSD2)
330 * into an eigensystem of size MATSIZ. ZLAED7 handles the case
331 * when the eigenvectors of a full or band Hermitian matrix (which
332 * was reduced to tridiagonal form) are desired.
334 * I am free to use Q as a valuable working space until Loop 150.
336 CALL ZLAED7( MATSIZ, MSD2, QSIZ, TLVLS, CURLVL, CURPRB,
337 $ D( SUBMAT ), QSTORE( 1, SUBMAT ), LDQS,
338 $ E( SUBMAT+MSD2-1 ), IWORK( INDXQ+SUBMAT ),
339 $ RWORK( IQ ), IWORK( IQPTR ), IWORK( IPRMPT ),
340 $ IWORK( IPERM ), IWORK( IGIVPT ),
341 $ IWORK( IGIVCL ), RWORK( IGIVNM ),
342 $ Q( 1, SUBMAT ), RWORK( IWREM ),
343 $ IWORK( SUBPBS+1 ), INFO )
345 INFO = SUBMAT*( N+1 ) + SUBMAT + MATSIZ - 1
348 IWORK( I / 2+1 ) = IWORK( I+2 )
357 * Re-merge the eigenvalues/vectors which were deflated at the final
363 CALL ZCOPY( QSIZ, QSTORE( 1, J ), 1, Q( 1, I ), 1 )
365 CALL DCOPY( N, RWORK, 1, D, 1 )