00001 SUBROUTINE DCSDTS( M, P, Q, X, XF, LDX, U1, LDU1, U2, LDU2, V1T,
00002 $ LDV1T, V2T, LDV2T, THETA, IWORK, WORK, LWORK,
00003 $ RWORK, RESULT )
00004 IMPLICIT NONE
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 INTEGER LDX, LDU1, LDU2, LDV1T, LDV2T, LWORK, M, P, Q
00016
00017
00018 INTEGER IWORK( * )
00019 DOUBLE PRECISION RESULT( 9 ), RWORK( * ), THETA( * )
00020 DOUBLE PRECISION U1( LDU1, * ), U2( LDU2, * ), V1T( LDV1T, * ),
00021 $ V2T( LDV2T, * ), WORK( LWORK ), X( LDX, * ),
00022 $ XF( LDX, * )
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 DOUBLE PRECISION PIOVER2, REALONE, REALZERO
00129 PARAMETER ( PIOVER2 = 1.57079632679489662D0,
00130 $ REALONE = 1.0D0, REALZERO = 0.0D0 )
00131 DOUBLE PRECISION ZERO, ONE
00132 PARAMETER ( ZERO = 0.0D0, ONE = 1.0D0 )
00133
00134
00135 INTEGER I, INFO, R
00136 DOUBLE PRECISION EPS2, RESID, ULP, ULPINV
00137
00138
00139 DOUBLE PRECISION DLAMCH, DLANGE, DLANSY
00140 EXTERNAL DLAMCH, DLANGE, DLANSY
00141
00142
00143 EXTERNAL DGEMM, DLACPY, DLASET, DORCSD, DSYRK
00144
00145
00146 INTRINSIC DBLE, MAX, MIN
00147
00148
00149
00150 ULP = DLAMCH( 'Precision' )
00151 ULPINV = REALONE / ULP
00152 CALL DLASET( 'Full', M, M, ZERO, ONE, WORK, LDX )
00153 CALL DSYRK( 'Upper', 'Conjugate transpose', M, M, -ONE, X, LDX,
00154 $ ONE, WORK, LDX )
00155 EPS2 = MAX( ULP,
00156 $ DLANGE( '1', M, M, WORK, LDX, RWORK ) / DBLE( M ) )
00157 R = MIN( P, M-P, Q, M-Q )
00158
00159
00160
00161 CALL DLACPY( 'Full', M, M, X, LDX, XF, LDX )
00162
00163
00164
00165 CALL DORCSD( 'Y', 'Y', 'Y', 'Y', 'N', 'D', M, P, Q, XF(1,1), LDX,
00166 $ XF(1,Q+1), LDX, XF(P+1,1), LDX, XF(P+1,Q+1), LDX,
00167 $ THETA, U1, LDU1, U2, LDU2, V1T, LDV1T, V2T, LDV2T,
00168 $ WORK, LWORK, IWORK, INFO )
00169
00170
00171
00172 CALL DGEMM( 'No transpose', 'Conjugate transpose', P, Q, Q, ONE,
00173 $ X, LDX, V1T, LDV1T, ZERO, WORK, LDX )
00174
00175 CALL DGEMM( 'Conjugate transpose', 'No transpose', P, Q, P, ONE,
00176 $ U1, LDU1, WORK, LDX, ZERO, X, LDX )
00177
00178 DO I = 1, MIN(P,Q)-R
00179 X(I,I) = X(I,I) - ONE
00180 END DO
00181 DO I = 1, R
00182 X(MIN(P,Q)-R+I,MIN(P,Q)-R+I) =
00183 $ X(MIN(P,Q)-R+I,MIN(P,Q)-R+I) - COS(THETA(I))
00184 END DO
00185
00186 CALL DGEMM( 'No transpose', 'Conjugate transpose', P, M-Q, M-Q,
00187 $ ONE, X(1,Q+1), LDX, V2T, LDV2T, ZERO, WORK, LDX )
00188
00189 CALL DGEMM( 'Conjugate transpose', 'No transpose', P, M-Q, P,
00190 $ ONE, U1, LDU1, WORK, LDX, ZERO, X(1,Q+1), LDX )
00191
00192 DO I = 1, MIN(P,M-Q)-R
00193 X(P-I+1,M-I+1) = X(P-I+1,M-I+1) + ONE
00194 END DO
00195 DO I = 1, R
00196 X(P-(MIN(P,M-Q)-R)+1-I,M-(MIN(P,M-Q)-R)+1-I) =
00197 $ X(P-(MIN(P,M-Q)-R)+1-I,M-(MIN(P,M-Q)-R)+1-I) +
00198 $ SIN(THETA(R-I+1))
00199 END DO
00200
00201 CALL DGEMM( 'No transpose', 'Conjugate transpose', M-P, Q, Q, ONE,
00202 $ X(P+1,1), LDX, V1T, LDV1T, ZERO, WORK, LDX )
00203
00204 CALL DGEMM( 'Conjugate transpose', 'No transpose', M-P, Q, M-P,
00205 $ ONE, U2, LDU2, WORK, LDX, ZERO, X(P+1,1), LDX )
00206
00207 DO I = 1, MIN(M-P,Q)-R
00208 X(M-I+1,Q-I+1) = X(M-I+1,Q-I+1) - ONE
00209 END DO
00210 DO I = 1, R
00211 X(M-(MIN(M-P,Q)-R)+1-I,Q-(MIN(M-P,Q)-R)+1-I) =
00212 $ X(M-(MIN(M-P,Q)-R)+1-I,Q-(MIN(M-P,Q)-R)+1-I) -
00213 $ SIN(THETA(R-I+1))
00214 END DO
00215
00216 CALL DGEMM( 'No transpose', 'Conjugate transpose', M-P, M-Q, M-Q,
00217 $ ONE, X(P+1,Q+1), LDX, V2T, LDV2T, ZERO, WORK, LDX )
00218
00219 CALL DGEMM( 'Conjugate transpose', 'No transpose', M-P, M-Q, M-P,
00220 $ ONE, U2, LDU2, WORK, LDX, ZERO, X(P+1,Q+1), LDX )
00221
00222 DO I = 1, MIN(M-P,M-Q)-R
00223 X(P+I,Q+I) = X(P+I,Q+I) - ONE
00224 END DO
00225 DO I = 1, R
00226 X(P+(MIN(M-P,M-Q)-R)+I,Q+(MIN(M-P,M-Q)-R)+I) =
00227 $ X(P+(MIN(M-P,M-Q)-R)+I,Q+(MIN(M-P,M-Q)-R)+I) -
00228 $ COS(THETA(I))
00229 END DO
00230
00231
00232
00233 RESID = DLANGE( '1', P, Q, X, LDX, RWORK )
00234 RESULT( 1 ) = ( RESID / DBLE(MAX(1,P,Q)) ) / EPS2
00235
00236
00237
00238 RESID = DLANGE( '1', P, M-Q, X(1,Q+1), LDX, RWORK )
00239 RESULT( 2 ) = ( RESID / DBLE(MAX(1,P,M-Q)) ) / EPS2
00240
00241
00242
00243 RESID = DLANGE( '1', M-P, Q, X(P+1,1), LDX, RWORK )
00244 RESULT( 3 ) = ( RESID / DBLE(MAX(1,M-P,Q)) ) / EPS2
00245
00246
00247
00248 RESID = DLANGE( '1', M-P, M-Q, X(P+1,Q+1), LDX, RWORK )
00249 RESULT( 4 ) = ( RESID / DBLE(MAX(1,M-P,M-Q)) ) / EPS2
00250
00251
00252
00253 CALL DLASET( 'Full', P, P, ZERO, ONE, WORK, LDU1 )
00254 CALL DSYRK( 'Upper', 'Conjugate transpose', P, P, -ONE, U1, LDU1,
00255 $ ONE, WORK, LDU1 )
00256
00257
00258
00259 RESID = DLANSY( '1', 'Upper', P, WORK, LDU1, RWORK )
00260 RESULT( 5 ) = ( RESID / DBLE(MAX(1,P)) ) / ULP
00261
00262
00263
00264 CALL DLASET( 'Full', M-P, M-P, ZERO, ONE, WORK, LDU2 )
00265 CALL DSYRK( 'Upper', 'Conjugate transpose', M-P, M-P, -ONE, U2,
00266 $ LDU2, ONE, WORK, LDU2 )
00267
00268
00269
00270 RESID = DLANSY( '1', 'Upper', M-P, WORK, LDU2, RWORK )
00271 RESULT( 6 ) = ( RESID / DBLE(MAX(1,M-P)) ) / ULP
00272
00273
00274
00275 CALL DLASET( 'Full', Q, Q, ZERO, ONE, WORK, LDV1T )
00276 CALL DSYRK( 'Upper', 'No transpose', Q, Q, -ONE, V1T, LDV1T, ONE,
00277 $ WORK, LDV1T )
00278
00279
00280
00281 RESID = DLANSY( '1', 'Upper', Q, WORK, LDV1T, RWORK )
00282 RESULT( 7 ) = ( RESID / DBLE(MAX(1,Q)) ) / ULP
00283
00284
00285
00286 CALL DLASET( 'Full', M-Q, M-Q, ZERO, ONE, WORK, LDV2T )
00287 CALL DSYRK( 'Upper', 'No transpose', M-Q, M-Q, -ONE, V2T, LDV2T,
00288 $ ONE, WORK, LDV2T )
00289
00290
00291
00292 RESID = DLANSY( '1', 'Upper', M-Q, WORK, LDV2T, RWORK )
00293 RESULT( 8 ) = ( RESID / DBLE(MAX(1,M-Q)) ) / ULP
00294
00295
00296
00297 RESULT(9) = REALZERO
00298 DO I = 1, R
00299 IF( THETA(I).LT.REALZERO .OR. THETA(I).GT.PIOVER2 ) THEN
00300 RESULT(9) = ULPINV
00301 END IF
00302 IF( I.GT.1) THEN
00303 IF ( THETA(I).LT.THETA(I-1) ) THEN
00304 RESULT(9) = ULPINV
00305 END IF
00306 END IF
00307 END DO
00308
00309 RETURN
00310
00311
00312
00313 END
00314