~ubuntu-branches/ubuntu/lucid/igraph/lucid

« back to all changes in this revision

Viewing changes to src/arpack/dsconv.c

  • Committer: Bazaar Package Importer
  • Author(s): Mathieu Malaterre
  • Date: 2009-11-16 18:12:42 UTC
  • Revision ID: james.westby@ubuntu.com-20091116181242-mzv9p5fz9uj57xd1
Tags: upstream-0.5.3
ImportĀ upstreamĀ versionĀ 0.5.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*  -- translated by f2c (version 20050501).
 
2
   You must link the resulting object file with libf2c:
 
3
        on Microsoft Windows system, link with libf2c.lib;
 
4
        on Linux or Unix systems, link with .../path/to/libf2c.a -lm
 
5
        or, if you install libf2c.a in a standard place, with -lf2c -lm
 
6
        -- in that order, at the end of the command line, as in
 
7
                cc *.o -lf2c -lm
 
8
        Source for libf2c is in /netlib/f2c/libf2c.zip, e.g.,
 
9
 
 
10
                http://www.netlib.org/f2c/libf2c.zip
 
11
*/
 
12
 
 
13
#include "config.h"
 
14
#include "arpack_internal.h"
 
15
#include "f2c.h"
 
16
 
 
17
/* Common Block Declarations */
 
18
 
 
19
/* static struct { */
 
20
/*     integer logfil, ndigit, mgetv0, msaupd, msaup2, msaitr, mseigt, msapps,  */
 
21
/*          msgets, mseupd, mnaupd, mnaup2, mnaitr, mneigh, mnapps, mngets,  */
 
22
/*          mneupd, mcaupd, mcaup2, mcaitr, mceigh, mcapps, mcgets, mceupd; */
 
23
/* } debug_; */
 
24
 
 
25
/* #define debug_1 debug_ */
 
26
 
 
27
static struct {
 
28
    integer nopx, nbx, nrorth, nitref, nrstrt;
 
29
    real tsaupd, tsaup2, tsaitr, tseigt, tsgets, tsapps, tsconv, tnaupd, 
 
30
            tnaup2, tnaitr, tneigh, tngets, tnapps, tnconv, tcaupd, tcaup2, 
 
31
            tcaitr, tceigh, tcgets, tcapps, tcconv, tmvopx, tmvbx, tgetv0, 
 
32
            titref, trvec;
 
33
} timing_;
 
34
 
 
35
#define timing_1 timing_
 
36
 
 
37
/* Table of constant values */
 
38
 
 
39
static doublereal c_b3 = .66666666666666663;
 
40
 
 
41
/* ----------------------------------------------------------------------- */
 
42
/* \BeginDoc */
 
43
 
 
44
/* \Name: dsconv */
 
45
 
 
46
/* \Description: */
 
47
/*  Convergence testing for the symmetric Arnoldi eigenvalue routine. */
 
48
 
 
49
/* \Usage: */
 
50
/*  call dsconv */
 
51
/*     ( N, RITZ, BOUNDS, TOL, NCONV ) */
 
52
 
 
53
/* \Arguments */
 
54
/*  N       Integer.  (INPUT) */
 
55
/*          Number of Ritz values to check for convergence. */
 
56
 
 
57
/*  RITZ    Double precision array of length N.  (INPUT) */
 
58
/*          The Ritz values to be checked for convergence. */
 
59
 
 
60
/*  BOUNDS  Double precision array of length N.  (INPUT) */
 
61
/*          Ritz estimates associated with the Ritz values in RITZ. */
 
62
 
 
63
/*  TOL     Double precision scalar.  (INPUT) */
 
64
/*          Desired relative accuracy for a Ritz value to be considered */
 
65
/*          "converged". */
 
66
 
 
67
/*  NCONV   Integer scalar.  (OUTPUT) */
 
68
/*          Number of "converged" Ritz values. */
 
69
 
 
70
/* \EndDoc */
 
71
 
 
72
/* ----------------------------------------------------------------------- */
 
73
 
 
74
/* \BeginLib */
 
75
 
 
76
/* \Routines called: */
 
77
/*     second  ARPACK utility routine for timing. */
 
78
/*     dlamch  LAPACK routine that determines machine constants. */
 
79
 
 
80
/* \Author */
 
81
/*     Danny Sorensen               Phuong Vu */
 
82
/*     Richard Lehoucq              CRPC / Rice University */
 
83
/*     Dept. of Computational &     Houston, Texas */
 
84
/*     Applied Mathematics */
 
85
/*     Rice University */
 
86
/*     Houston, Texas */
 
87
 
 
88
/* \SCCS Information: @(#) */
 
89
/* FILE: sconv.F   SID: 2.4   DATE OF SID: 4/19/96   RELEASE: 2 */
 
90
 
 
91
/* \Remarks */
 
92
/*     1. Starting with version 2.4, this routine no longer uses the */
 
93
/*        Parlett strategy using the gap conditions. */
 
94
 
 
95
/* \EndLib */
 
96
 
 
97
/* ----------------------------------------------------------------------- */
 
98
 
 
99
/* Subroutine */ int igraphdsconv_(integer *n, doublereal *ritz, doublereal *
 
100
        bounds, doublereal *tol, integer *nconv)
 
101
{
 
102
    /* System generated locals */
 
103
    integer i__1;
 
104
    doublereal d__1, d__2, d__3;
 
105
 
 
106
    /* Builtin functions */
 
107
    double igraphpow_dd(doublereal *, doublereal *);
 
108
 
 
109
    /* Local variables */
 
110
    static integer i__;
 
111
    static real t0, t1;
 
112
    static doublereal eps23, temp;
 
113
    extern doublereal igraphdlamch_(char *);
 
114
    extern /* Subroutine */ int igraphsecond_(real *);
 
115
 
 
116
 
 
117
/*     %----------------------------------------------------% */
 
118
/*     | Include files for debugging and timing information | */
 
119
/*     %----------------------------------------------------% */
 
120
 
 
121
 
 
122
/* \SCCS Information: @(#) */
 
123
/* FILE: debug.h   SID: 2.3   DATE OF SID: 11/16/95   RELEASE: 2 */
 
124
 
 
125
/*     %---------------------------------% */
 
126
/*     | See debug.doc for documentation | */
 
127
/*     %---------------------------------% */
 
128
 
 
129
/*     %------------------% */
 
130
/*     | Scalar Arguments | */
 
131
/*     %------------------% */
 
132
 
 
133
/*     %--------------------------------% */
 
134
/*     | See stat.doc for documentation | */
 
135
/*     %--------------------------------% */
 
136
 
 
137
/* \SCCS Information: @(#) */
 
138
/* FILE: stat.h   SID: 2.2   DATE OF SID: 11/16/95   RELEASE: 2 */
 
139
 
 
140
 
 
141
 
 
142
/*     %-----------------% */
 
143
/*     | Array Arguments | */
 
144
/*     %-----------------% */
 
145
 
 
146
 
 
147
/*     %---------------% */
 
148
/*     | Local Scalars | */
 
149
/*     %---------------% */
 
150
 
 
151
 
 
152
/*     %-------------------% */
 
153
/*     | External routines | */
 
154
/*     %-------------------% */
 
155
 
 
156
/*     %---------------------% */
 
157
/*     | Intrinsic Functions | */
 
158
/*     %---------------------% */
 
159
 
 
160
 
 
161
/*     %-----------------------% */
 
162
/*     | Executable Statements | */
 
163
/*     %-----------------------% */
 
164
 
 
165
    /* Parameter adjustments */
 
166
    --bounds;
 
167
    --ritz;
 
168
 
 
169
    /* Function Body */
 
170
    igraphsecond_(&t0);
 
171
 
 
172
    eps23 = igraphdlamch_("Epsilon-Machine");
 
173
    eps23 = igraphpow_dd(&eps23, &c_b3);
 
174
 
 
175
    *nconv = 0;
 
176
    i__1 = *n;
 
177
    for (i__ = 1; i__ <= i__1; ++i__) {
 
178
 
 
179
/*        %-----------------------------------------------------% */
 
180
/*        | The i-th Ritz value is considered "converged"       | */
 
181
/*        | when: bounds(i) .le. TOL*max(eps23, abs(ritz(i)))   | */
 
182
/*        %-----------------------------------------------------% */
 
183
 
 
184
/* Computing MAX */
 
185
        d__2 = eps23, d__3 = (d__1 = ritz[i__], abs(d__1));
 
186
        temp = max(d__2,d__3);
 
187
        if (bounds[i__] <= *tol * temp) {
 
188
            ++(*nconv);
 
189
        }
 
190
 
 
191
/* L10: */
 
192
    }
 
193
 
 
194
    igraphsecond_(&t1);
 
195
    timing_1.tsconv += t1 - t0;
 
196
 
 
197
    return 0;
 
198
 
 
199
/*     %---------------% */
 
200
/*     | End of dsconv | */
 
201
/*     %---------------% */
 
202
 
 
203
} /* igraphdsconv_ */
 
204