00001 SUBROUTINE DLASDA( ICOMPQ, SMLSIZ, N, SQRE, D, E, U, LDU, VT, K,
00002 $ DIFL, DIFR, Z, POLES, GIVPTR, GIVCOL, LDGCOL,
00003 $ PERM, GIVNUM, C, S, WORK, IWORK, INFO )
00004
00005
00006
00007
00008
00009
00010
00011 INTEGER ICOMPQ, INFO, LDGCOL, LDU, N, SMLSIZ, SQRE
00012
00013
00014 INTEGER GIVCOL( LDGCOL, * ), GIVPTR( * ), IWORK( * ),
00015 $ K( * ), PERM( LDGCOL, * )
00016 DOUBLE PRECISION C( * ), D( * ), DIFL( LDU, * ), DIFR( LDU, * ),
00017 $ E( * ), GIVNUM( LDU, * ), POLES( LDU, * ),
00018 $ S( * ), U( LDU, * ), VT( LDU, * ), WORK( * ),
00019 $ Z( LDU, * )
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
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173 DOUBLE PRECISION ZERO, ONE
00174 PARAMETER ( ZERO = 0.0D+0, ONE = 1.0D+0 )
00175
00176
00177 INTEGER I, I1, IC, IDXQ, IDXQI, IM1, INODE, ITEMP, IWK,
00178 $ J, LF, LL, LVL, LVL2, M, NCC, ND, NDB1, NDIML,
00179 $ NDIMR, NL, NLF, NLP1, NLVL, NR, NRF, NRP1, NRU,
00180 $ NWORK1, NWORK2, SMLSZP, SQREI, VF, VFI, VL, VLI
00181 DOUBLE PRECISION ALPHA, BETA
00182
00183
00184 EXTERNAL DCOPY, DLASD6, DLASDQ, DLASDT, DLASET, XERBLA
00185
00186
00187
00188
00189
00190 INFO = 0
00191
00192 IF( ( ICOMPQ.LT.0 ) .OR. ( ICOMPQ.GT.1 ) ) THEN
00193 INFO = -1
00194 ELSE IF( SMLSIZ.LT.3 ) THEN
00195 INFO = -2
00196 ELSE IF( N.LT.0 ) THEN
00197 INFO = -3
00198 ELSE IF( ( SQRE.LT.0 ) .OR. ( SQRE.GT.1 ) ) THEN
00199 INFO = -4
00200 ELSE IF( LDU.LT.( N+SQRE ) ) THEN
00201 INFO = -8
00202 ELSE IF( LDGCOL.LT.N ) THEN
00203 INFO = -17
00204 END IF
00205 IF( INFO.NE.0 ) THEN
00206 CALL XERBLA( 'DLASDA', -INFO )
00207 RETURN
00208 END IF
00209
00210 M = N + SQRE
00211
00212
00213
00214 IF( N.LE.SMLSIZ ) THEN
00215 IF( ICOMPQ.EQ.0 ) THEN
00216 CALL DLASDQ( 'U', SQRE, N, 0, 0, 0, D, E, VT, LDU, U, LDU,
00217 $ U, LDU, WORK, INFO )
00218 ELSE
00219 CALL DLASDQ( 'U', SQRE, N, M, N, 0, D, E, VT, LDU, U, LDU,
00220 $ U, LDU, WORK, INFO )
00221 END IF
00222 RETURN
00223 END IF
00224
00225
00226
00227 INODE = 1
00228 NDIML = INODE + N
00229 NDIMR = NDIML + N
00230 IDXQ = NDIMR + N
00231 IWK = IDXQ + N
00232
00233 NCC = 0
00234 NRU = 0
00235
00236 SMLSZP = SMLSIZ + 1
00237 VF = 1
00238 VL = VF + M
00239 NWORK1 = VL + M
00240 NWORK2 = NWORK1 + SMLSZP*SMLSZP
00241
00242 CALL DLASDT( N, NLVL, ND, IWORK( INODE ), IWORK( NDIML ),
00243 $ IWORK( NDIMR ), SMLSIZ )
00244
00245
00246
00247
00248 NDB1 = ( ND+1 ) / 2
00249 DO 30 I = NDB1, ND
00250
00251
00252
00253
00254
00255
00256
00257 I1 = I - 1
00258 IC = IWORK( INODE+I1 )
00259 NL = IWORK( NDIML+I1 )
00260 NLP1 = NL + 1
00261 NR = IWORK( NDIMR+I1 )
00262 NLF = IC - NL
00263 NRF = IC + 1
00264 IDXQI = IDXQ + NLF - 2
00265 VFI = VF + NLF - 1
00266 VLI = VL + NLF - 1
00267 SQREI = 1
00268 IF( ICOMPQ.EQ.0 ) THEN
00269 CALL DLASET( 'A', NLP1, NLP1, ZERO, ONE, WORK( NWORK1 ),
00270 $ SMLSZP )
00271 CALL DLASDQ( 'U', SQREI, NL, NLP1, NRU, NCC, D( NLF ),
00272 $ E( NLF ), WORK( NWORK1 ), SMLSZP,
00273 $ WORK( NWORK2 ), NL, WORK( NWORK2 ), NL,
00274 $ WORK( NWORK2 ), INFO )
00275 ITEMP = NWORK1 + NL*SMLSZP
00276 CALL DCOPY( NLP1, WORK( NWORK1 ), 1, WORK( VFI ), 1 )
00277 CALL DCOPY( NLP1, WORK( ITEMP ), 1, WORK( VLI ), 1 )
00278 ELSE
00279 CALL DLASET( 'A', NL, NL, ZERO, ONE, U( NLF, 1 ), LDU )
00280 CALL DLASET( 'A', NLP1, NLP1, ZERO, ONE, VT( NLF, 1 ), LDU )
00281 CALL DLASDQ( 'U', SQREI, NL, NLP1, NL, NCC, D( NLF ),
00282 $ E( NLF ), VT( NLF, 1 ), LDU, U( NLF, 1 ), LDU,
00283 $ U( NLF, 1 ), LDU, WORK( NWORK1 ), INFO )
00284 CALL DCOPY( NLP1, VT( NLF, 1 ), 1, WORK( VFI ), 1 )
00285 CALL DCOPY( NLP1, VT( NLF, NLP1 ), 1, WORK( VLI ), 1 )
00286 END IF
00287 IF( INFO.NE.0 ) THEN
00288 RETURN
00289 END IF
00290 DO 10 J = 1, NL
00291 IWORK( IDXQI+J ) = J
00292 10 CONTINUE
00293 IF( ( I.EQ.ND ) .AND. ( SQRE.EQ.0 ) ) THEN
00294 SQREI = 0
00295 ELSE
00296 SQREI = 1
00297 END IF
00298 IDXQI = IDXQI + NLP1
00299 VFI = VFI + NLP1
00300 VLI = VLI + NLP1
00301 NRP1 = NR + SQREI
00302 IF( ICOMPQ.EQ.0 ) THEN
00303 CALL DLASET( 'A', NRP1, NRP1, ZERO, ONE, WORK( NWORK1 ),
00304 $ SMLSZP )
00305 CALL DLASDQ( 'U', SQREI, NR, NRP1, NRU, NCC, D( NRF ),
00306 $ E( NRF ), WORK( NWORK1 ), SMLSZP,
00307 $ WORK( NWORK2 ), NR, WORK( NWORK2 ), NR,
00308 $ WORK( NWORK2 ), INFO )
00309 ITEMP = NWORK1 + ( NRP1-1 )*SMLSZP
00310 CALL DCOPY( NRP1, WORK( NWORK1 ), 1, WORK( VFI ), 1 )
00311 CALL DCOPY( NRP1, WORK( ITEMP ), 1, WORK( VLI ), 1 )
00312 ELSE
00313 CALL DLASET( 'A', NR, NR, ZERO, ONE, U( NRF, 1 ), LDU )
00314 CALL DLASET( 'A', NRP1, NRP1, ZERO, ONE, VT( NRF, 1 ), LDU )
00315 CALL DLASDQ( 'U', SQREI, NR, NRP1, NR, NCC, D( NRF ),
00316 $ E( NRF ), VT( NRF, 1 ), LDU, U( NRF, 1 ), LDU,
00317 $ U( NRF, 1 ), LDU, WORK( NWORK1 ), INFO )
00318 CALL DCOPY( NRP1, VT( NRF, 1 ), 1, WORK( VFI ), 1 )
00319 CALL DCOPY( NRP1, VT( NRF, NRP1 ), 1, WORK( VLI ), 1 )
00320 END IF
00321 IF( INFO.NE.0 ) THEN
00322 RETURN
00323 END IF
00324 DO 20 J = 1, NR
00325 IWORK( IDXQI+J ) = J
00326 20 CONTINUE
00327 30 CONTINUE
00328
00329
00330
00331 J = 2**NLVL
00332 DO 50 LVL = NLVL, 1, -1
00333 LVL2 = LVL*2 - 1
00334
00335
00336
00337
00338 IF( LVL.EQ.1 ) THEN
00339 LF = 1
00340 LL = 1
00341 ELSE
00342 LF = 2**( LVL-1 )
00343 LL = 2*LF - 1
00344 END IF
00345 DO 40 I = LF, LL
00346 IM1 = I - 1
00347 IC = IWORK( INODE+IM1 )
00348 NL = IWORK( NDIML+IM1 )
00349 NR = IWORK( NDIMR+IM1 )
00350 NLF = IC - NL
00351 NRF = IC + 1
00352 IF( I.EQ.LL ) THEN
00353 SQREI = SQRE
00354 ELSE
00355 SQREI = 1
00356 END IF
00357 VFI = VF + NLF - 1
00358 VLI = VL + NLF - 1
00359 IDXQI = IDXQ + NLF - 1
00360 ALPHA = D( IC )
00361 BETA = E( IC )
00362 IF( ICOMPQ.EQ.0 ) THEN
00363 CALL DLASD6( ICOMPQ, NL, NR, SQREI, D( NLF ),
00364 $ WORK( VFI ), WORK( VLI ), ALPHA, BETA,
00365 $ IWORK( IDXQI ), PERM, GIVPTR( 1 ), GIVCOL,
00366 $ LDGCOL, GIVNUM, LDU, POLES, DIFL, DIFR, Z,
00367 $ K( 1 ), C( 1 ), S( 1 ), WORK( NWORK1 ),
00368 $ IWORK( IWK ), INFO )
00369 ELSE
00370 J = J - 1
00371 CALL DLASD6( ICOMPQ, NL, NR, SQREI, D( NLF ),
00372 $ WORK( VFI ), WORK( VLI ), ALPHA, BETA,
00373 $ IWORK( IDXQI ), PERM( NLF, LVL ),
00374 $ GIVPTR( J ), GIVCOL( NLF, LVL2 ), LDGCOL,
00375 $ GIVNUM( NLF, LVL2 ), LDU,
00376 $ POLES( NLF, LVL2 ), DIFL( NLF, LVL ),
00377 $ DIFR( NLF, LVL2 ), Z( NLF, LVL ), K( J ),
00378 $ C( J ), S( J ), WORK( NWORK1 ),
00379 $ IWORK( IWK ), INFO )
00380 END IF
00381 IF( INFO.NE.0 ) THEN
00382 RETURN
00383 END IF
00384 40 CONTINUE
00385 50 CONTINUE
00386
00387 RETURN
00388
00389
00390
00391 END