4
* -- SuperLU routine (version 2.0) --
5
* Univ. of California Berkeley, Xerox Palo Alto Research Center,
6
* and Lawrence Berkeley National Lab.
15
clacon_(int *n, complex *v, complex *x, float *est, int *kase)
22
CLACON estimates the 1-norm of a square matrix A.
23
Reverse communication is used for evaluating matrix-vector products.
30
The order of the matrix. N >= 1.
32
V (workspace) COMPLEX PRECISION array, dimension (N)
33
On the final return, V = A*W, where EST = norm(V)/norm(W)
36
X (input/output) COMPLEX PRECISION array, dimension (N)
37
On an intermediate return, X should be overwritten by
40
where A' is the conjugate transpose of A,
41
and CLACON must be re-called with all the other parameters
45
EST (output) FLOAT PRECISION
46
An estimate (a lower bound) for norm(A).
48
KASE (input/output) INT
49
On the initial call to CLACON, KASE should be 0.
50
On an intermediate return, KASE will be 1 or 2, indicating
51
whether X should be overwritten by A * X or A' * X.
52
On the final return from CLACON, KASE will again be 0.
57
Contributed by Nick Higham, University of Manchester.
58
Originally named CONEST, dated March 16, 1988.
60
Reference: N.J. Higham, "FORTRAN codes for estimating the one-norm of
61
a real or complex matrix, with applications to condition estimation",
62
ACM Trans. Math. Soft., vol. 14, no. 4, pp. 381-396, December 1988.
63
=====================================================================
66
/* Table of constant values */
68
complex zero = {0.0, 0.0};
69
complex one = {1.0, 0.0};
71
/* System generated locals */
76
static int jump, jlast;
77
static float altsgn, estold;
81
extern double slamch_(char *);
82
extern int icmax1_(int *, complex *, int *);
83
extern double scsum1_(int *, complex *, int *);
85
safmin = slamch_("Safe minimum");
87
for (i = 0; i < *n; ++i) {
88
x[i].r = 1. / (float) (*n);
104
/* ................ ENTRY (JUMP = 1)
105
FIRST ITERATION. X HAS BEEN OVERWRITTEN BY A*X. */
113
*est = scsum1_(n, x, &c__1);
115
for (i = 0; i < *n; ++i) {
129
/* ................ ENTRY (JUMP = 2)
130
FIRST ITERATION. X HAS BEEN OVERWRITTEN BY TRANSPOSE(A)*X. */
132
j = icmax1_(n, &x[0], &c__1);
136
/* MAIN LOOP - ITERATIONS 2,3,...,ITMAX. */
138
for (i = 0; i < *n; ++i) x[i] = zero;
144
/* ................ ENTRY (JUMP = 3)
145
X HAS BEEN OVERWRITTEN BY A*X. */
148
CCOPY(n, x, &c__1, v, &c__1);
150
ccopy_(n, x, &c__1, v, &c__1);
153
*est = scsum1_(n, v, &c__1);
157
/* TEST FOR CYCLING. */
158
if (*est <= estold) goto L120;
160
for (i = 0; i < *n; ++i) {
174
/* ................ ENTRY (JUMP = 4)
175
X HAS BEEN OVERWRITTEN BY TRANDPOSE(A)*X. */
178
j = icmax1_(n, &x[0], &c__1);
180
if (x[jlast].r != (d__1 = x[j].r, fabs(d__1)) && iter < 5) {
185
/* ITERATION COMPLETE. FINAL STAGE. */
188
for (i = 1; i <= *n; ++i) {
189
x[i-1].r = altsgn * ((float)(i - 1) / (float)(*n - 1) + 1.);
197
/* ................ ENTRY (JUMP = 5)
198
X HAS BEEN OVERWRITTEN BY A*X. */
200
temp = scsum1_(n, x, &c__1) / (float)(*n * 3) * 2.;
203
CCOPY(n, &x[0], &c__1, &v[0], &c__1);
205
ccopy_(n, &x[0], &c__1, &v[0], &c__1);