1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
|
SUBROUTINE DGET32( RMAX, LMAX, NINFO, KNT )
*
* -- LAPACK test routine (version 3.1) --
* Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd..
* November 2006
*
* .. Scalar Arguments ..
INTEGER KNT, LMAX, NINFO
DOUBLE PRECISION RMAX
* ..
*
* Purpose
* =======
*
* DGET32 tests DLASY2, a routine for solving
*
* op(TL)*X + ISGN*X*op(TR) = SCALE*B
*
* where TL is N1 by N1, TR is N2 by N2, and N1,N2 =1 or 2 only.
* X and B are N1 by N2, op() is an optional transpose, an
* ISGN = 1 or -1. SCALE is chosen less than or equal to 1 to
* avoid overflow in X.
*
* The test condition is that the scaled residual
*
* norm( op(TL)*X + ISGN*X*op(TR) = SCALE*B )
* / ( max( ulp*norm(TL), ulp*norm(TR)) * norm(X), SMLNUM )
*
* should be on the order of 1. Here, ulp is the machine precision.
* Also, it is verified that SCALE is less than or equal to 1, and
* that XNORM = infinity-norm(X).
*
* Arguments
* ==========
*
* RMAX (output) DOUBLE PRECISION
* Value of the largest test ratio.
*
* LMAX (output) INTEGER
* Example number where largest test ratio achieved.
*
* NINFO (output) INTEGER
* Number of examples returned with INFO.NE.0.
*
* KNT (output) INTEGER
* Total number of examples tested.
*
* =====================================================================
*
* .. Parameters ..
DOUBLE PRECISION ZERO, ONE
PARAMETER ( ZERO = 0.0D0, ONE = 1.0D0 )
DOUBLE PRECISION TWO, FOUR, EIGHT
PARAMETER ( TWO = 2.0D0, FOUR = 4.0D0, EIGHT = 8.0D0 )
* ..
* .. Local Scalars ..
LOGICAL LTRANL, LTRANR
INTEGER IB, IB1, IB2, IB3, INFO, ISGN, ITL, ITLSCL,
$ ITR, ITRANL, ITRANR, ITRSCL, N1, N2
DOUBLE PRECISION BIGNUM, DEN, EPS, RES, SCALE, SGN, SMLNUM, TMP,
$ TNRM, XNORM, XNRM
* ..
* .. Local Arrays ..
INTEGER ITVAL( 2, 2, 8 )
DOUBLE PRECISION B( 2, 2 ), TL( 2, 2 ), TR( 2, 2 ), VAL( 3 ),
$ X( 2, 2 )
* ..
* .. External Functions ..
DOUBLE PRECISION DLAMCH
EXTERNAL DLAMCH
* ..
* .. External Subroutines ..
EXTERNAL DLABAD, DLASY2
* ..
* .. Intrinsic Functions ..
INTRINSIC ABS, MAX, MIN, SQRT
* ..
* .. Data statements ..
DATA ITVAL / 8, 4, 2, 1, 4, 8, 1, 2, 2, 1, 8, 4, 1,
$ 2, 4, 8, 9, 4, 2, 1, 4, 9, 1, 2, 2, 1, 9, 4, 1,
$ 2, 4, 9 /
* ..
* .. Executable Statements ..
*
* Get machine parameters
*
EPS = DLAMCH( 'P' )
SMLNUM = DLAMCH( 'S' ) / EPS
BIGNUM = ONE / SMLNUM
CALL DLABAD( SMLNUM, BIGNUM )
*
* Set up test case parameters
*
VAL( 1 ) = SQRT( SMLNUM )
VAL( 2 ) = ONE
VAL( 3 ) = SQRT( BIGNUM )
*
KNT = 0
NINFO = 0
LMAX = 0
RMAX = ZERO
*
* Begin test loop
*
DO 230 ITRANL = 0, 1
DO 220 ITRANR = 0, 1
DO 210 ISGN = -1, 1, 2
SGN = ISGN
LTRANL = ITRANL.EQ.1
LTRANR = ITRANR.EQ.1
*
N1 = 1
N2 = 1
DO 30 ITL = 1, 3
DO 20 ITR = 1, 3
DO 10 IB = 1, 3
TL( 1, 1 ) = VAL( ITL )
TR( 1, 1 ) = VAL( ITR )
B( 1, 1 ) = VAL( IB )
KNT = KNT + 1
CALL DLASY2( LTRANL, LTRANR, ISGN, N1, N2, TL,
$ 2, TR, 2, B, 2, SCALE, X, 2, XNORM,
$ INFO )
IF( INFO.NE.0 )
$ NINFO = NINFO + 1
RES = ABS( ( TL( 1, 1 )+SGN*TR( 1, 1 ) )*
$ X( 1, 1 )-SCALE*B( 1, 1 ) )
IF( INFO.EQ.0 ) THEN
DEN = MAX( EPS*( ( ABS( TR( 1,
$ 1 ) )+ABS( TL( 1, 1 ) ) )*ABS( X( 1,
$ 1 ) ) ), SMLNUM )
ELSE
DEN = SMLNUM*MAX( ABS( X( 1, 1 ) ), ONE )
END IF
RES = RES / DEN
IF( SCALE.GT.ONE )
$ RES = RES + ONE / EPS
RES = RES + ABS( XNORM-ABS( X( 1, 1 ) ) ) /
$ MAX( SMLNUM, XNORM ) / EPS
IF( INFO.NE.0 .AND. INFO.NE.1 )
$ RES = RES + ONE / EPS
IF( RES.GT.RMAX ) THEN
LMAX = KNT
RMAX = RES
END IF
10 CONTINUE
20 CONTINUE
30 CONTINUE
*
N1 = 2
N2 = 1
DO 80 ITL = 1, 8
DO 70 ITLSCL = 1, 3
DO 60 ITR = 1, 3
DO 50 IB1 = 1, 3
DO 40 IB2 = 1, 3
B( 1, 1 ) = VAL( IB1 )
B( 2, 1 ) = -FOUR*VAL( IB2 )
TL( 1, 1 ) = ITVAL( 1, 1, ITL )*
$ VAL( ITLSCL )
TL( 2, 1 ) = ITVAL( 2, 1, ITL )*
$ VAL( ITLSCL )
TL( 1, 2 ) = ITVAL( 1, 2, ITL )*
$ VAL( ITLSCL )
TL( 2, 2 ) = ITVAL( 2, 2, ITL )*
$ VAL( ITLSCL )
TR( 1, 1 ) = VAL( ITR )
KNT = KNT + 1
CALL DLASY2( LTRANL, LTRANR, ISGN, N1, N2,
$ TL, 2, TR, 2, B, 2, SCALE, X,
$ 2, XNORM, INFO )
IF( INFO.NE.0 )
$ NINFO = NINFO + 1
IF( LTRANL ) THEN
TMP = TL( 1, 2 )
TL( 1, 2 ) = TL( 2, 1 )
TL( 2, 1 ) = TMP
END IF
RES = ABS( ( TL( 1, 1 )+SGN*TR( 1, 1 ) )*
$ X( 1, 1 )+TL( 1, 2 )*X( 2, 1 )-
$ SCALE*B( 1, 1 ) )
RES = RES + ABS( ( TL( 2, 2 )+SGN*TR( 1,
$ 1 ) )*X( 2, 1 )+TL( 2, 1 )*
$ X( 1, 1 )-SCALE*B( 2, 1 ) )
TNRM = ABS( TR( 1, 1 ) ) +
$ ABS( TL( 1, 1 ) ) +
$ ABS( TL( 1, 2 ) ) +
$ ABS( TL( 2, 1 ) ) +
$ ABS( TL( 2, 2 ) )
XNRM = MAX( ABS( X( 1, 1 ) ),
$ ABS( X( 2, 1 ) ) )
DEN = MAX( SMLNUM, SMLNUM*XNRM,
$ ( TNRM*EPS )*XNRM )
RES = RES / DEN
IF( SCALE.GT.ONE )
$ RES = RES + ONE / EPS
RES = RES + ABS( XNORM-XNRM ) /
$ MAX( SMLNUM, XNORM ) / EPS
IF( RES.GT.RMAX ) THEN
LMAX = KNT
RMAX = RES
END IF
40 CONTINUE
50 CONTINUE
60 CONTINUE
70 CONTINUE
80 CONTINUE
*
N1 = 1
N2 = 2
DO 130 ITR = 1, 8
DO 120 ITRSCL = 1, 3
DO 110 ITL = 1, 3
DO 100 IB1 = 1, 3
DO 90 IB2 = 1, 3
B( 1, 1 ) = VAL( IB1 )
B( 1, 2 ) = -TWO*VAL( IB2 )
TR( 1, 1 ) = ITVAL( 1, 1, ITR )*
$ VAL( ITRSCL )
TR( 2, 1 ) = ITVAL( 2, 1, ITR )*
$ VAL( ITRSCL )
TR( 1, 2 ) = ITVAL( 1, 2, ITR )*
$ VAL( ITRSCL )
TR( 2, 2 ) = ITVAL( 2, 2, ITR )*
$ VAL( ITRSCL )
TL( 1, 1 ) = VAL( ITL )
KNT = KNT + 1
CALL DLASY2( LTRANL, LTRANR, ISGN, N1, N2,
$ TL, 2, TR, 2, B, 2, SCALE, X,
$ 2, XNORM, INFO )
IF( INFO.NE.0 )
$ NINFO = NINFO + 1
IF( LTRANR ) THEN
TMP = TR( 1, 2 )
TR( 1, 2 ) = TR( 2, 1 )
TR( 2, 1 ) = TMP
END IF
TNRM = ABS( TL( 1, 1 ) ) +
$ ABS( TR( 1, 1 ) ) +
$ ABS( TR( 1, 2 ) ) +
$ ABS( TR( 2, 2 ) ) +
$ ABS( TR( 2, 1 ) )
XNRM = ABS( X( 1, 1 ) ) + ABS( X( 1, 2 ) )
RES = ABS( ( ( TL( 1, 1 )+SGN*TR( 1,
$ 1 ) ) )*( X( 1, 1 ) )+
$ ( SGN*TR( 2, 1 ) )*( X( 1, 2 ) )-
$ ( SCALE*B( 1, 1 ) ) )
RES = RES + ABS( ( ( TL( 1, 1 )+SGN*TR( 2,
$ 2 ) ) )*( X( 1, 2 ) )+
$ ( SGN*TR( 1, 2 ) )*( X( 1, 1 ) )-
$ ( SCALE*B( 1, 2 ) ) )
DEN = MAX( SMLNUM, SMLNUM*XNRM,
$ ( TNRM*EPS )*XNRM )
RES = RES / DEN
IF( SCALE.GT.ONE )
$ RES = RES + ONE / EPS
RES = RES + ABS( XNORM-XNRM ) /
$ MAX( SMLNUM, XNORM ) / EPS
IF( RES.GT.RMAX ) THEN
LMAX = KNT
RMAX = RES
END IF
90 CONTINUE
100 CONTINUE
110 CONTINUE
120 CONTINUE
130 CONTINUE
*
N1 = 2
N2 = 2
DO 200 ITR = 1, 8
DO 190 ITRSCL = 1, 3
DO 180 ITL = 1, 8
DO 170 ITLSCL = 1, 3
DO 160 IB1 = 1, 3
DO 150 IB2 = 1, 3
DO 140 IB3 = 1, 3
B( 1, 1 ) = VAL( IB1 )
B( 2, 1 ) = -FOUR*VAL( IB2 )
B( 1, 2 ) = -TWO*VAL( IB3 )
B( 2, 2 ) = EIGHT*
$ MIN( VAL( IB1 ), VAL
$ ( IB2 ), VAL( IB3 ) )
TR( 1, 1 ) = ITVAL( 1, 1, ITR )*
$ VAL( ITRSCL )
TR( 2, 1 ) = ITVAL( 2, 1, ITR )*
$ VAL( ITRSCL )
TR( 1, 2 ) = ITVAL( 1, 2, ITR )*
$ VAL( ITRSCL )
TR( 2, 2 ) = ITVAL( 2, 2, ITR )*
$ VAL( ITRSCL )
TL( 1, 1 ) = ITVAL( 1, 1, ITL )*
$ VAL( ITLSCL )
TL( 2, 1 ) = ITVAL( 2, 1, ITL )*
$ VAL( ITLSCL )
TL( 1, 2 ) = ITVAL( 1, 2, ITL )*
$ VAL( ITLSCL )
TL( 2, 2 ) = ITVAL( 2, 2, ITL )*
$ VAL( ITLSCL )
KNT = KNT + 1
CALL DLASY2( LTRANL, LTRANR, ISGN,
$ N1, N2, TL, 2, TR, 2,
$ B, 2, SCALE, X, 2,
$ XNORM, INFO )
IF( INFO.NE.0 )
$ NINFO = NINFO + 1
IF( LTRANR ) THEN
TMP = TR( 1, 2 )
TR( 1, 2 ) = TR( 2, 1 )
TR( 2, 1 ) = TMP
END IF
IF( LTRANL ) THEN
TMP = TL( 1, 2 )
TL( 1, 2 ) = TL( 2, 1 )
TL( 2, 1 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ORM-XNRM ) /
$ MAX( SMLNUM, XNORM ) / EPS
IF( RES.GT.RMAX ) THEN
LMAX = KNT
RMAX = RES
END IF
140 CONTINUE
150 CONTINUE
160 CONTINUE
170 CONTINUE
180 CONTINUE
190 CONTINUE
200 CONTINUE
210 CONTINUE
220 CONTINUE
230 CONTINUE
*
RETURN
*
* End of DGET32
*
END
|