1*> \brief \b ZLATB4
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 ZLATB4( 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*       DOUBLE PRECISION   ANORM, CNDNUM
19*       ..
20*
21*
22*> \par Purpose:
23*  =============
24*>
25*> \verbatim
26*>
27*> ZLATB4 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*>          = 'H':  Hermitian matrix
65*>          = 'P':  Hermitian positive (semi)definite matrix
66*>          = 'N':  nonsymmetric matrix
67*> \endverbatim
68*>
69*> \param[out] KL
70*> \verbatim
71*>          KL is INTEGER
72*>          The lower band width of the matrix to be generated.
73*> \endverbatim
74*>
75*> \param[out] KU
76*> \verbatim
77*>          KU is INTEGER
78*>          The upper band width of the matrix to be generated.
79*> \endverbatim
80*>
81*> \param[out] ANORM
82*> \verbatim
83*>          ANORM is DOUBLE PRECISION
84*>          The desired norm of the matrix to be generated.  The diagonal
85*>          matrix of singular values or eigenvalues is scaled by this
86*>          value.
87*> \endverbatim
88*>
89*> \param[out] MODE
90*> \verbatim
91*>          MODE is INTEGER
92*>          A key indicating how to choose the vector of eigenvalues.
93*> \endverbatim
94*>
95*> \param[out] CNDNUM
96*> \verbatim
97*>          CNDNUM is DOUBLE PRECISION
98*>          The desired condition number.
99*> \endverbatim
100*>
101*> \param[out] DIST
102*> \verbatim
103*>          DIST is CHARACTER*1
104*>          The type of distribution to be used by the random number
105*>          generator.
106*> \endverbatim
107*
108*  Authors:
109*  ========
110*
111*> \author Univ. of Tennessee
112*> \author Univ. of California Berkeley
113*> \author Univ. of Colorado Denver
114*> \author NAG Ltd.
115*
116*> \ingroup complex16_lin
117*
118*  =====================================================================
119      SUBROUTINE ZLATB4( PATH, IMAT, M, N, TYPE, KL, KU, ANORM, MODE,
120     $                   CNDNUM, DIST )
121*
122*  -- LAPACK test routine --
123*  -- LAPACK is a software package provided by Univ. of Tennessee,    --
124*  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
125*
126*     .. Scalar Arguments ..
127      CHARACTER          DIST, TYPE
128      CHARACTER*3        PATH
129      INTEGER            IMAT, KL, KU, M, MODE, N
130      DOUBLE PRECISION   ANORM, CNDNUM
131*     ..
132*
133*  =====================================================================
134*
135*     .. Parameters ..
136      DOUBLE PRECISION   SHRINK, TENTH
137      PARAMETER          ( SHRINK = 0.25D0, TENTH = 0.1D+0 )
138      DOUBLE PRECISION   ONE
139      PARAMETER          ( ONE = 1.0D+0 )
140      DOUBLE PRECISION   TWO
141      PARAMETER          ( TWO = 2.0D+0 )
142*     ..
143*     .. Local Scalars ..
144      LOGICAL            FIRST
145      CHARACTER*2        C2
146      INTEGER            MAT
147      DOUBLE PRECISION   BADC1, BADC2, EPS, LARGE, SMALL
148*     ..
149*     .. External Functions ..
150      LOGICAL            LSAMEN
151      DOUBLE PRECISION   DLAMCH
152      EXTERNAL           LSAMEN, DLAMCH
153*     ..
154*     .. Intrinsic Functions ..
155      INTRINSIC          ABS, MAX, SQRT
156*     ..
157*     .. External Subroutines ..
158      EXTERNAL           DLABAD
159*     ..
160*     .. Save statement ..
161      SAVE               EPS, SMALL, LARGE, BADC1, BADC2, FIRST
162*     ..
163*     .. Data statements ..
164      DATA               FIRST / .TRUE. /
165*     ..
166*     .. Executable Statements ..
167*
168*     Set some constants for use in the subroutine.
169*
170      IF( FIRST ) THEN
171         FIRST = .FALSE.
172         EPS = DLAMCH( 'Precision' )
173         BADC2 = TENTH / EPS
174         BADC1 = SQRT( BADC2 )
175         SMALL = DLAMCH( 'Safe minimum' )
176         LARGE = ONE / SMALL
177*
178*        If it looks like we're on a Cray, take the square root of
179*        SMALL and LARGE to avoid overflow and underflow problems.
180*
181         CALL DLABAD( SMALL, LARGE )
182         SMALL = SHRINK*( SMALL / EPS )
183         LARGE = ONE / SMALL
184      END IF
185*
186      C2 = PATH( 2: 3 )
187*
188*     Set some parameters we don't plan to change.
189*
190      DIST = 'S'
191      MODE = 3
192*
193*     xQR, xLQ, xQL, xRQ:  Set parameters to generate a general
194*                          M x N matrix.
195*
196      IF( LSAMEN( 2, C2, 'QR' ) .OR. LSAMEN( 2, C2, 'LQ' ) .OR.
197     $    LSAMEN( 2, C2, 'QL' ) .OR. LSAMEN( 2, C2, 'RQ' ) ) THEN
198*
199*        Set TYPE, the type of matrix to be generated.
200*
201         TYPE = 'N'
202*
203*        Set the lower and upper bandwidths.
204*
205         IF( IMAT.EQ.1 ) THEN
206            KL = 0
207            KU = 0
208         ELSE IF( IMAT.EQ.2 ) THEN
209            KL = 0
210            KU = MAX( N-1, 0 )
211         ELSE IF( IMAT.EQ.3 ) THEN
212            KL = MAX( M-1, 0 )
213            KU = 0
214         ELSE
215            KL = MAX( M-1, 0 )
216            KU = MAX( N-1, 0 )
217         END IF
218*
219*        Set the condition number and norm.
220*
221         IF( IMAT.EQ.5 ) THEN
222            CNDNUM = BADC1
223         ELSE IF( IMAT.EQ.6 ) THEN
224            CNDNUM = BADC2
225         ELSE
226            CNDNUM = TWO
227         END IF
228*
229         IF( IMAT.EQ.7 ) THEN
230            ANORM = SMALL
231         ELSE IF( IMAT.EQ.8 ) THEN
232            ANORM = LARGE
233         ELSE
234            ANORM = ONE
235         END IF
236*
237      ELSE IF( LSAMEN( 2, C2, 'GE' ) ) THEN
238*
239*        xGE:  Set parameters to generate a general M x N matrix.
240*
241*        Set TYPE, the type of matrix to be generated.
242*
243         TYPE = 'N'
244*
245*        Set the lower and upper bandwidths.
246*
247         IF( IMAT.EQ.1 ) THEN
248            KL = 0
249            KU = 0
250         ELSE IF( IMAT.EQ.2 ) THEN
251            KL = 0
252            KU = MAX( N-1, 0 )
253         ELSE IF( IMAT.EQ.3 ) THEN
254            KL = MAX( M-1, 0 )
255            KU = 0
256         ELSE
257            KL = MAX( M-1, 0 )
258            KU = MAX( N-1, 0 )
259         END IF
260*
261*        Set the condition number and norm.
262*
263         IF( IMAT.EQ.8 ) THEN
264            CNDNUM = BADC1
265         ELSE IF( IMAT.EQ.9 ) THEN
266            CNDNUM = BADC2
267         ELSE
268            CNDNUM = TWO
269         END IF
270*
271         IF( IMAT.EQ.10 ) THEN
272            ANORM = SMALL
273         ELSE IF( IMAT.EQ.11 ) THEN
274            ANORM = LARGE
275         ELSE
276            ANORM = ONE
277         END IF
278*
279      ELSE IF( LSAMEN( 2, C2, 'GB' ) ) THEN
280*
281*        xGB:  Set parameters to generate a general banded matrix.
282*
283*        Set TYPE, the type of matrix to be generated.
284*
285         TYPE = 'N'
286*
287*        Set the condition number and norm.
288*
289         IF( IMAT.EQ.5 ) THEN
290            CNDNUM = BADC1
291         ELSE IF( IMAT.EQ.6 ) THEN
292            CNDNUM = TENTH*BADC2
293         ELSE
294            CNDNUM = TWO
295         END IF
296*
297         IF( IMAT.EQ.7 ) THEN
298            ANORM = SMALL
299         ELSE IF( IMAT.EQ.8 ) THEN
300            ANORM = LARGE
301         ELSE
302            ANORM = ONE
303         END IF
304*
305      ELSE IF( LSAMEN( 2, C2, 'GT' ) ) THEN
306*
307*        xGT:  Set parameters to generate a general tridiagonal matrix.
308*
309*        Set TYPE, the type of matrix to be generated.
310*
311         TYPE = 'N'
312*
313*        Set the lower and upper bandwidths.
314*
315         IF( IMAT.EQ.1 ) THEN
316            KL = 0
317         ELSE
318            KL = 1
319         END IF
320         KU = KL
321*
322*        Set the condition number and norm.
323*
324         IF( IMAT.EQ.3 ) THEN
325            CNDNUM = BADC1
326         ELSE IF( IMAT.EQ.4 ) THEN
327            CNDNUM = BADC2
328         ELSE
329            CNDNUM = TWO
330         END IF
331*
332         IF( IMAT.EQ.5 .OR. IMAT.EQ.11 ) THEN
333            ANORM = SMALL
334         ELSE IF( IMAT.EQ.6 .OR. IMAT.EQ.12 ) THEN
335            ANORM = LARGE
336         ELSE
337            ANORM = ONE
338         END IF
339*
340      ELSE IF( LSAMEN( 2, C2, 'PO' ) .OR. LSAMEN( 2, C2, 'PP' ) ) THEN
341*
342*        xPO, xPP: Set parameters to generate a
343*        symmetric or Hermitian positive definite matrix.
344*
345*        Set TYPE, the type of matrix to be generated.
346*
347         TYPE = C2( 1: 1 )
348*
349*        Set the lower and upper bandwidths.
350*
351         IF( IMAT.EQ.1 ) THEN
352            KL = 0
353         ELSE
354            KL = MAX( N-1, 0 )
355         END IF
356         KU = KL
357*
358*        Set the condition number and norm.
359*
360         IF( IMAT.EQ.6 ) THEN
361            CNDNUM = BADC1
362         ELSE IF( IMAT.EQ.7 ) THEN
363            CNDNUM = BADC2
364         ELSE
365            CNDNUM = TWO
366         END IF
367*
368         IF( IMAT.EQ.8 ) THEN
369            ANORM = SMALL
370         ELSE IF( IMAT.EQ.9 ) THEN
371            ANORM = LARGE
372         ELSE
373            ANORM = ONE
374         END IF
375*
376      ELSE IF( LSAMEN( 2, C2, 'HE' ) .OR. LSAMEN( 2, C2, 'HP' ) .OR.
377     $         LSAMEN( 2, C2, 'SY' ) .OR. LSAMEN( 2, C2, 'SP' ) ) THEN
378*
379*        xHE, xHP, xSY, xSP: Set parameters to generate a
380*        symmetric or Hermitian matrix.
381*
382*        Set TYPE, the type of matrix to be generated.
383*
384         TYPE = C2( 1: 1 )
385*
386*        Set the lower and upper bandwidths.
387*
388         IF( IMAT.EQ.1 ) THEN
389            KL = 0
390         ELSE
391            KL = MAX( N-1, 0 )
392         END IF
393         KU = KL
394*
395*        Set the condition number and norm.
396*
397         IF( IMAT.EQ.7 ) THEN
398            CNDNUM = BADC1
399         ELSE IF( IMAT.EQ.8 ) THEN
400            CNDNUM = BADC2
401         ELSE
402            CNDNUM = TWO
403         END IF
404*
405         IF( IMAT.EQ.9 ) THEN
406            ANORM = SMALL
407         ELSE IF( IMAT.EQ.10 ) THEN
408            ANORM = LARGE
409         ELSE
410            ANORM = ONE
411         END IF
412*
413      ELSE IF( LSAMEN( 2, C2, 'PB' ) ) THEN
414*
415*        xPB:  Set parameters to generate a symmetric band matrix.
416*
417*        Set TYPE, the type of matrix to be generated.
418*
419         TYPE = 'P'
420*
421*        Set the norm and condition number.
422*
423         IF( IMAT.EQ.5 ) THEN
424            CNDNUM = BADC1
425         ELSE IF( IMAT.EQ.6 ) THEN
426            CNDNUM = BADC2
427         ELSE
428            CNDNUM = TWO
429         END IF
430*
431         IF( IMAT.EQ.7 ) THEN
432            ANORM = SMALL
433         ELSE IF( IMAT.EQ.8 ) THEN
434            ANORM = LARGE
435         ELSE
436            ANORM = ONE
437         END IF
438*
439      ELSE IF( LSAMEN( 2, C2, 'PT' ) ) THEN
440*
441*        xPT:  Set parameters to generate a symmetric positive definite
442*        tridiagonal matrix.
443*
444         TYPE = 'P'
445         IF( IMAT.EQ.1 ) THEN
446            KL = 0
447         ELSE
448            KL = 1
449         END IF
450         KU = KL
451*
452*        Set the condition number and norm.
453*
454         IF( IMAT.EQ.3 ) THEN
455            CNDNUM = BADC1
456         ELSE IF( IMAT.EQ.4 ) THEN
457            CNDNUM = BADC2
458         ELSE
459            CNDNUM = TWO
460         END IF
461*
462         IF( IMAT.EQ.5 .OR. IMAT.EQ.11 ) THEN
463            ANORM = SMALL
464         ELSE IF( IMAT.EQ.6 .OR. IMAT.EQ.12 ) THEN
465            ANORM = LARGE
466         ELSE
467            ANORM = ONE
468         END IF
469*
470      ELSE IF( LSAMEN( 2, C2, 'TR' ) .OR. LSAMEN( 2, C2, 'TP' ) ) THEN
471*
472*        xTR, xTP:  Set parameters to generate a triangular matrix
473*
474*        Set TYPE, the type of matrix to be generated.
475*
476         TYPE = 'N'
477*
478*        Set the lower and upper bandwidths.
479*
480         MAT = ABS( IMAT )
481         IF( MAT.EQ.1 .OR. MAT.EQ.7 ) THEN
482            KL = 0
483            KU = 0
484         ELSE IF( IMAT.LT.0 ) THEN
485            KL = MAX( N-1, 0 )
486            KU = 0
487         ELSE
488            KL = 0
489            KU = MAX( N-1, 0 )
490         END IF
491*
492*        Set the condition number and norm.
493*
494         IF( MAT.EQ.3 .OR. MAT.EQ.9 ) THEN
495            CNDNUM = BADC1
496         ELSE IF( MAT.EQ.4 .OR. MAT.EQ.10 ) THEN
497            CNDNUM = BADC2
498         ELSE
499            CNDNUM = TWO
500         END IF
501*
502         IF( MAT.EQ.5 ) THEN
503            ANORM = SMALL
504         ELSE IF( MAT.EQ.6 ) THEN
505            ANORM = LARGE
506         ELSE
507            ANORM = ONE
508         END IF
509*
510      ELSE IF( LSAMEN( 2, C2, 'TB' ) ) THEN
511*
512*        xTB:  Set parameters to generate a triangular band matrix.
513*
514*        Set TYPE, the type of matrix to be generated.
515*
516         TYPE = 'N'
517*
518*        Set the norm and condition number.
519*
520         IF( IMAT.EQ.2 .OR. IMAT.EQ.8 ) THEN
521            CNDNUM = BADC1
522         ELSE IF( IMAT.EQ.3 .OR. IMAT.EQ.9 ) THEN
523            CNDNUM = BADC2
524         ELSE
525            CNDNUM = TWO
526         END IF
527*
528         IF( IMAT.EQ.4 ) THEN
529            ANORM = SMALL
530         ELSE IF( IMAT.EQ.5 ) THEN
531            ANORM = LARGE
532         ELSE
533            ANORM = ONE
534         END IF
535      END IF
536      IF( N.LE.1 )
537     $   CNDNUM = ONE
538*
539      RETURN
540*
541*     End of ZLATB4
542*
543      END
544