#ifndef lint static char vcid[] = "$Id: dgefa3.c,v 1.3 1996/04/28 02:44:31 bsmith Exp bsmith $"; #endif /* Inverts 3 by 3 matrix using partial pivoting. */ #include "petsc.h" int Kernel_A_gets_inverse_A_3(Scalar *a) { int i__2, i__3, kp1, j, k, l,ll,i,ipvt_l[3],*ipvt = ipvt_l-1,kb,k3; int k4,j3; Scalar *aa,*ax,*ay,work_l[9],*work = work_l-1,stmp; double tmp,max; /* gaussian elimination with partial pivoting */ /* Parameter adjustments */ a -= 4; for (k = 1; k <= 2; ++k) { kp1 = k + 1; k3 = 3*k; k4 = k3 + k; /* find l = pivot index */ i__2 = 4 - k; aa = &a[k4]; 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 + k3] == 0.) { SETERRQ(k,"Linpack_DGEFA:Zero pivot"); } /* interchange if necessary */ if (l != k) { stmp = a[l + k3]; a[l + k3] = a[k4]; a[k4] = stmp; } /* compute multipliers */ stmp = -1. / a[k4]; i__2 = 3 - k; aa = &a[1 + k4]; for ( ll=0; ll