00001 SUBROUTINE ZCKCSD( NM, MVAL, PVAL, QVAL, NMATS, ISEED, THRESH,
00002 $ MMAX, X, XF, U1, U2, V1T, V2T, THETA, IWORK,
00003 $ WORK, RWORK, NIN, NOUT, INFO )
00004 IMPLICIT NONE
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 INTEGER INFO, NIN, NM, NMATS, MMAX, NOUT
00016 DOUBLE PRECISION THRESH
00017
00018
00019 INTEGER ISEED( 4 ), IWORK( * ), MVAL( * ), PVAL( * ),
00020 $ QVAL( * )
00021 DOUBLE PRECISION RWORK( * ), THETA( * )
00022 COMPLEX*16 U1( * ), U2( * ), V1T( * ), V2T( * ),
00023 $ WORK( * ), X( * ), XF( * )
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 INTEGER NTESTS
00106 PARAMETER ( NTESTS = 9 )
00107 INTEGER NTYPES
00108 PARAMETER ( NTYPES = 3 )
00109 DOUBLE PRECISION GAPDIGIT, ORTH, PIOVER2, TEN
00110 PARAMETER ( GAPDIGIT = 18.0D0, ORTH = 1.0D-12,
00111 $ PIOVER2 = 1.57079632679489662D0,
00112 $ TEN = 10.0D0 )
00113 COMPLEX*16 ZERO, ONE
00114 PARAMETER ( ZERO = (0.0D0,0.0D0), ONE = (1.0D0,0.0D0) )
00115
00116
00117 LOGICAL FIRSTT
00118 CHARACTER*3 PATH
00119 INTEGER I, IINFO, IM, IMAT, J, LDU1, LDU2, LDV1T,
00120 $ LDV2T, LDX, LWORK, M, NFAIL, NRUN, NT, P, Q, R
00121
00122
00123 LOGICAL DOTYPE( NTYPES )
00124 DOUBLE PRECISION RESULT( NTESTS )
00125
00126
00127 EXTERNAL ALAHDG, ALAREQ, ALASUM, ZCSDTS, ZLACSG, ZLAROR,
00128 $ ZLASET
00129
00130
00131 INTRINSIC ABS, COS, MIN, SIN
00132
00133
00134 DOUBLE PRECISION ZLANGE, DLARND
00135 EXTERNAL ZLANGE, DLARND
00136
00137
00138
00139
00140
00141 PATH( 1: 3 ) = 'CSD'
00142 INFO = 0
00143 NRUN = 0
00144 NFAIL = 0
00145 FIRSTT = .TRUE.
00146 CALL ALAREQ( PATH, NMATS, DOTYPE, NTYPES, NIN, NOUT )
00147 LDX = MMAX
00148 LDU1 = MMAX
00149 LDU2 = MMAX
00150 LDV1T = MMAX
00151 LDV2T = MMAX
00152 LWORK = MMAX*MMAX
00153
00154
00155
00156 DO 30 IM = 1, NM
00157 M = MVAL( IM )
00158 P = PVAL( IM )
00159 Q = QVAL( IM )
00160
00161 DO 20 IMAT = 1, NTYPES
00162
00163
00164
00165 IF( .NOT.DOTYPE( IMAT ) )
00166 $ GO TO 20
00167
00168
00169
00170 IF( IMAT.EQ.1 ) THEN
00171 CALL ZLAROR( 'L', 'I', M, M, X, LDX, ISEED, WORK, IINFO )
00172 IF( M .NE. 0 .AND. IINFO .NE. 0 ) THEN
00173 WRITE( NOUT, FMT = 9999 ) M, IINFO
00174 INFO = ABS( IINFO )
00175 GO TO 20
00176 END IF
00177 ELSE IF( IMAT.EQ.2 ) THEN
00178 R = MIN( P, M-P, Q, M-Q )
00179 DO I = 1, R
00180 THETA(I) = PIOVER2 * DLARND( 1, ISEED )
00181 END DO
00182 CALL ZLACSG( M, P, Q, THETA, ISEED, X, LDX, WORK )
00183 DO I = 1, M
00184 DO J = 1, M
00185 X(I+(J-1)*LDX) = X(I+(J-1)*LDX) +
00186 $ ORTH*DLARND(2,ISEED)
00187 END DO
00188 END DO
00189 ELSE
00190 R = MIN( P, M-P, Q, M-Q )
00191 DO I = 1, R+1
00192 THETA(I) = TEN**(-DLARND(1,ISEED)*GAPDIGIT)
00193 END DO
00194 DO I = 2, R+1
00195 THETA(I) = THETA(I-1) + THETA(I)
00196 END DO
00197 DO I = 1, R
00198 THETA(I) = PIOVER2 * THETA(I) / THETA(R+1)
00199 END DO
00200 CALL ZLACSG( M, P, Q, THETA, ISEED, X, LDX, WORK )
00201 END IF
00202
00203 NT = 9
00204
00205 CALL ZCSDTS( M, P, Q, X, XF, LDX, U1, LDU1, U2, LDU2, V1T,
00206 $ LDV1T, V2T, LDV2T, THETA, IWORK, WORK, LWORK,
00207 $ RWORK, RESULT )
00208
00209
00210
00211
00212 DO 10 I = 1, NT
00213 IF( RESULT( I ).GE.THRESH ) THEN
00214 IF( NFAIL.EQ.0 .AND. FIRSTT ) THEN
00215 FIRSTT = .FALSE.
00216 CALL ALAHDG( NOUT, PATH )
00217 END IF
00218 WRITE( NOUT, FMT = 9998 )M, P, Q, IMAT, I,
00219 $ RESULT( I )
00220 NFAIL = NFAIL + 1
00221 END IF
00222 10 CONTINUE
00223 NRUN = NRUN + NT
00224 20 CONTINUE
00225 30 CONTINUE
00226
00227
00228
00229 CALL ALASUM( PATH, NOUT, NFAIL, NRUN, 0 )
00230
00231 9999 FORMAT( ' ZLAROR in ZCKCSD: M = ', I5, ', INFO = ', I15 )
00232 9998 FORMAT( ' M=', I4, ' P=', I4, ', Q=', I4, ', type ', I2,
00233 $ ', test ', I2, ', ratio=', G13.6 )
00234 RETURN
00235
00236
00237
00238 END
00239
00240
00241
00242 SUBROUTINE ZLACSG( M, P, Q, THETA, ISEED, X, LDX, WORK )
00243 IMPLICIT NONE
00244
00245 INTEGER LDX, M, P, Q
00246 INTEGER ISEED( 4 )
00247 DOUBLE PRECISION THETA( * )
00248 COMPLEX*16 WORK( * ), X( LDX, * )
00249
00250 COMPLEX*16 ONE, ZERO
00251 PARAMETER ( ONE = (1.0D0,0.0D0), ZERO = (0.0D0,0.0D0) )
00252
00253 INTEGER I, INFO, R
00254
00255 R = MIN( P, M-P, Q, M-Q )
00256
00257 CALL ZLASET( 'Full', M, M, ZERO, ZERO, X, LDX )
00258
00259 DO I = 1, MIN(P,Q)-R
00260 X(I,I) = ONE
00261 END DO
00262 DO I = 1, R
00263 X(MIN(P,Q)-R+I,MIN(P,Q)-R+I) = DCMPLX( COS(THETA(I)), 0.0D0 )
00264 END DO
00265 DO I = 1, MIN(P,M-Q)-R
00266 X(P-I+1,M-I+1) = -ONE
00267 END DO
00268 DO I = 1, R
00269 X(P-(MIN(P,M-Q)-R)+1-I,M-(MIN(P,M-Q)-R)+1-I) =
00270 $ DCMPLX( -SIN(THETA(R-I+1)), 0.0D0 )
00271 END DO
00272 DO I = 1, MIN(M-P,Q)-R
00273 X(M-I+1,Q-I+1) = ONE
00274 END DO
00275 DO I = 1, R
00276 X(M-(MIN(M-P,Q)-R)+1-I,Q-(MIN(M-P,Q)-R)+1-I) =
00277 $ DCMPLX( SIN(THETA(R-I+1)), 0.0D0 )
00278 END DO
00279 DO I = 1, MIN(M-P,M-Q)-R
00280 X(P+I,Q+I) = ONE
00281 END DO
00282 DO I = 1, R
00283 X(P+(MIN(M-P,M-Q)-R)+I,Q+(MIN(M-P,M-Q)-R)+I) =
00284 $ DCMPLX( COS(THETA(I)), 0.0D0 )
00285 END DO
00286 CALL ZLAROR( 'Left', 'No init', P, M, X, LDX, ISEED, WORK, INFO )
00287 CALL ZLAROR( 'Left', 'No init', M-P, M, X(P+1,1), LDX,
00288 $ ISEED, WORK, INFO )
00289 CALL ZLAROR( 'Right', 'No init', M, Q, X, LDX, ISEED,
00290 $ WORK, INFO )
00291 CALL ZLAROR( 'Right', 'No init', M, M-Q,
00292 $ X(1,Q+1), LDX, ISEED, WORK, INFO )
00293
00294 END
00295