LAPACK 3.12.0 LAPACK: Linear Algebra PACKage
Searching...
No Matches
slatb4.f
Go to the documentation of this file.
1*> \brief \b SLATB4
2*
3* =========== DOCUMENTATION ===========
4*
5* Online html documentation available at
6* http://www.netlib.org/lapack/explore-html/
7*
8* Definition:
9* ===========
10*
11* SUBROUTINE SLATB4( PATH, IMAT, M, N, TYPE, KL, KU, ANORM, MODE,
12* CNDNUM, DIST )
13*
14* .. Scalar Arguments ..
15* CHARACTER DIST, TYPE
16* CHARACTER*3 PATH
17* INTEGER IMAT, KL, KU, M, MODE, N
18* REAL ANORM, CNDNUM
19* ..
20*
21*
22*> \par Purpose:
23* =============
24*>
25*> \verbatim
26*>
27*> SLATB4 sets parameters for the matrix generator based on the type of
28*> matrix to be generated.
29*> \endverbatim
30*
31* Arguments:
32* ==========
33*
34*> \param[in] PATH
35*> \verbatim
36*> PATH is CHARACTER*3
37*> The LAPACK path name.
38*> \endverbatim
39*>
40*> \param[in] IMAT
41*> \verbatim
42*> IMAT is INTEGER
43*> An integer key describing which matrix to generate for this
44*> path.
45*> \endverbatim
46*>
47*> \param[in] M
48*> \verbatim
49*> M is INTEGER
50*> The number of rows in the matrix to be generated.
51*> \endverbatim
52*>
53*> \param[in] N
54*> \verbatim
55*> N is INTEGER
56*> The number of columns in the matrix to be generated.
57*> \endverbatim
58*>
59*> \param[out] TYPE
60*> \verbatim
61*> TYPE is CHARACTER*1
62*> The type of the matrix to be generated:
63*> = 'S': symmetric matrix
64*> = 'P': symmetric positive (semi)definite matrix
65*> = 'N': nonsymmetric matrix
66*> \endverbatim
67*>
68*> \param[out] KL
69*> \verbatim
70*> KL is INTEGER
71*> The lower band width of the matrix to be generated.
72*> \endverbatim
73*>
74*> \param[out] KU
75*> \verbatim
76*> KU is INTEGER
77*> The upper band width of the matrix to be generated.
78*> \endverbatim
79*>
80*> \param[out] ANORM
81*> \verbatim
82*> ANORM is REAL
83*> The desired norm of the matrix to be generated. The diagonal
84*> matrix of singular values or eigenvalues is scaled by this
85*> value.
86*> \endverbatim
87*>
88*> \param[out] MODE
89*> \verbatim
90*> MODE is INTEGER
91*> A key indicating how to choose the vector of eigenvalues.
92*> \endverbatim
93*>
94*> \param[out] CNDNUM
95*> \verbatim
96*> CNDNUM is REAL
97*> The desired condition number.
98*> \endverbatim
99*>
100*> \param[out] DIST
101*> \verbatim
102*> DIST is CHARACTER*1
103*> The type of distribution to be used by the random number
104*> generator.
105*> \endverbatim
106*
107* Authors:
108* ========
109*
110*> \author Univ. of Tennessee
111*> \author Univ. of California Berkeley
112*> \author Univ. of Colorado Denver
113*> \author NAG Ltd.
114*
115*> \ingroup single_lin
116*
117* =====================================================================
118 SUBROUTINE slatb4( PATH, IMAT, M, N, TYPE, KL, KU, ANORM, MODE,
119 \$ CNDNUM, DIST )
120*
121* -- LAPACK test routine --
122* -- LAPACK is a software package provided by Univ. of Tennessee, --
123* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
124*
125* .. Scalar Arguments ..
126 CHARACTER DIST, TYPE
127 CHARACTER*3 PATH
128 INTEGER IMAT, KL, KU, M, MODE, N
129 REAL ANORM, CNDNUM
130* ..
131*
132* =====================================================================
133*
134* .. Parameters ..
135 REAL SHRINK, TENTH
136 parameter( shrink = 0.25e0, tenth = 0.1e+0 )
137 REAL ONE
138 parameter( one = 1.0e+0 )
139 REAL TWO
140 parameter( two = 2.0e+0 )
141* ..
142* .. Local Scalars ..
143 LOGICAL FIRST
144 CHARACTER*2 C2
145 INTEGER MAT
147* ..
148* .. External Functions ..
149 LOGICAL LSAMEN
150 REAL SLAMCH
151 EXTERNAL lsamen, slamch
152* ..
153* .. Intrinsic Functions ..
154 INTRINSIC abs, max, sqrt
155* ..
156* .. Save statement ..
158* ..
159* .. Data statements ..
160 DATA first / .true. /
161* ..
162* .. Executable Statements ..
163*
164* Set some constants for use in the subroutine.
165*
166 IF( first ) THEN
167 first = .false.
168 eps = slamch( 'Precision' )
169 badc2 = tenth / eps
171 small = slamch( 'Safe minimum' )
172 large = one / small
173 small = shrink*( small / eps )
174 large = one / small
175 END IF
176*
177 c2 = path( 2: 3 )
178*
179* Set some parameters we don't plan to change.
180*
181 dist = 'S'
182 mode = 3
183*
184 IF( lsamen( 2, c2, 'QR' ) .OR. lsamen( 2, c2, 'LQ' ) .OR.
185 \$ lsamen( 2, c2, 'QL' ) .OR. lsamen( 2, c2, 'RQ' ) ) THEN
186*
187* xQR, xLQ, xQL, xRQ: Set parameters to generate a general
188* M x N matrix.
189*
190* Set TYPE, the type of matrix to be generated.
191*
192 TYPE = 'N'
193*
194* Set the lower and upper bandwidths.
195*
196 IF( imat.EQ.1 ) THEN
197 kl = 0
198 ku = 0
199 ELSE IF( imat.EQ.2 ) THEN
200 kl = 0
201 ku = max( n-1, 0 )
202 ELSE IF( imat.EQ.3 ) THEN
203 kl = max( m-1, 0 )
204 ku = 0
205 ELSE
206 kl = max( m-1, 0 )
207 ku = max( n-1, 0 )
208 END IF
209*
210* Set the condition number and norm.
211*
212 IF( imat.EQ.5 ) THEN
214 ELSE IF( imat.EQ.6 ) THEN
216 ELSE
217 cndnum = two
218 END IF
219*
220 IF( imat.EQ.7 ) THEN
221 anorm = small
222 ELSE IF( imat.EQ.8 ) THEN
223 anorm = large
224 ELSE
225 anorm = one
226 END IF
227*
228 ELSE IF( lsamen( 2, c2, 'QK' ) ) THEN
229*
230* xQK: truncated QR with pivoting.
231* Set parameters to generate a general
232* M x N matrix.
233*
234* Set TYPE, the type of matrix to be generated. 'N' is nonsymmetric.
235*
236 TYPE = 'N'
237*
238* Set DIST, the type of distribution for the random
239* number generator. 'S' is
240*
241 dist = 'S'
242*
243* Set the lower and upper bandwidths.
244*
245 IF( imat.EQ.2 ) THEN
246*
247* 2. Random, Diagonal, CNDNUM = 2
248*
249 kl = 0
250 ku = 0
251 cndnum = two
252 anorm = one
253 mode = 3
254 ELSE IF( imat.EQ.3 ) THEN
255*
256* 3. Random, Upper triangular, CNDNUM = 2
257*
258 kl = 0
259 ku = max( n-1, 0 )
260 cndnum = two
261 anorm = one
262 mode = 3
263 ELSE IF( imat.EQ.4 ) THEN
264*
265* 4. Random, Lower triangular, CNDNUM = 2
266*
267 kl = max( m-1, 0 )
268 ku = 0
269 cndnum = two
270 anorm = one
271 mode = 3
272 ELSE
273*
274* 5.-19. Rectangular matrix
275*
276 kl = max( m-1, 0 )
277 ku = max( n-1, 0 )
278*
279 IF( imat.GE.5 .AND. imat.LE.14 ) THEN
280*
281* 5.-14. Random, CNDNUM = 2.
282*
283 cndnum = two
284 anorm = one
285 mode = 3
286*
287 ELSE IF( imat.EQ.15 ) THEN
288*
289* 15. Random, CNDNUM = sqrt(0.1/EPS)
290*
292 anorm = one
293 mode = 3
294*
295 ELSE IF( imat.EQ.16 ) THEN
296*
297* 16. Random, CNDNUM = 0.1/EPS
298*
300 anorm = one
301 mode = 3
302*
303 ELSE IF( imat.EQ.17 ) THEN
304*
305* 17. Random, CNDNUM = 0.1/EPS,
306* one small singular value S(N)=1/CNDNUM
307*
309 anorm = one
310 mode = 2
311*
312 ELSE IF( imat.EQ.18 ) THEN
313*
314* 18. Random, scaled near underflow
315*
316 cndnum = two
317 anorm = small
318 mode = 3
319*
320 ELSE IF( imat.EQ.19 ) THEN
321*
322* 19. Random, scaled near overflow
323*
324 cndnum = two
325 anorm = large
326 mode = 3
327*
328 END IF
329*
330 END IF
331*
332 ELSE IF( lsamen( 2, c2, 'GE' ) ) THEN
333*
334* xGE: Set parameters to generate a general M x N matrix.
335*
336* Set TYPE, the type of matrix to be generated.
337*
338 TYPE = 'N'
339*
340* Set the lower and upper bandwidths.
341*
342 IF( imat.EQ.1 ) THEN
343 kl = 0
344 ku = 0
345 ELSE IF( imat.EQ.2 ) THEN
346 kl = 0
347 ku = max( n-1, 0 )
348 ELSE IF( imat.EQ.3 ) THEN
349 kl = max( m-1, 0 )
350 ku = 0
351 ELSE
352 kl = max( m-1, 0 )
353 ku = max( n-1, 0 )
354 END IF
355*
356* Set the condition number and norm.
357*
358 IF( imat.EQ.8 ) THEN
360 ELSE IF( imat.EQ.9 ) THEN
362 ELSE
363 cndnum = two
364 END IF
365*
366 IF( imat.EQ.10 ) THEN
367 anorm = small
368 ELSE IF( imat.EQ.11 ) THEN
369 anorm = large
370 ELSE
371 anorm = one
372 END IF
373*
374 ELSE IF( lsamen( 2, c2, 'GB' ) ) THEN
375*
376* xGB: Set parameters to generate a general banded matrix.
377*
378* Set TYPE, the type of matrix to be generated.
379*
380 TYPE = 'N'
381*
382* Set the condition number and norm.
383*
384 IF( imat.EQ.5 ) THEN
386 ELSE IF( imat.EQ.6 ) THEN
388 ELSE
389 cndnum = two
390 END IF
391*
392 IF( imat.EQ.7 ) THEN
393 anorm = small
394 ELSE IF( imat.EQ.8 ) THEN
395 anorm = large
396 ELSE
397 anorm = one
398 END IF
399*
400 ELSE IF( lsamen( 2, c2, 'GT' ) ) THEN
401*
402* xGT: Set parameters to generate a general tridiagonal matrix.
403*
404* Set TYPE, the type of matrix to be generated.
405*
406 TYPE = 'N'
407*
408* Set the lower and upper bandwidths.
409*
410 IF( imat.EQ.1 ) THEN
411 kl = 0
412 ELSE
413 kl = 1
414 END IF
415 ku = kl
416*
417* Set the condition number and norm.
418*
419 IF( imat.EQ.3 ) THEN
421 ELSE IF( imat.EQ.4 ) THEN
423 ELSE
424 cndnum = two
425 END IF
426*
427 IF( imat.EQ.5 .OR. imat.EQ.11 ) THEN
428 anorm = small
429 ELSE IF( imat.EQ.6 .OR. imat.EQ.12 ) THEN
430 anorm = large
431 ELSE
432 anorm = one
433 END IF
434*
435 ELSE IF( lsamen( 2, c2, 'PO' ) .OR. lsamen( 2, c2, 'PP' ) ) THEN
436*
437* xPO, xPP, xSY, xSP: Set parameters to generate a
438* symmetric positive definite matrix.
439*
440* Set TYPE, the type of matrix to be generated.
441*
442 TYPE = c2( 1: 1 )
443*
444* Set the lower and upper bandwidths.
445*
446 IF( imat.EQ.1 ) THEN
447 kl = 0
448 ELSE
449 kl = max( n-1, 0 )
450 END IF
451 ku = kl
452*
453* Set the condition number and norm.
454*
455 IF( imat.EQ.6 ) THEN
457 ELSE IF( imat.EQ.7 ) THEN
459 ELSE
460 cndnum = two
461 END IF
462*
463 IF( imat.EQ.8 ) THEN
464 anorm = small
465 ELSE IF( imat.EQ.9 ) THEN
466 anorm = large
467 ELSE
468 anorm = one
469 END IF
470*
471*
472 ELSE IF( lsamen( 2, c2, 'SY' ) .OR. lsamen( 2, c2, 'SP' ) ) THEN
473*
474* xSY, xSP: Set parameters to generate a
475* symmetric matrix.
476*
477* Set TYPE, the type of matrix to be generated.
478*
479 TYPE = c2( 1: 1 )
480*
481* Set the lower and upper bandwidths.
482*
483 IF( imat.EQ.1 ) THEN
484 kl = 0
485 ELSE
486 kl = max( n-1, 0 )
487 END IF
488 ku = kl
489*
490* Set the condition number and norm.
491*
492 IF( imat.EQ.7 ) THEN
494 ELSE IF( imat.EQ.8 ) THEN
496 ELSE
497 cndnum = two
498 END IF
499*
500 IF( imat.EQ.9 ) THEN
501 anorm = small
502 ELSE IF( imat.EQ.10 ) THEN
503 anorm = large
504 ELSE
505 anorm = one
506 END IF
507*
508 ELSE IF( lsamen( 2, c2, 'PB' ) ) THEN
509*
510* xPB: Set parameters to generate a symmetric band matrix.
511*
512* Set TYPE, the type of matrix to be generated.
513*
514 TYPE = 'P'
515*
516* Set the norm and condition number.
517*
518 IF( imat.EQ.5 ) THEN
520 ELSE IF( imat.EQ.6 ) THEN
522 ELSE
523 cndnum = two
524 END IF
525*
526 IF( imat.EQ.7 ) THEN
527 anorm = small
528 ELSE IF( imat.EQ.8 ) THEN
529 anorm = large
530 ELSE
531 anorm = one
532 END IF
533*
534 ELSE IF( lsamen( 2, c2, 'PT' ) ) THEN
535*
536* xPT: Set parameters to generate a symmetric positive definite
537* tridiagonal matrix.
538*
539 TYPE = 'P'
540 IF( imat.EQ.1 ) THEN
541 kl = 0
542 ELSE
543 kl = 1
544 END IF
545 ku = kl
546*
547* Set the condition number and norm.
548*
549 IF( imat.EQ.3 ) THEN
551 ELSE IF( imat.EQ.4 ) THEN
553 ELSE
554 cndnum = two
555 END IF
556*
557 IF( imat.EQ.5 .OR. imat.EQ.11 ) THEN
558 anorm = small
559 ELSE IF( imat.EQ.6 .OR. imat.EQ.12 ) THEN
560 anorm = large
561 ELSE
562 anorm = one
563 END IF
564*
565 ELSE IF( lsamen( 2, c2, 'TR' ) .OR. lsamen( 2, c2, 'TP' ) ) THEN
566*
567* xTR, xTP: Set parameters to generate a triangular matrix
568*
569* Set TYPE, the type of matrix to be generated.
570*
571 TYPE = 'N'
572*
573* Set the lower and upper bandwidths.
574*
575 mat = abs( imat )
576 IF( mat.EQ.1 .OR. mat.EQ.7 ) THEN
577 kl = 0
578 ku = 0
579 ELSE IF( imat.LT.0 ) THEN
580 kl = max( n-1, 0 )
581 ku = 0
582 ELSE
583 kl = 0
584 ku = max( n-1, 0 )
585 END IF
586*
587* Set the condition number and norm.
588*
589 IF( mat.EQ.3 .OR. mat.EQ.9 ) THEN
591 ELSE IF( mat.EQ.4 ) THEN
593 ELSE IF( mat.EQ.10 ) THEN
595 ELSE
596 cndnum = two
597 END IF
598*
599 IF( mat.EQ.5 ) THEN
600 anorm = small
601 ELSE IF( mat.EQ.6 ) THEN
602 anorm = large
603 ELSE
604 anorm = one
605 END IF
606*
607 ELSE IF( lsamen( 2, c2, 'TB' ) ) THEN
608*
609* xTB: Set parameters to generate a triangular band matrix.
610*
611* Set TYPE, the type of matrix to be generated.
612*
613 TYPE = 'N'
614*
615* Set the norm and condition number.
616*
617 mat = abs( imat )
618 IF( mat.EQ.2 .OR. mat.EQ.8 ) THEN
620 ELSE IF( mat.EQ.3 .OR. mat.EQ.9 ) THEN
622 ELSE
623 cndnum = two
624 END IF
625*
626 IF( mat.EQ.4 ) THEN
627 anorm = small
628 ELSE IF( mat.EQ.5 ) THEN
629 anorm = large
630 ELSE
631 anorm = one
632 END IF
633 END IF
634 IF( n.LE.1 )
635 \$ cndnum = one
636*
637 RETURN
638*
639* End of SLATB4
640*
641 END
subroutine slatb4(path, imat, m, n, type, kl, ku, anorm, mode, cndnum, dist)
SLATB4
Definition slatb4.f:120