      subroutine salwz(a,r1,r2,m,l,lda,job)
      integer m,l,lda,job
      double complex a(lda,l),r1(l),r2(l)
c
c     salwz computes the direct or inverse discrete fourier
c     transformation for rows of a double complex rectangular matrix .
c
c     on entry
c
c        a       double complex(m,l)
c                the input matrix .
c
c        r1      double complex(l)
c                a work vector .
c
c        r2      double complex(l)
c                a work vector .
c
c        m       integer
c                the number of rows of the matrix a .
c
c        l       integer
c                the number of columns of the matrix a .
c
c        lda     integer
c                the leading dimension of the array a .
c
c        job     integer
c                = 1 for direct fourier transformation .
c                = -1 for inverse fourier transformation .
c
c     on return
c
c        a       the transformed rows of the matrix .
c
c     toeplitz package. this version dated 07/23/82 .
c
c     subroutines and functions
c
c        fortran ... dcmplx,dcos,dfloat,dsin
c
c     internal variables
c
      integer i,i1,i2
      double precision p,ri,rl,v1,v2
      double complex e,f
c
      if (l .eq. 1) go to 60
      rl = dfloat(l)
c
      r1(1) = (1.0d0,0.0d0)
      ri = 0.0d0
      do 10 i1 = 2, l
         ri = ri + 1.0d0
c
c        minimize error in forming multiples of 2*pi .
c
         p = ((201.d0/32.d0)*ri + 1.93530717958647692528d-3*ri)/rl
c
         v1 = dcos(p)
         v2 = dsin(p)
         if (job .eq. (-1)) v2 = -v2
         r1(i1) = dcmplx(v1,v2)
   10 continue
      do 50 i = 1, m
         do 30 i1 = 1, l
            e = r1(i1)
            f = a(i,1)
            do 20 i2 = 2, l
               f = e*f + a(i,i2)
   20       continue
            r2(i1) = e*f
   30    continue
         do 40 i1 = 1, l
            a(i,i1) = r2(i1)
   40    continue
   50 continue
   60 continue
      return
      end