00001 SUBROUTINE ZLAED0( QSIZ, N, D, E, Q, LDQ, QSTORE, LDQS, RWORK,
00002 $ IWORK, INFO )
00003
00004
00005
00006
00007
00008
00009
00010 INTEGER INFO, LDQ, LDQS, N, QSIZ
00011
00012
00013 INTEGER IWORK( * )
00014 DOUBLE PRECISION D( * ), E( * ), RWORK( * )
00015 COMPLEX*16 Q( LDQ, * ), QSTORE( LDQS, * )
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085 DOUBLE PRECISION TWO
00086 PARAMETER ( TWO = 2.D+0 )
00087
00088
00089 INTEGER CURLVL, CURPRB, CURR, I, IGIVCL, IGIVNM,
00090 $ IGIVPT, INDXQ, IPERM, IPRMPT, IQ, IQPTR, IWREM,
00091 $ J, K, LGN, LL, MATSIZ, MSD2, SMLSIZ, SMM1,
00092 $ SPM1, SPM2, SUBMAT, SUBPBS, TLVLS
00093 DOUBLE PRECISION TEMP
00094
00095
00096 EXTERNAL DCOPY, DSTEQR, XERBLA, ZCOPY, ZLACRM, ZLAED7
00097
00098
00099 INTEGER ILAENV
00100 EXTERNAL ILAENV
00101
00102
00103 INTRINSIC ABS, DBLE, INT, LOG, MAX
00104
00105
00106
00107
00108
00109 INFO = 0
00110
00111
00112
00113
00114
00115 IF( QSIZ.LT.MAX( 0, N ) ) THEN
00116 INFO = -1
00117 ELSE IF( N.LT.0 ) THEN
00118 INFO = -2
00119 ELSE IF( LDQ.LT.MAX( 1, N ) ) THEN
00120 INFO = -6
00121 ELSE IF( LDQS.LT.MAX( 1, N ) ) THEN
00122 INFO = -8
00123 END IF
00124 IF( INFO.NE.0 ) THEN
00125 CALL XERBLA( 'ZLAED0', -INFO )
00126 RETURN
00127 END IF
00128
00129
00130
00131 IF( N.EQ.0 )
00132 $ RETURN
00133
00134 SMLSIZ = ILAENV( 9, 'ZLAED0', ' ', 0, 0, 0, 0 )
00135
00136
00137
00138
00139 IWORK( 1 ) = N
00140 SUBPBS = 1
00141 TLVLS = 0
00142 10 CONTINUE
00143 IF( IWORK( SUBPBS ).GT.SMLSIZ ) THEN
00144 DO 20 J = SUBPBS, 1, -1
00145 IWORK( 2*J ) = ( IWORK( J )+1 ) / 2
00146 IWORK( 2*J-1 ) = IWORK( J ) / 2
00147 20 CONTINUE
00148 TLVLS = TLVLS + 1
00149 SUBPBS = 2*SUBPBS
00150 GO TO 10
00151 END IF
00152 DO 30 J = 2, SUBPBS
00153 IWORK( J ) = IWORK( J ) + IWORK( J-1 )
00154 30 CONTINUE
00155
00156
00157
00158
00159 SPM1 = SUBPBS - 1
00160 DO 40 I = 1, SPM1
00161 SUBMAT = IWORK( I ) + 1
00162 SMM1 = SUBMAT - 1
00163 D( SMM1 ) = D( SMM1 ) - ABS( E( SMM1 ) )
00164 D( SUBMAT ) = D( SUBMAT ) - ABS( E( SMM1 ) )
00165 40 CONTINUE
00166
00167 INDXQ = 4*N + 3
00168
00169
00170
00171
00172 TEMP = LOG( DBLE( N ) ) / LOG( TWO )
00173 LGN = INT( TEMP )
00174 IF( 2**LGN.LT.N )
00175 $ LGN = LGN + 1
00176 IF( 2**LGN.LT.N )
00177 $ LGN = LGN + 1
00178 IPRMPT = INDXQ + N + 1
00179 IPERM = IPRMPT + N*LGN
00180 IQPTR = IPERM + N*LGN
00181 IGIVPT = IQPTR + N + 2
00182 IGIVCL = IGIVPT + N*LGN
00183
00184 IGIVNM = 1
00185 IQ = IGIVNM + 2*N*LGN
00186 IWREM = IQ + N**2 + 1
00187
00188 DO 50 I = 0, SUBPBS
00189 IWORK( IPRMPT+I ) = 1
00190 IWORK( IGIVPT+I ) = 1
00191 50 CONTINUE
00192 IWORK( IQPTR ) = 1
00193
00194
00195
00196
00197 CURR = 0
00198 DO 70 I = 0, SPM1
00199 IF( I.EQ.0 ) THEN
00200 SUBMAT = 1
00201 MATSIZ = IWORK( 1 )
00202 ELSE
00203 SUBMAT = IWORK( I ) + 1
00204 MATSIZ = IWORK( I+1 ) - IWORK( I )
00205 END IF
00206 LL = IQ - 1 + IWORK( IQPTR+CURR )
00207 CALL DSTEQR( 'I', MATSIZ, D( SUBMAT ), E( SUBMAT ),
00208 $ RWORK( LL ), MATSIZ, RWORK, INFO )
00209 CALL ZLACRM( QSIZ, MATSIZ, Q( 1, SUBMAT ), LDQ, RWORK( LL ),
00210 $ MATSIZ, QSTORE( 1, SUBMAT ), LDQS,
00211 $ RWORK( IWREM ) )
00212 IWORK( IQPTR+CURR+1 ) = IWORK( IQPTR+CURR ) + MATSIZ**2
00213 CURR = CURR + 1
00214 IF( INFO.GT.0 ) THEN
00215 INFO = SUBMAT*( N+1 ) + SUBMAT + MATSIZ - 1
00216 RETURN
00217 END IF
00218 K = 1
00219 DO 60 J = SUBMAT, IWORK( I+1 )
00220 IWORK( INDXQ+J ) = K
00221 K = K + 1
00222 60 CONTINUE
00223 70 CONTINUE
00224
00225
00226
00227
00228
00229
00230 CURLVL = 1
00231 80 CONTINUE
00232 IF( SUBPBS.GT.1 ) THEN
00233 SPM2 = SUBPBS - 2
00234 DO 90 I = 0, SPM2, 2
00235 IF( I.EQ.0 ) THEN
00236 SUBMAT = 1
00237 MATSIZ = IWORK( 2 )
00238 MSD2 = IWORK( 1 )
00239 CURPRB = 0
00240 ELSE
00241 SUBMAT = IWORK( I ) + 1
00242 MATSIZ = IWORK( I+2 ) - IWORK( I )
00243 MSD2 = MATSIZ / 2
00244 CURPRB = CURPRB + 1
00245 END IF
00246
00247
00248
00249
00250
00251
00252
00253
00254 CALL ZLAED7( MATSIZ, MSD2, QSIZ, TLVLS, CURLVL, CURPRB,
00255 $ D( SUBMAT ), QSTORE( 1, SUBMAT ), LDQS,
00256 $ E( SUBMAT+MSD2-1 ), IWORK( INDXQ+SUBMAT ),
00257 $ RWORK( IQ ), IWORK( IQPTR ), IWORK( IPRMPT ),
00258 $ IWORK( IPERM ), IWORK( IGIVPT ),
00259 $ IWORK( IGIVCL ), RWORK( IGIVNM ),
00260 $ Q( 1, SUBMAT ), RWORK( IWREM ),
00261 $ IWORK( SUBPBS+1 ), INFO )
00262 IF( INFO.GT.0 ) THEN
00263 INFO = SUBMAT*( N+1 ) + SUBMAT + MATSIZ - 1
00264 RETURN
00265 END IF
00266 IWORK( I / 2+1 ) = IWORK( I+2 )
00267 90 CONTINUE
00268 SUBPBS = SUBPBS / 2
00269 CURLVL = CURLVL + 1
00270 GO TO 80
00271 END IF
00272
00273
00274
00275
00276
00277
00278 DO 100 I = 1, N
00279 J = IWORK( INDXQ+I )
00280 RWORK( I ) = D( J )
00281 CALL ZCOPY( QSIZ, QSTORE( 1, J ), 1, Q( 1, I ), 1 )
00282 100 CONTINUE
00283 CALL DCOPY( N, RWORK, 1, D, 1 )
00284
00285 RETURN
00286
00287
00288
00289 END