       subroutine trifac(a,i,b,j,c,k,m,n)
C
C  factor tridiagonal system into LDU.  L replaces a, 1/D replaces b, and
C  U replaces c.  Diagonals of L and U are identically 1 and not stored.
C  a(1) and c(n) are unused placeholders
C
C
      implicit none
      integer i,j,k,m,n
      real a(i,n),b(j,n),c(k,n)
C
#define A(im) a(ii,im)
#define B(im) b(ii,im)
#define C(im) c(ii,im)
#define L(im) a(ii,im)
#define D(im) b(ii,im)
#define U(im) c(ii,im)
C
      integer ii,im
C
      if(n.le.0) return
C
C###23 [fc] Loop on line 23 of trifac.f (DO II) fully vectorized%%%
      do ii=1,m
	  D(1)=1.0/B(1)
	  U(1)=C(1)*D(1)
      enddo
C
      do im=2,n-1,1
C###29 [fc] Loop on line 29 of trifac.f (DO II) fully vectorized%%%
	  do ii=1,m
	       D(im)=1.0/(B(im)-A(im)*U(im-1))
	       L(im)=A(im)*D(im-1)
	       U(im)=C(im)*D(im)
	  enddo
      enddo
C
      if(n.eq.1) return
C
C###38 [fc] Loop on line 38 of trifac.f (DO II) fully vectorized%%%
      do ii=1,m
	  D(n)=1.0/(B(n)-A(n)*U(n-1))
	  L(n)=A(n)*D(n-1)
      enddo
C
      return
      end
