LAPACK 3.12.1
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches
slaed7.f
Go to the documentation of this file.
1*> \brief \b SLAED7 used by SSTEDC. Computes the updated eigensystem of a diagonal matrix after modification by a rank-one symmetric matrix. Used when the original matrix is dense.
2*
3* =========== DOCUMENTATION ===========
4*
5* Online html documentation available at
6* http://www.netlib.org/lapack/explore-html/
7*
8*> Download SLAED7 + dependencies
9*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/slaed7.f">
10*> [TGZ]</a>
11*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/slaed7.f">
12*> [ZIP]</a>
13*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/slaed7.f">
14*> [TXT]</a>
15*
16* Definition:
17* ===========
18*
19* SUBROUTINE SLAED7( ICOMPQ, N, QSIZ, TLVLS, CURLVL, CURPBM, D, Q,
20* LDQ, INDXQ, RHO, CUTPNT, QSTORE, QPTR, PRMPTR,
21* PERM, GIVPTR, GIVCOL, GIVNUM, WORK, IWORK,
22* INFO )
23*
24* .. Scalar Arguments ..
25* INTEGER CURLVL, CURPBM, CUTPNT, ICOMPQ, INFO, LDQ, N,
26* $ QSIZ, TLVLS
27* REAL RHO
28* ..
29* .. Array Arguments ..
30* INTEGER GIVCOL( 2, * ), GIVPTR( * ), INDXQ( * ),
31* $ IWORK( * ), PERM( * ), PRMPTR( * ), QPTR( * )
32* REAL D( * ), GIVNUM( 2, * ), Q( LDQ, * ),
33* $ QSTORE( * ), WORK( * )
34* ..
35*
36*
37*> \par Purpose:
38* =============
39*>
40*> \verbatim
41*>
42*> SLAED7 computes the updated eigensystem of a diagonal
43*> matrix after modification by a rank-one symmetric matrix. This
44*> routine is used only for the eigenproblem which requires all
45*> eigenvalues and optionally eigenvectors of a dense symmetric matrix
46*> that has been reduced to tridiagonal form. SLAED1 handles
47*> the case in which all eigenvalues and eigenvectors of a symmetric
48*> tridiagonal matrix are desired.
49*>
50*> T = Q(in) ( D(in) + RHO * Z*Z**T ) Q**T(in) = Q(out) * D(out) * Q**T(out)
51*>
52*> where Z = Q**Tu, u is a vector of length N with ones in the
53*> CUTPNT and CUTPNT + 1 th elements and zeros elsewhere.
54*>
55*> The eigenvectors of the original matrix are stored in Q, and the
56*> eigenvalues are in D. The algorithm consists of three stages:
57*>
58*> The first stage consists of deflating the size of the problem
59*> when there are multiple eigenvalues or if there is a zero in
60*> the Z vector. For each such occurrence the dimension of the
61*> secular equation problem is reduced by one. This stage is
62*> performed by the routine SLAED8.
63*>
64*> The second stage consists of calculating the updated
65*> eigenvalues. This is done by finding the roots of the secular
66*> equation via the routine SLAED4 (as called by SLAED9).
67*> This routine also calculates the eigenvectors of the current
68*> problem.
69*>
70*> The final stage consists of computing the updated eigenvectors
71*> directly using the updated eigenvalues. The eigenvectors for
72*> the current problem are multiplied with the eigenvectors from
73*> the overall problem.
74*> \endverbatim
75*
76* Arguments:
77* ==========
78*
79*> \param[in] ICOMPQ
80*> \verbatim
81*> ICOMPQ is INTEGER
82*> = 0: Compute eigenvalues only.
83*> = 1: Compute eigenvectors of original dense symmetric matrix
84*> also. On entry, Q contains the orthogonal matrix used
85*> to reduce the original matrix to tridiagonal form.
86*> \endverbatim
87*>
88*> \param[in] N
89*> \verbatim
90*> N is INTEGER
91*> The dimension of the symmetric tridiagonal matrix. N >= 0.
92*> \endverbatim
93*>
94*> \param[in] QSIZ
95*> \verbatim
96*> QSIZ is INTEGER
97*> The dimension of the orthogonal matrix used to reduce
98*> the full matrix to tridiagonal form. QSIZ >= N if ICOMPQ = 1.
99*> \endverbatim
100*>
101*> \param[in] TLVLS
102*> \verbatim
103*> TLVLS is INTEGER
104*> The total number of merging levels in the overall divide and
105*> conquer tree.
106*> \endverbatim
107*>
108*> \param[in] CURLVL
109*> \verbatim
110*> CURLVL is INTEGER
111*> The current level in the overall merge routine,
112*> 0 <= CURLVL <= TLVLS.
113*> \endverbatim
114*>
115*> \param[in] CURPBM
116*> \verbatim
117*> CURPBM is INTEGER
118*> The current problem in the current level in the overall
119*> merge routine (counting from upper left to lower right).
120*> \endverbatim
121*>
122*> \param[in,out] D
123*> \verbatim
124*> D is REAL array, dimension (N)
125*> On entry, the eigenvalues of the rank-1-perturbed matrix.
126*> On exit, the eigenvalues of the repaired matrix.
127*> \endverbatim
128*>
129*> \param[in,out] Q
130*> \verbatim
131*> Q is REAL array, dimension (LDQ, N)
132*> On entry, the eigenvectors of the rank-1-perturbed matrix.
133*> On exit, the eigenvectors of the repaired tridiagonal matrix.
134*> \endverbatim
135*>
136*> \param[in] LDQ
137*> \verbatim
138*> LDQ is INTEGER
139*> The leading dimension of the array Q. LDQ >= max(1,N).
140*> \endverbatim
141*>
142*> \param[out] INDXQ
143*> \verbatim
144*> INDXQ is INTEGER array, dimension (N)
145*> The permutation which will reintegrate the subproblem just
146*> solved back into sorted order, i.e., D( INDXQ( I = 1, N ) )
147*> will be in ascending order.
148*> \endverbatim
149*>
150*> \param[in] RHO
151*> \verbatim
152*> RHO is REAL
153*> The subdiagonal element used to create the rank-1
154*> modification.
155*> \endverbatim
156*>
157*> \param[in] CUTPNT
158*> \verbatim
159*> CUTPNT is INTEGER
160*> Contains the location of the last eigenvalue in the leading
161*> sub-matrix. min(1,N) <= CUTPNT <= N.
162*> \endverbatim
163*>
164*> \param[in,out] QSTORE
165*> \verbatim
166*> QSTORE is REAL array, dimension (N**2+1)
167*> Stores eigenvectors of submatrices encountered during
168*> divide and conquer, packed together. QPTR points to
169*> beginning of the submatrices.
170*> \endverbatim
171*>
172*> \param[in,out] QPTR
173*> \verbatim
174*> QPTR is INTEGER array, dimension (N+2)
175*> List of indices pointing to beginning of submatrices stored
176*> in QSTORE. The submatrices are numbered starting at the
177*> bottom left of the divide and conquer tree, from left to
178*> right and bottom to top.
179*> \endverbatim
180*>
181*> \param[in] PRMPTR
182*> \verbatim
183*> PRMPTR is INTEGER array, dimension (N lg N)
184*> Contains a list of pointers which indicate where in PERM a
185*> level's permutation is stored. PRMPTR(i+1) - PRMPTR(i)
186*> indicates the size of the permutation and also the size of
187*> the full, non-deflated problem.
188*> \endverbatim
189*>
190*> \param[in] PERM
191*> \verbatim
192*> PERM is INTEGER array, dimension (N lg N)
193*> Contains the permutations (from deflation and sorting) to be
194*> applied to each eigenblock.
195*> \endverbatim
196*>
197*> \param[in] GIVPTR
198*> \verbatim
199*> GIVPTR is INTEGER array, dimension (N lg N)
200*> Contains a list of pointers which indicate where in GIVCOL a
201*> level's Givens rotations are stored. GIVPTR(i+1) - GIVPTR(i)
202*> indicates the number of Givens rotations.
203*> \endverbatim
204*>
205*> \param[in] GIVCOL
206*> \verbatim
207*> GIVCOL is INTEGER array, dimension (2, N lg N)
208*> Each pair of numbers indicates a pair of columns to take place
209*> in a Givens rotation.
210*> \endverbatim
211*>
212*> \param[in] GIVNUM
213*> \verbatim
214*> GIVNUM is REAL array, dimension (2, N lg N)
215*> Each number indicates the S value to be used in the
216*> corresponding Givens rotation.
217*> \endverbatim
218*>
219*> \param[out] WORK
220*> \verbatim
221*> WORK is REAL array, dimension (3*N+2*QSIZ*N)
222*> \endverbatim
223*>
224*> \param[out] IWORK
225*> \verbatim
226*> IWORK is INTEGER array, dimension (4*N)
227*> \endverbatim
228*>
229*> \param[out] INFO
230*> \verbatim
231*> INFO is INTEGER
232*> = 0: successful exit.
233*> < 0: if INFO = -i, the i-th argument had an illegal value.
234*> > 0: if INFO = 1, an eigenvalue did not converge
235*> \endverbatim
236*
237* Authors:
238* ========
239*
240*> \author Univ. of Tennessee
241*> \author Univ. of California Berkeley
242*> \author Univ. of Colorado Denver
243*> \author NAG Ltd.
244*
245*> \ingroup laed7
246*
247*> \par Contributors:
248* ==================
249*>
250*> Jeff Rutter, Computer Science Division, University of California
251*> at Berkeley, USA
252*
253* =====================================================================
254 SUBROUTINE slaed7( ICOMPQ, N, QSIZ, TLVLS, CURLVL, CURPBM, D,
255 $ Q,
256 $ LDQ, INDXQ, RHO, CUTPNT, QSTORE, QPTR, PRMPTR,
257 $ PERM, GIVPTR, GIVCOL, GIVNUM, WORK, IWORK,
258 $ INFO )
259*
260* -- LAPACK computational routine --
261* -- LAPACK is a software package provided by Univ. of Tennessee, --
262* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
263*
264* .. Scalar Arguments ..
265 INTEGER CURLVL, CURPBM, CUTPNT, ICOMPQ, INFO, LDQ, N,
266 $ QSIZ, TLVLS
267 REAL RHO
268* ..
269* .. Array Arguments ..
270 INTEGER GIVCOL( 2, * ), GIVPTR( * ), INDXQ( * ),
271 $ iwork( * ), perm( * ), prmptr( * ), qptr( * )
272 REAL D( * ), GIVNUM( 2, * ), Q( LDQ, * ),
273 $ QSTORE( * ), WORK( * )
274* ..
275*
276* =====================================================================
277*
278* .. Parameters ..
279 REAL ONE, ZERO
280 PARAMETER ( ONE = 1.0e0, zero = 0.0e0 )
281* ..
282* .. Local Scalars ..
283 INTEGER COLTYP, CURR, I, IDLMDA, INDX, INDXC, INDXP,
284 $ iq2, is, iw, iz, k, ldq2, n1, n2, ptr
285* ..
286* .. External Subroutines ..
287 EXTERNAL sgemm, slaed8, slaed9, slaeda, slamrg,
288 $ xerbla
289* ..
290* .. Intrinsic Functions ..
291 INTRINSIC max, min
292* ..
293* .. Executable Statements ..
294*
295* Test the input parameters.
296*
297 info = 0
298*
299 IF( icompq.LT.0 .OR. icompq.GT.1 ) THEN
300 info = -1
301 ELSE IF( n.LT.0 ) THEN
302 info = -2
303 ELSE IF( icompq.EQ.1 .AND. qsiz.LT.n ) THEN
304 info = -3
305 ELSE IF( ldq.LT.max( 1, n ) ) THEN
306 info = -9
307 ELSE IF( min( 1, n ).GT.cutpnt .OR. n.LT.cutpnt ) THEN
308 info = -12
309 END IF
310 IF( info.NE.0 ) THEN
311 CALL xerbla( 'SLAED7', -info )
312 RETURN
313 END IF
314*
315* Quick return if possible
316*
317 IF( n.EQ.0 )
318 $ RETURN
319*
320* The following values are for bookkeeping purposes only. They are
321* integer pointers which indicate the portion of the workspace
322* used by a particular array in SLAED8 and SLAED9.
323*
324 IF( icompq.EQ.1 ) THEN
325 ldq2 = qsiz
326 ELSE
327 ldq2 = n
328 END IF
329*
330 iz = 1
331 idlmda = iz + n
332 iw = idlmda + n
333 iq2 = iw + n
334 is = iq2 + n*ldq2
335*
336 indx = 1
337 indxc = indx + n
338 coltyp = indxc + n
339 indxp = coltyp + n
340*
341* Form the z-vector which consists of the last row of Q_1 and the
342* first row of Q_2.
343*
344 ptr = 1 + 2**tlvls
345 DO 10 i = 1, curlvl - 1
346 ptr = ptr + 2**( tlvls-i )
347 10 CONTINUE
348 curr = ptr + curpbm
349 CALL slaeda( n, tlvls, curlvl, curpbm, prmptr, perm, givptr,
350 $ givcol, givnum, qstore, qptr, work( iz ),
351 $ work( iz+n ), info )
352*
353* When solving the final problem, we no longer need the stored data,
354* so we will overwrite the data from this level onto the previously
355* used storage space.
356*
357 IF( curlvl.EQ.tlvls ) THEN
358 qptr( curr ) = 1
359 prmptr( curr ) = 1
360 givptr( curr ) = 1
361 END IF
362*
363* Sort and Deflate eigenvalues.
364*
365 CALL slaed8( icompq, k, n, qsiz, d, q, ldq, indxq, rho, cutpnt,
366 $ work( iz ), work( idlmda ), work( iq2 ), ldq2,
367 $ work( iw ), perm( prmptr( curr ) ), givptr( curr+1 ),
368 $ givcol( 1, givptr( curr ) ),
369 $ givnum( 1, givptr( curr ) ), iwork( indxp ),
370 $ iwork( indx ), info )
371 prmptr( curr+1 ) = prmptr( curr ) + n
372 givptr( curr+1 ) = givptr( curr+1 ) + givptr( curr )
373*
374* Solve Secular Equation.
375*
376 IF( k.NE.0 ) THEN
377 CALL slaed9( k, 1, k, n, d, work( is ), k, rho,
378 $ work( idlmda ),
379 $ work( iw ), qstore( qptr( curr ) ), k, info )
380 IF( info.NE.0 )
381 $ GO TO 30
382 IF( icompq.EQ.1 ) THEN
383 CALL sgemm( 'N', 'N', qsiz, k, k, one, work( iq2 ), ldq2,
384 $ qstore( qptr( curr ) ), k, zero, q, ldq )
385 END IF
386 qptr( curr+1 ) = qptr( curr ) + k**2
387*
388* Prepare the INDXQ sorting permutation.
389*
390 n1 = k
391 n2 = n - k
392 CALL slamrg( n1, n2, d, 1, -1, indxq )
393 ELSE
394 qptr( curr+1 ) = qptr( curr )
395 DO 20 i = 1, n
396 indxq( i ) = i
397 20 CONTINUE
398 END IF
399*
400 30 CONTINUE
401 RETURN
402*
403* End of SLAED7
404*
405 END
subroutine xerbla(srname, info)
Definition cblat2.f:3285
subroutine sgemm(transa, transb, m, n, k, alpha, a, lda, b, ldb, beta, c, ldc)
SGEMM
Definition sgemm.f:188
subroutine slaed7(icompq, n, qsiz, tlvls, curlvl, curpbm, d, q, ldq, indxq, rho, cutpnt, qstore, qptr, prmptr, perm, givptr, givcol, givnum, work, iwork, info)
SLAED7 used by SSTEDC. Computes the updated eigensystem of a diagonal matrix after modification by a ...
Definition slaed7.f:259
subroutine slaed8(icompq, k, n, qsiz, d, q, ldq, indxq, rho, cutpnt, z, dlambda, q2, ldq2, w, perm, givptr, givcol, givnum, indxp, indx, info)
SLAED8 used by SSTEDC. Merges eigenvalues and deflates secular equation. Used when the original matri...
Definition slaed8.f:241
subroutine slaed9(k, kstart, kstop, n, d, q, ldq, rho, dlambda, w, s, lds, info)
SLAED9 used by SSTEDC. Finds the roots of the secular equation and updates the eigenvectors....
Definition slaed9.f:155
subroutine slaeda(n, tlvls, curlvl, curpbm, prmptr, perm, givptr, givcol, givnum, q, qptr, z, ztemp, info)
SLAEDA used by SSTEDC. Computes the Z vector determining the rank-one modification of the diagonal ma...
Definition slaeda.f:165
subroutine slamrg(n1, n2, a, strd1, strd2, index)
SLAMRG creates a permutation list to merge the entries of two independently sorted sets into a single...
Definition slamrg.f:97