/* This routine was converted by f2c from Linpack source linpack. this version dated 08/14/78 cleve moler, university of new mexico, argonne national lab. */ #include "petsc.h" int Linpack_DGEFA(Scalar *a, int n, int *ipvt) { int i__2, i__3, kp1, nm1, j, k, l,ll; Scalar t,*aa,*ax,*ay; double tmp,max; /* gaussian elimination with partial pivoting */ /* Parameter adjustments */ --ipvt; a -= n + 1; /* Function Body */ nm1 = n - 1; if (nm1 < 1) { goto L70; } for (k = 1; k <= nm1; ++k) { kp1 = k + 1; /* find l = pivot index */ i__2 = n - k + 1; aa = &a[k + k * n]; max = PetscAbsScalar(aa[0]); l = 1; for ( ll=1; ll max) { max = tmp; l = ll+1;} } l += k - 1; ipvt[k] = l; if (a[l + k * n] == 0.) { SETERRQ(k,"Linpack_DGEFA:Zero pivot"); } /* interchange if necessary */ if (l != k) { t = a[l + k * n]; a[l + k * n] = a[k + k * n]; a[k + k * n] = t; } /* compute multipliers */ t = -1. / a[k + k * n]; i__2 = n - k; aa = &a[k + 1 + k * n]; for ( ll=0; ll max) { max = tmp; l = ll+1;} } l += k - 1; ipvt[k] = l; if (a[l + 3*k] == 0.) { SETERRQ(k,"Linpack_DGEFA:Zero pivot"); } /* interchange if necessary */ if (l != k) { t = a[l + 3*k]; a[l + 3*k] = a[4*k]; a[4*k] = t; } /* compute multipliers */ t = -1. / a[4*k]; i__2 = 3 - k; aa = &a[1 + 4*k]; for ( ll=0; ll