Debian Codegraph @

debian/external_deps/fetk/punc/src/cgcode/donest.c

raw
1 /* ./src_f77/donest.f -- translated by f2c (version 20030320).
2 You must link the resulting object file with the libraries:
3 -lf2c -lm (in that order)
4 */
5
6 #include <punc/vf2c.h>
7
8 /* Table of constant values */
9
10 static integer c__1 = 1;
11
12 /* Subroutine */ int donest_(integer *iounit, doublereal *d__, doublereal *e,
13 doublereal *w1, doublereal *w2, integer *ind, integer *nt, doublereal
14 *eigmin, doublereal *eigmax, doublereal *cond)
15 {
16 /* Format strings */
17 static char fmt_15[] = "(/,\002 WARNING IN DONEST: SRATQR RETURNED IERR "
18 "= \002,i5,/)";
19 static char fmt_50[] = "(4x,\002 MIN, MAX EIGENVALUES = \002,d12.5,\002 "
20 "AND \002,d12.5,/,4x,\002 CONDITION NUMBER = \002,d12.5,/)";
21
22 /* System generated locals */
23 integer i__1;
24 doublereal d__1, d__2;
25
26 /* Builtin functions */
27 integer s_wsfe(cilist *), do_fio(integer *, char *, ftnlen), e_wsfe(void);
28
29 /* Local variables */
30 static integer i__;
31 static doublereal eps1;
32 static integer ierr;
33 static logical type__;
34 extern /* Subroutine */ int sratqr_(integer *, doublereal *, doublereal *,
35 doublereal *, doublereal *, integer *, doublereal *, integer *,
36 doublereal *, logical *, integer *, integer *);
37
38 /* Fortran I/O blocks */
39 static cilist io___5 = { 0, 0, 0, fmt_15, 0 };
40 static cilist io___6 = { 0, 0, 0, fmt_15, 0 };
41 static cilist io___7 = { 0, 0, 0, fmt_50, 0 };
42
43
44 /* ***BEGIN PROLOGUE DONEST */
45 /* ***REFER TO DPPCG,DPCGCA */
46 /* ***ROUTINES CALLED SRATQR */
47 /* ***REVISION DATE 860901 (YYMMDD) */
48 /* ***END PROLOGUE DONEST */
49
50 /* THIS SUBROUTINE COMPUTES THE SMALLEST AND LARGEST EIGENVALUES OF */
51 /* A SYMMETRIC POSITIVE DEFINITE TRIDIAGONAL MATRIX OF ORDER NT. THE */
52 /* DIAGONAL IS STORED IN THE ARRAY D AND THE SUB-DIAG IS STORED IN */
53 /* THE LAST NT-1 POSITIONS OF THE ARRAY E. EIGMIN AND EIGMAX ARE */
54 /* UPDATED WITH EACH CALL TO DONEST. ONCE THESE ARE DETERMINED, AN */
55 /* ESTIMATE FOR THE CONDITION NUMBER IS COMPUTED. THE ARRAYS D AND */
56 /* E ARE UNALTERED. TWO DBLE WORK ARRAYS (W1, W2) AND ONE INTEGER */
57 /* WORK ARRAY (IND) MUST BE PASSED. */
58
59 /* *** DECLARATIONS *** */
60
61 /* ***FIRST EXECUTABLE STATEMENT DONEST */
62 /* Parameter adjustments */
63 --ind;
64 --w2;
65 --w1;
66 --e;
67 --d__;
68
69 /* Function Body */
70 /* L1: */
71
72 /* *** FIND SMALLEST EIGENVALUE *** */
73 eps1 = 0.;
74 type__ = TRUE_;
75 i__1 = *nt;
76 for (i__ = 2; i__ <= i__1; ++i__) {
77 /* Computing 2nd power */
78 d__1 = e[i__];
79 w1[i__] = d__1 * d__1;
80 /* L10: */
81 }
82 sratqr_(nt, &eps1, &d__[1], &e[1], &w1[1], &c__1, &w2[1], &ind[1], &w1[1],
83 &type__, &c__1, &ierr);
84 if (ierr != 0) {
85 io___5.ciunit = *iounit;
86 s_wsfe(&io___5);
87 do_fio(&c__1, (char *)&ierr, (ftnlen)sizeof(integer));
88 e_wsfe();
89 } else {
90 *eigmin = min(*eigmin,w2[1]);
91 }
92
93 /* *** FIND LARGEST EIGENVALUE *** */
94 eps1 = 0.;
95 type__ = FALSE_;
96 i__1 = *nt;
97 for (i__ = 2; i__ <= i__1; ++i__) {
98 /* Computing 2nd power */
99 d__1 = e[i__];
100 w1[i__] = d__1 * d__1;
101 /* L20: */
102 }
103 sratqr_(nt, &eps1, &d__[1], &e[1], &w1[1], &c__1, &w2[1], &ind[1], &w1[1],
104 &type__, &c__1, &ierr);
105 if (ierr != 0) {
106 io___6.ciunit = *iounit;
107 s_wsfe(&io___6);
108 do_fio(&c__1, (char *)&ierr, (ftnlen)sizeof(integer));
109 e_wsfe();
110 } else {
111 *eigmax = max(*eigmax,w2[1]);
112 }
113
114 /* *** UPDATE CONDITION NUMBER ESTIMATE *** */
115 /* Computing MAX */
116 d__1 = 1., d__2 = *eigmax / *eigmin, d__1 = max(d__1,d__2);
117 *cond = max(d__1,*cond);
118 if (*iounit > 0) {
119 io___7.ciunit = *iounit;
120 s_wsfe(&io___7);
121 do_fio(&c__1, (char *)&(*eigmin), (ftnlen)sizeof(doublereal));
122 do_fio(&c__1, (char *)&(*eigmax), (ftnlen)sizeof(doublereal));
123 do_fio(&c__1, (char *)&(*cond), (ftnlen)sizeof(doublereal));
124 e_wsfe();
125 }
126
127 return 0;
128 } /* donest_ */
129