c    @(#)trdi.f	1.2
      subroutine trdi (n,a,b,c,y,x,ks,work)
      dimension       a(n)       ,b(n)       ,c(n)       ,y(n)       ,
     1                x(n)       ,work(2*n-2)
  103 format(45h0array dimension n not greater than 2 in trdi)
  104 format('0hks not equal to 0 or 1 in call to trdi')
      if (n .gt. 2) go to 101
      print 103
      return
  101 continue
      if (ks.eq.0 .or. ks.eq.1) go to 102
      print 104
      return
  102 continue
      call trdslv (n,a,b,c,y,x,ks,work(1),work(n))
      return
      end
