4
* -- SuperLU routine (version 2.0) --
5
* Univ. of California Berkeley, Xerox Palo Alto Research Center,
6
* and Lawrence Berkeley National Lab.
15
sPivotGrowth(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_S; 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_S; 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_S; Mtype = TRU.
51
float *Aval, *Lval, *Uval;
52
int fsupc, nsupr, luptr, nz_in_U;
55
float rpg, maxaj, maxuj;
56
extern double slamch_(char *);
60
/* Get machine constants. */
61
smlnum = slamch_("S");
71
inv_perm_c = (int *) SUPERLU_MALLOC(A->ncol*sizeof(int));
72
for (j = 0; j < A->ncol; ++j) inv_perm_c[perm_c[j]] = j;
74
for (k = 0; k <= Lstore->nsuper; ++k) {
75
fsupc = L_FST_SUPC(k);
76
nsupr = L_SUB_START(fsupc+1) - L_SUB_START(fsupc);
77
luptr = L_NZ_START(fsupc);
81
for (j = fsupc; j < L_FST_SUPC(k+1) && j < ncols; ++j) {
83
oldcol = inv_perm_c[j];
84
for (i = Astore->colptr[oldcol]; i < Astore->colptr[oldcol+1]; ++i)
85
maxaj = SUPERLU_MAX( maxaj, fabs(Aval[i]) );
88
for (i = Ustore->colptr[j]; i < Ustore->colptr[j+1]; i++)
89
maxuj = SUPERLU_MAX( maxuj, fabs(Uval[i]) );
92
for (i = 0; i < nz_in_U; ++i)
93
maxuj = SUPERLU_MAX( maxuj, fabs(luval[i]) );
99
rpg = SUPERLU_MIN( rpg, 1.);
101
rpg = SUPERLU_MIN( rpg, maxaj / maxuj );
104
if ( j >= ncols ) break;
107
SUPERLU_FREE(inv_perm_c);