00001 SUBROUTINE SLASDA( 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 REAL 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 REAL ZERO, ONE
00173 PARAMETER ( ZERO = 0.0E+0, ONE = 1.0E+0 )
00174
00175
00176 INTEGER I, I1, IC, IDXQ, IDXQI, IM1, INODE, ITEMP, IWK,
00177 $ J, LF, LL, LVL, LVL2, M, NCC, ND, NDB1, NDIML,
00178 $ NDIMR, NL, NLF, NLP1, NLVL, NR, NRF, NRP1, NRU,
00179 $ NWORK1, NWORK2, SMLSZP, SQREI, VF, VFI, VL, VLI
00180 REAL ALPHA, BETA
00181
00182
00183 EXTERNAL SCOPY, SLASD6, SLASDQ, SLASDT, SLASET, XERBLA
00184
00185
00186
00187
00188
00189 INFO = 0
00190
00191 IF( ( ICOMPQ.LT.0 ) .OR. ( ICOMPQ.GT.1 ) ) THEN
00192 INFO = -1
00193 ELSE IF( SMLSIZ.LT.3 ) THEN
00194 INFO = -2
00195 ELSE IF( N.LT.0 ) THEN
00196 INFO = -3
00197 ELSE IF( ( SQRE.LT.0 ) .OR. ( SQRE.GT.1 ) ) THEN
00198 INFO = -4
00199 ELSE IF( LDU.LT.( N+SQRE ) ) THEN
00200 INFO = -8
00201 ELSE IF( LDGCOL.LT.N ) THEN
00202 INFO = -17
00203 END IF
00204 IF( INFO.NE.0 ) THEN
00205 CALL XERBLA( 'SLASDA', -INFO )
00206 RETURN
00207 END IF
00208
00209 M = N + SQRE
00210
00211
00212
00213 IF( N.LE.SMLSIZ ) THEN
00214 IF( ICOMPQ.EQ.0 ) THEN
00215 CALL SLASDQ( 'U', SQRE, N, 0, 0, 0, D, E, VT, LDU, U, LDU,
00216 $ U, LDU, WORK, INFO )
00217 ELSE
00218 CALL SLASDQ( 'U', SQRE, N, M, N, 0, D, E, VT, LDU, U, LDU,
00219 $ U, LDU, WORK, INFO )
00220 END IF
00221 RETURN
00222 END IF
00223
00224
00225
00226 INODE = 1
00227 NDIML = INODE + N
00228 NDIMR = NDIML + N
00229 IDXQ = NDIMR + N
00230 IWK = IDXQ + N
00231
00232 NCC = 0
00233 NRU = 0
00234
00235 SMLSZP = SMLSIZ + 1
00236 VF = 1
00237 VL = VF + M
00238 NWORK1 = VL + M
00239 NWORK2 = NWORK1 + SMLSZP*SMLSZP
00240
00241 CALL SLASDT( N, NLVL, ND, IWORK( INODE ), IWORK( NDIML ),
00242 $ IWORK( NDIMR ), SMLSIZ )
00243
00244
00245
00246
00247 NDB1 = ( ND+1 ) / 2
00248 DO 30 I = NDB1, ND
00249
00250
00251
00252
00253
00254
00255
00256 I1 = I - 1
00257 IC = IWORK( INODE+I1 )
00258 NL = IWORK( NDIML+I1 )
00259 NLP1 = NL + 1
00260 NR = IWORK( NDIMR+I1 )
00261 NLF = IC - NL
00262 NRF = IC + 1
00263 IDXQI = IDXQ + NLF - 2
00264 VFI = VF + NLF - 1
00265 VLI = VL + NLF - 1
00266 SQREI = 1
00267 IF( ICOMPQ.EQ.0 ) THEN
00268 CALL SLASET( 'A', NLP1, NLP1, ZERO, ONE, WORK( NWORK1 ),
00269 $ SMLSZP )
00270 CALL SLASDQ( 'U', SQREI, NL, NLP1, NRU, NCC, D( NLF ),
00271 $ E( NLF ), WORK( NWORK1 ), SMLSZP,
00272 $ WORK( NWORK2 ), NL, WORK( NWORK2 ), NL,
00273 $ WORK( NWORK2 ), INFO )
00274 ITEMP = NWORK1 + NL*SMLSZP
00275 CALL SCOPY( NLP1, WORK( NWORK1 ), 1, WORK( VFI ), 1 )
00276 CALL SCOPY( NLP1, WORK( ITEMP ), 1, WORK( VLI ), 1 )
00277 ELSE
00278 CALL SLASET( 'A', NL, NL, ZERO, ONE, U( NLF, 1 ), LDU )
00279 CALL SLASET( 'A', NLP1, NLP1, ZERO, ONE, VT( NLF, 1 ), LDU )
00280 CALL SLASDQ( 'U', SQREI, NL, NLP1, NL, NCC, D( NLF ),
00281 $ E( NLF ), VT( NLF, 1 ), LDU, U( NLF, 1 ), LDU,
00282 $ U( NLF, 1 ), LDU, WORK( NWORK1 ), INFO )
00283 CALL SCOPY( NLP1, VT( NLF, 1 ), 1, WORK( VFI ), 1 )
00284 CALL SCOPY( NLP1, VT( NLF, NLP1 ), 1, WORK( VLI ), 1 )
00285 END IF
00286 IF( INFO.NE.0 ) THEN
00287 RETURN
00288 END IF
00289 DO 10 J = 1, NL
00290 IWORK( IDXQI+J ) = J
00291 10 CONTINUE
00292 IF( ( I.EQ.ND ) .AND. ( SQRE.EQ.0 ) ) THEN
00293 SQREI = 0
00294 ELSE
00295 SQREI = 1
00296 END IF
00297 IDXQI = IDXQI + NLP1
00298 VFI = VFI + NLP1
00299 VLI = VLI + NLP1
00300 NRP1 = NR + SQREI
00301 IF( ICOMPQ.EQ.0 ) THEN
00302 CALL SLASET( 'A', NRP1, NRP1, ZERO, ONE, WORK( NWORK1 ),
00303 $ SMLSZP )
00304 CALL SLASDQ( 'U', SQREI, NR, NRP1, NRU, NCC, D( NRF ),
00305 $ E( NRF ), WORK( NWORK1 ), SMLSZP,
00306 $ WORK( NWORK2 ), NR, WORK( NWORK2 ), NR,
00307 $ WORK( NWORK2 ), INFO )
00308 ITEMP = NWORK1 + ( NRP1-1 )*SMLSZP
00309 CALL SCOPY( NRP1, WORK( NWORK1 ), 1, WORK( VFI ), 1 )
00310 CALL SCOPY( NRP1, WORK( ITEMP ), 1, WORK( VLI ), 1 )
00311 ELSE
00312 CALL SLASET( 'A', NR, NR, ZERO, ONE, U( NRF, 1 ), LDU )
00313 CALL SLASET( 'A', NRP1, NRP1, ZERO, ONE, VT( NRF, 1 ), LDU )
00314 CALL SLASDQ( 'U', SQREI, NR, NRP1, NR, NCC, D( NRF ),
00315 $ E( NRF ), VT( NRF, 1 ), LDU, U( NRF, 1 ), LDU,
00316 $ U( NRF, 1 ), LDU, WORK( NWORK1 ), INFO )
00317 CALL SCOPY( NRP1, VT( NRF, 1 ), 1, WORK( VFI ), 1 )
00318 CALL SCOPY( NRP1, VT( NRF, NRP1 ), 1, WORK( VLI ), 1 )
00319 END IF
00320 IF( INFO.NE.0 ) THEN
00321 RETURN
00322 END IF
00323 DO 20 J = 1, NR
00324 IWORK( IDXQI+J ) = J
00325 20 CONTINUE
00326 30 CONTINUE
00327
00328
00329
00330 J = 2**NLVL
00331 DO 50 LVL = NLVL, 1, -1
00332 LVL2 = LVL*2 - 1
00333
00334
00335
00336
00337 IF( LVL.EQ.1 ) THEN
00338 LF = 1
00339 LL = 1
00340 ELSE
00341 LF = 2**( LVL-1 )
00342 LL = 2*LF - 1
00343 END IF
00344 DO 40 I = LF, LL
00345 IM1 = I - 1
00346 IC = IWORK( INODE+IM1 )
00347 NL = IWORK( NDIML+IM1 )
00348 NR = IWORK( NDIMR+IM1 )
00349 NLF = IC - NL
00350 NRF = IC + 1
00351 IF( I.EQ.LL ) THEN
00352 SQREI = SQRE
00353 ELSE
00354 SQREI = 1
00355 END IF
00356 VFI = VF + NLF - 1
00357 VLI = VL + NLF - 1
00358 IDXQI = IDXQ + NLF - 1
00359 ALPHA = D( IC )
00360 BETA = E( IC )
00361 IF( ICOMPQ.EQ.0 ) THEN
00362 CALL SLASD6( ICOMPQ, NL, NR, SQREI, D( NLF ),
00363 $ WORK( VFI ), WORK( VLI ), ALPHA, BETA,
00364 $ IWORK( IDXQI ), PERM, GIVPTR( 1 ), GIVCOL,
00365 $ LDGCOL, GIVNUM, LDU, POLES, DIFL, DIFR, Z,
00366 $ K( 1 ), C( 1 ), S( 1 ), WORK( NWORK1 ),
00367 $ IWORK( IWK ), INFO )
00368 ELSE
00369 J = J - 1
00370 CALL SLASD6( ICOMPQ, NL, NR, SQREI, D( NLF ),
00371 $ WORK( VFI ), WORK( VLI ), ALPHA, BETA,
00372 $ IWORK( IDXQI ), PERM( NLF, LVL ),
00373 $ GIVPTR( J ), GIVCOL( NLF, LVL2 ), LDGCOL,
00374 $ GIVNUM( NLF, LVL2 ), LDU,
00375 $ POLES( NLF, LVL2 ), DIFL( NLF, LVL ),
00376 $ DIFR( NLF, LVL2 ), Z( NLF, LVL ), K( J ),
00377 $ C( J ), S( J ), WORK( NWORK1 ),
00378 $ IWORK( IWK ), INFO )
00379 END IF
00380 IF( INFO.NE.0 ) THEN
00381 RETURN
00382 END IF
00383 40 CONTINUE
00384 50 CONTINUE
00385
00386 RETURN
00387
00388
00389
00390 END