4
* -- SuperLU routine (version 2.0) --
5
* Univ. of California Berkeley, Xerox Palo Alto Research Center,
6
* and Lawrence Berkeley National Lab.
12
* History: Modified from lapack routines ZGECON.
19
zgscon(char *norm, SuperMatrix *L, SuperMatrix *U,
20
double anorm, double *rcond, int *info)
26
ZGSCON estimates the reciprocal of the condition number of a general
27
real matrix A, in either the 1-norm or the infinity-norm, using
28
the LU factorization computed by ZGETRF.
30
An estimate is obtained for norm(inv(A)), and the reciprocal of the
31
condition number is computed as
32
RCOND = 1 / ( norm(A) * norm(inv(A)) ).
34
See supermatrix.h for the definition of 'SuperMatrix' structure.
40
Specifies whether the 1-norm condition number or the
41
infinity-norm condition number is required:
45
L (input) SuperMatrix*
46
The factor L from the factorization Pr*A*Pc=L*U as computed by
47
zgstrf(). Use compressed row subscripts storage for supernodes,
48
i.e., L has types: Stype = SC, Dtype = Z_, Mtype = TRLU.
50
U (input) SuperMatrix*
51
The factor U from the factorization Pr*A*Pc=L*U as computed by
52
zgstrf(). Use column-wise storage scheme, i.e., U has types:
53
Stype = NC, Dtype = Z_, Mtype = TRU.
56
If NORM = '1' or 'O', the 1-norm of the original matrix A.
57
If NORM = 'I', the infinity-norm of the original matrix A.
59
RCOND (output) double*
60
The reciprocal of the condition number of the matrix A,
61
computed as RCOND = 1/(norm(A) * norm(inv(A))).
65
< 0: if INFO = -i, the i-th argument had an illegal value
67
=====================================================================
71
int kase, kase1, onenrm, i;
74
extern int zrscl_(int *, doublecomplex *, doublecomplex *, int *);
76
extern int zlacon_(int *, doublecomplex *, doublecomplex *, double *, int *);
79
/* Test the input parameters. */
81
onenrm = *(unsigned char *)norm == '1' || lsame_(norm, "O");
82
if (! onenrm && ! lsame_(norm, "I")) *info = -1;
83
else if (L->nrow < 0 || L->nrow != L->ncol ||
84
L->Stype != SC || L->Dtype != Z_ || L->Mtype != TRLU)
86
else if (U->nrow < 0 || U->nrow != U->ncol ||
87
U->Stype != NC || U->Dtype != Z_ || U->Mtype != TRU)
91
xerbla_("zgscon", &i);
95
/* Quick return if possible */
97
if ( L->nrow == 0 || U->nrow == 0) {
102
work = doublecomplexCalloc( 3*L->nrow );
106
ABORT("Malloc fails for work arrays in zgscon.");
108
/* Estimate the norm of inv(A). */
110
if ( onenrm ) kase1 = 1;
115
zlacon_(&L->nrow, &work[L->nrow], &work[0], &ainvnm, &kase);
117
if (kase == 0) break;
120
/* Multiply by inv(L). */
121
sp_ztrsv("Lower", "No transpose", "Unit", L, U, &work[0], info);
123
/* Multiply by inv(U). */
124
sp_ztrsv("Upper", "No transpose", "Non-unit", L, U, &work[0],info);
128
/* Multiply by inv(U'). */
129
sp_ztrsv("Upper", "Transpose", "Non-unit", L, U, &work[0], info);
131
/* Multiply by inv(L'). */
132
sp_ztrsv("Lower", "Transpose", "Unit", L, U, &work[0], info);
136
} while ( kase != 0 );
138
/* Compute the estimate of the reciprocal condition number. */
139
if (ainvnm != 0.) *rcond = (1. / ainvnm) / anorm;