4
* -- SuperLU routine (version 2.0) --
5
* Univ. of California Berkeley, Xerox Palo Alto Research Center,
6
* and Lawrence Berkeley National Lab.
15
zPivotGrowth(int ncols, SuperMatrix *A, int *perm_c,
16
SuperMatrix *L, SuperMatrix *U)
22
* Compute the reciprocal pivot growth factor of the leading ncols columns
23
* of the matrix, using the formula:
24
* min_j ( max_i(abs(A_ij)) / max_i(abs(U_ij)) )
30
* The number of columns of matrices A, L and U.
32
* A (input) SuperMatrix*
33
* Original matrix A, permuted by columns, of dimension
34
* (A->nrow, A->ncol). The type of A can be:
35
* Stype = NC; Dtype = SLU_Z; Mtype = GE.
37
* L (output) SuperMatrix*
38
* The factor L from the factorization Pr*A=L*U; use compressed row
39
* subscripts storage for supernodes, i.e., L has type:
40
* Stype = SC; Dtype = SLU_Z; Mtype = TRLU.
42
* U (output) SuperMatrix*
43
* The factor U from the factorization Pr*A*Pc=L*U. Use column-wise
44
* storage scheme, i.e., U has types: Stype = NC;
45
* Dtype = SLU_Z; Mtype = TRU.
51
doublecomplex *Aval, *Lval, *Uval;
52
int fsupc, nsupr, luptr, nz_in_U;
55
double rpg, maxaj, maxuj;
56
extern double dlamch_(char *);
59
doublecomplex temp_comp;
61
/* Get machine constants. */
62
smlnum = dlamch_("S");
72
inv_perm_c = (int *) SUPERLU_MALLOC(A->ncol*sizeof(int));
73
for (j = 0; j < A->ncol; ++j) inv_perm_c[perm_c[j]] = j;
75
for (k = 0; k <= Lstore->nsuper; ++k) {
76
fsupc = L_FST_SUPC(k);
77
nsupr = L_SUB_START(fsupc+1) - L_SUB_START(fsupc);
78
luptr = L_NZ_START(fsupc);
82
for (j = fsupc; j < L_FST_SUPC(k+1) && j < ncols; ++j) {
84
oldcol = inv_perm_c[j];
85
for (i = Astore->colptr[oldcol]; i < Astore->colptr[oldcol+1]; ++i)
86
maxaj = SUPERLU_MAX( maxaj, z_abs1( &Aval[i]) );
89
for (i = Ustore->colptr[j]; i < Ustore->colptr[j+1]; i++)
90
maxuj = SUPERLU_MAX( maxuj, z_abs1( &Uval[i]) );
93
for (i = 0; i < nz_in_U; ++i)
94
maxuj = SUPERLU_MAX( maxuj, z_abs1( &luval[i]) );
100
rpg = SUPERLU_MIN( rpg, 1.);
102
rpg = SUPERLU_MIN( rpg, maxaj / maxuj );
105
if ( j >= ncols ) break;
108
SUPERLU_FREE(inv_perm_c);