00001 SUBROUTINE DORBDB( TRANS, SIGNS, M, P, Q, X11, LDX11, X12, LDX12,
00002 $ X21, LDX21, X22, LDX22, THETA, PHI, TAUP1,
00003 $ TAUP2, TAUQ1, TAUQ2, WORK, LWORK, INFO )
00004 IMPLICIT NONE
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 CHARACTER SIGNS, TRANS
00016 INTEGER INFO, LDX11, LDX12, LDX21, LDX22, LWORK, M, P,
00017 $ Q
00018
00019
00020 DOUBLE PRECISION PHI( * ), THETA( * )
00021 DOUBLE PRECISION TAUP1( * ), TAUP2( * ), TAUQ1( * ), TAUQ2( * ),
00022 $ WORK( * ), X11( LDX11, * ), X12( LDX12, * ),
00023 $ X21( LDX21, * ), X22( LDX22, * )
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
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192 DOUBLE PRECISION REALONE
00193 PARAMETER ( REALONE = 1.0D0 )
00194 DOUBLE PRECISION NEGONE, ONE
00195 PARAMETER ( NEGONE = -1.0D0, ONE = 1.0D0 )
00196
00197
00198 LOGICAL COLMAJOR, LQUERY
00199 INTEGER I, LWORKMIN, LWORKOPT
00200 DOUBLE PRECISION Z1, Z2, Z3, Z4
00201
00202
00203 EXTERNAL DAXPY, DLARF, DLARFGP, DSCAL, XERBLA
00204
00205
00206 DOUBLE PRECISION DNRM2
00207 LOGICAL LSAME
00208 EXTERNAL DNRM2, LSAME
00209
00210
00211 INTRINSIC ATAN2, COS, MAX, MIN, SIN
00212
00213
00214
00215
00216
00217 INFO = 0
00218 COLMAJOR = .NOT. LSAME( TRANS, 'T' )
00219 IF( .NOT. LSAME( SIGNS, 'O' ) ) THEN
00220 Z1 = REALONE
00221 Z2 = REALONE
00222 Z3 = REALONE
00223 Z4 = REALONE
00224 ELSE
00225 Z1 = REALONE
00226 Z2 = -REALONE
00227 Z3 = REALONE
00228 Z4 = -REALONE
00229 END IF
00230 LQUERY = LWORK .EQ. -1
00231
00232 IF( M .LT. 0 ) THEN
00233 INFO = -3
00234 ELSE IF( P .LT. 0 .OR. P .GT. M ) THEN
00235 INFO = -4
00236 ELSE IF( Q .LT. 0 .OR. Q .GT. P .OR. Q .GT. M-P .OR.
00237 $ Q .GT. M-Q ) THEN
00238 INFO = -5
00239 ELSE IF( COLMAJOR .AND. LDX11 .LT. MAX( 1, P ) ) THEN
00240 INFO = -7
00241 ELSE IF( .NOT.COLMAJOR .AND. LDX11 .LT. MAX( 1, Q ) ) THEN
00242 INFO = -7
00243 ELSE IF( COLMAJOR .AND. LDX12 .LT. MAX( 1, P ) ) THEN
00244 INFO = -9
00245 ELSE IF( .NOT.COLMAJOR .AND. LDX12 .LT. MAX( 1, M-Q ) ) THEN
00246 INFO = -9
00247 ELSE IF( COLMAJOR .AND. LDX21 .LT. MAX( 1, M-P ) ) THEN
00248 INFO = -11
00249 ELSE IF( .NOT.COLMAJOR .AND. LDX21 .LT. MAX( 1, Q ) ) THEN
00250 INFO = -11
00251 ELSE IF( COLMAJOR .AND. LDX22 .LT. MAX( 1, M-P ) ) THEN
00252 INFO = -13
00253 ELSE IF( .NOT.COLMAJOR .AND. LDX22 .LT. MAX( 1, M-Q ) ) THEN
00254 INFO = -13
00255 END IF
00256
00257
00258
00259 IF( INFO .EQ. 0 ) THEN
00260 LWORKOPT = M - Q
00261 LWORKMIN = M - Q
00262 WORK(1) = LWORKOPT
00263 IF( LWORK .LT. LWORKMIN .AND. .NOT. LQUERY ) THEN
00264 INFO = -21
00265 END IF
00266 END IF
00267 IF( INFO .NE. 0 ) THEN
00268 CALL XERBLA( 'xORBDB', -INFO )
00269 RETURN
00270 ELSE IF( LQUERY ) THEN
00271 RETURN
00272 END IF
00273
00274
00275
00276 IF( COLMAJOR ) THEN
00277
00278
00279
00280 DO I = 1, Q
00281
00282 IF( I .EQ. 1 ) THEN
00283 CALL DSCAL( P-I+1, Z1, X11(I,I), 1 )
00284 ELSE
00285 CALL DSCAL( P-I+1, Z1*COS(PHI(I-1)), X11(I,I), 1 )
00286 CALL DAXPY( P-I+1, -Z1*Z3*Z4*SIN(PHI(I-1)), X12(I,I-1),
00287 $ 1, X11(I,I), 1 )
00288 END IF
00289 IF( I .EQ. 1 ) THEN
00290 CALL DSCAL( M-P-I+1, Z2, X21(I,I), 1 )
00291 ELSE
00292 CALL DSCAL( M-P-I+1, Z2*COS(PHI(I-1)), X21(I,I), 1 )
00293 CALL DAXPY( M-P-I+1, -Z2*Z3*Z4*SIN(PHI(I-1)), X22(I,I-1),
00294 $ 1, X21(I,I), 1 )
00295 END IF
00296
00297 THETA(I) = ATAN2( DNRM2( M-P-I+1, X21(I,I), 1 ),
00298 $ DNRM2( P-I+1, X11(I,I), 1 ) )
00299
00300 CALL DLARFGP( P-I+1, X11(I,I), X11(I+1,I), 1, TAUP1(I) )
00301 X11(I,I) = ONE
00302 CALL DLARFGP( M-P-I+1, X21(I,I), X21(I+1,I), 1, TAUP2(I) )
00303 X21(I,I) = ONE
00304
00305 CALL DLARF( 'L', P-I+1, Q-I, X11(I,I), 1, TAUP1(I),
00306 $ X11(I,I+1), LDX11, WORK )
00307 CALL DLARF( 'L', P-I+1, M-Q-I+1, X11(I,I), 1, TAUP1(I),
00308 $ X12(I,I), LDX12, WORK )
00309 CALL DLARF( 'L', M-P-I+1, Q-I, X21(I,I), 1, TAUP2(I),
00310 $ X21(I,I+1), LDX21, WORK )
00311 CALL DLARF( 'L', M-P-I+1, M-Q-I+1, X21(I,I), 1, TAUP2(I),
00312 $ X22(I,I), LDX22, WORK )
00313
00314 IF( I .LT. Q ) THEN
00315 CALL DSCAL( Q-I, -Z1*Z3*SIN(THETA(I)), X11(I,I+1),
00316 $ LDX11 )
00317 CALL DAXPY( Q-I, Z2*Z3*COS(THETA(I)), X21(I,I+1), LDX21,
00318 $ X11(I,I+1), LDX11 )
00319 END IF
00320 CALL DSCAL( M-Q-I+1, -Z1*Z4*SIN(THETA(I)), X12(I,I), LDX12 )
00321 CALL DAXPY( M-Q-I+1, Z2*Z4*COS(THETA(I)), X22(I,I), LDX22,
00322 $ X12(I,I), LDX12 )
00323
00324 IF( I .LT. Q )
00325 $ PHI(I) = ATAN2( DNRM2( Q-I, X11(I,I+1), LDX11 ),
00326 $ DNRM2( M-Q-I+1, X12(I,I), LDX12 ) )
00327
00328 IF( I .LT. Q ) THEN
00329 CALL DLARFGP( Q-I, X11(I,I+1), X11(I,I+2), LDX11,
00330 $ TAUQ1(I) )
00331 X11(I,I+1) = ONE
00332 END IF
00333 CALL DLARFGP( M-Q-I+1, X12(I,I), X12(I,I+1), LDX12,
00334 $ TAUQ2(I) )
00335 X12(I,I) = ONE
00336
00337 IF( I .LT. Q ) THEN
00338 CALL DLARF( 'R', P-I, Q-I, X11(I,I+1), LDX11, TAUQ1(I),
00339 $ X11(I+1,I+1), LDX11, WORK )
00340 CALL DLARF( 'R', M-P-I, Q-I, X11(I,I+1), LDX11, TAUQ1(I),
00341 $ X21(I+1,I+1), LDX21, WORK )
00342 END IF
00343 CALL DLARF( 'R', P-I, M-Q-I+1, X12(I,I), LDX12, TAUQ2(I),
00344 $ X12(I+1,I), LDX12, WORK )
00345 CALL DLARF( 'R', M-P-I, M-Q-I+1, X12(I,I), LDX12, TAUQ2(I),
00346 $ X22(I+1,I), LDX22, WORK )
00347
00348 END DO
00349
00350
00351
00352 DO I = Q + 1, P
00353
00354 CALL DSCAL( M-Q-I+1, -Z1*Z4, X12(I,I), LDX12 )
00355 CALL DLARFGP( M-Q-I+1, X12(I,I), X12(I,I+1), LDX12,
00356 $ TAUQ2(I) )
00357 X12(I,I) = ONE
00358
00359 CALL DLARF( 'R', P-I, M-Q-I+1, X12(I,I), LDX12, TAUQ2(I),
00360 $ X12(I+1,I), LDX12, WORK )
00361 IF( M-P-Q .GE. 1 )
00362 $ CALL DLARF( 'R', M-P-Q, M-Q-I+1, X12(I,I), LDX12,
00363 $ TAUQ2(I), X22(Q+1,I), LDX22, WORK )
00364
00365 END DO
00366
00367
00368
00369 DO I = 1, M - P - Q
00370
00371 CALL DSCAL( M-P-Q-I+1, Z2*Z4, X22(Q+I,P+I), LDX22 )
00372 CALL DLARFGP( M-P-Q-I+1, X22(Q+I,P+I), X22(Q+I,P+I+1),
00373 $ LDX22, TAUQ2(P+I) )
00374 X22(Q+I,P+I) = ONE
00375 CALL DLARF( 'R', M-P-Q-I, M-P-Q-I+1, X22(Q+I,P+I), LDX22,
00376 $ TAUQ2(P+I), X22(Q+I+1,P+I), LDX22, WORK )
00377
00378 END DO
00379
00380 ELSE
00381
00382
00383
00384 DO I = 1, Q
00385
00386 IF( I .EQ. 1 ) THEN
00387 CALL DSCAL( P-I+1, Z1, X11(I,I), LDX11 )
00388 ELSE
00389 CALL DSCAL( P-I+1, Z1*COS(PHI(I-1)), X11(I,I), LDX11 )
00390 CALL DAXPY( P-I+1, -Z1*Z3*Z4*SIN(PHI(I-1)), X12(I-1,I),
00391 $ LDX12, X11(I,I), LDX11 )
00392 END IF
00393 IF( I .EQ. 1 ) THEN
00394 CALL DSCAL( M-P-I+1, Z2, X21(I,I), LDX21 )
00395 ELSE
00396 CALL DSCAL( M-P-I+1, Z2*COS(PHI(I-1)), X21(I,I), LDX21 )
00397 CALL DAXPY( M-P-I+1, -Z2*Z3*Z4*SIN(PHI(I-1)), X22(I-1,I),
00398 $ LDX22, X21(I,I), LDX21 )
00399 END IF
00400
00401 THETA(I) = ATAN2( DNRM2( M-P-I+1, X21(I,I), LDX21 ),
00402 $ DNRM2( P-I+1, X11(I,I), LDX11 ) )
00403
00404 CALL DLARFGP( P-I+1, X11(I,I), X11(I,I+1), LDX11, TAUP1(I) )
00405 X11(I,I) = ONE
00406 CALL DLARFGP( M-P-I+1, X21(I,I), X21(I,I+1), LDX21,
00407 $ TAUP2(I) )
00408 X21(I,I) = ONE
00409
00410 CALL DLARF( 'R', Q-I, P-I+1, X11(I,I), LDX11, TAUP1(I),
00411 $ X11(I+1,I), LDX11, WORK )
00412 CALL DLARF( 'R', M-Q-I+1, P-I+1, X11(I,I), LDX11, TAUP1(I),
00413 $ X12(I,I), LDX12, WORK )
00414 CALL DLARF( 'R', Q-I, M-P-I+1, X21(I,I), LDX21, TAUP2(I),
00415 $ X21(I+1,I), LDX21, WORK )
00416 CALL DLARF( 'R', M-Q-I+1, M-P-I+1, X21(I,I), LDX21,
00417 $ TAUP2(I), X22(I,I), LDX22, WORK )
00418
00419 IF( I .LT. Q ) THEN
00420 CALL DSCAL( Q-I, -Z1*Z3*SIN(THETA(I)), X11(I+1,I), 1 )
00421 CALL DAXPY( Q-I, Z2*Z3*COS(THETA(I)), X21(I+1,I), 1,
00422 $ X11(I+1,I), 1 )
00423 END IF
00424 CALL DSCAL( M-Q-I+1, -Z1*Z4*SIN(THETA(I)), X12(I,I), 1 )
00425 CALL DAXPY( M-Q-I+1, Z2*Z4*COS(THETA(I)), X22(I,I), 1,
00426 $ X12(I,I), 1 )
00427
00428 IF( I .LT. Q )
00429 $ PHI(I) = ATAN2( DNRM2( Q-I, X11(I+1,I), 1 ),
00430 $ DNRM2( M-Q-I+1, X12(I,I), 1 ) )
00431
00432 IF( I .LT. Q ) THEN
00433 CALL DLARFGP( Q-I, X11(I+1,I), X11(I+2,I), 1, TAUQ1(I) )
00434 X11(I+1,I) = ONE
00435 END IF
00436 CALL DLARFGP( M-Q-I+1, X12(I,I), X12(I+1,I), 1, TAUQ2(I) )
00437 X12(I,I) = ONE
00438
00439 IF( I .LT. Q ) THEN
00440 CALL DLARF( 'L', Q-I, P-I, X11(I+1,I), 1, TAUQ1(I),
00441 $ X11(I+1,I+1), LDX11, WORK )
00442 CALL DLARF( 'L', Q-I, M-P-I, X11(I+1,I), 1, TAUQ1(I),
00443 $ X21(I+1,I+1), LDX21, WORK )
00444 END IF
00445 CALL DLARF( 'L', M-Q-I+1, P-I, X12(I,I), 1, TAUQ2(I),
00446 $ X12(I,I+1), LDX12, WORK )
00447 CALL DLARF( 'L', M-Q-I+1, M-P-I, X12(I,I), 1, TAUQ2(I),
00448 $ X22(I,I+1), LDX22, WORK )
00449
00450 END DO
00451
00452
00453
00454 DO I = Q + 1, P
00455
00456 CALL DSCAL( M-Q-I+1, -Z1*Z4, X12(I,I), 1 )
00457 CALL DLARFGP( M-Q-I+1, X12(I,I), X12(I+1,I), 1, TAUQ2(I) )
00458 X12(I,I) = ONE
00459
00460 CALL DLARF( 'L', M-Q-I+1, P-I, X12(I,I), 1, TAUQ2(I),
00461 $ X12(I,I+1), LDX12, WORK )
00462 IF( M-P-Q .GE. 1 )
00463 $ CALL DLARF( 'L', M-Q-I+1, M-P-Q, X12(I,I), 1, TAUQ2(I),
00464 $ X22(I,Q+1), LDX22, WORK )
00465
00466 END DO
00467
00468
00469
00470 DO I = 1, M - P - Q
00471
00472 CALL DSCAL( M-P-Q-I+1, Z2*Z4, X22(P+I,Q+I), 1 )
00473 CALL DLARFGP( M-P-Q-I+1, X22(P+I,Q+I), X22(P+I+1,Q+I), 1,
00474 $ TAUQ2(P+I) )
00475 X22(P+I,Q+I) = ONE
00476
00477 CALL DLARF( 'L', M-P-Q-I+1, M-P-Q-I, X22(P+I,Q+I), 1,
00478 $ TAUQ2(P+I), X22(P+I,Q+I+1), LDX22, WORK )
00479
00480 END DO
00481
00482 END IF
00483
00484 RETURN
00485
00486
00487
00488 END
00489