C
C *** HASKELL'S MATRIX FROM THE LL LAYER TO FREE SURFACE FOR L WAVE ***
C
      SUBROUTINE FLA1(A1,LL,DEP,CV,WN,DNS,VS,THK,ML)
C
      IMPLICIT REAL*8(A-H,O-Z)
      DIMENSION DNS(ML),THK(ML),VS(ML)
      COMPLEX*16 R11,R12,R21,R22,SA11,SA12,SA21,SA22
     *          ,SB11,SB12,SB21,SB22,A1
C
      R11=(1.0D0,0.0D0)
      R12=(0.0D0,0.0D0)
      R21=(0.0D0,0.0D0)
      R22=(1.0D0,0.0D0)
C
      DO 100 IL=LL, 1, -1
C
        SA11=R11
        SA12=R12
        SA21=R21
        SA22=R22
C
        BM=VS(IL)
        SM=DNS(IL)*BM*BM
        CB2=CV*CV/(BM*BM)
        IF(IL.EQ.LL)THEN
          CALL CSTD(WN,BM,CV,CB2,DEP,CQ,STQ,SDQ)
        ELSE
          CALL CSTD(WN,BM,CV,CB2,THK(IL),CQ,STQ,SDQ)
        END IF
C
        SB11=DCMPLX(CQ,0.0D0)
        SB12=DCMPLX(0.0D0,SDQ/SM)
        SB21=DCMPLX(0.0D0,STQ*SM)
        SB22=DCMPLX(CQ,0.0D0)
C
        R11=SA11*SB11+SA12*SB21
        R12=SA11*SB12+SA12*SB22
        R21=SA21*SB11+SA22*SB21
        R22=SA21*SB12+SA22*SB22
C
  100 CONTINUE
C
      A1=R11
C
      RETURN
      END
C
C
C
C
C *** HASKELL'S MATRIX FROM THE (N-1) BOUNDARY TO THE LL LAYER FOR L WAVE ***
C
      SUBROUTINE FLA2(A1,A2,LL,DEP,CV,WN,DNS,VS,THK,ML,NL)
C
      IMPLICIT REAL*8(A-H,O-Z)
      DIMENSION DNS(ML),THK(ML),VS(ML)
      COMPLEX*16 R11,R12,R21,R22,SA11,SA12,SA21,SA22
     *          ,SB11,SB12,SB21,SB22,A1,A2
C
      R11=(1.0D0,0.0D0)
      R12=(0.0D0,0.0D0)
      R21=(0.0D0,0.0D0)
      R22=(1.0D0,0.0D0)
C
      DO 100 IL=NL-1, LL, -1
C
        SA11=R11
        SA12=R12
        SA21=R21
        SA22=R22
C
        BM=VS(IL)
        SM=DNS(IL)*BM*BM
        CB2=CV*CV/(BM*BM)
        IF(IL.EQ.LL)THEN
          CALL CSTD(WN,BM,CV,CB2,THK(IL)-DEP,CQ,STQ,SDQ)
        ELSE
          CALL CSTD(WN,BM,CV,CB2,THK(IL),CQ,STQ,SDQ)
        END IF
C
        SB11=DCMPLX(CQ,0.0D0)
        SB12=DCMPLX(0.0D0,SDQ/SM)
        SB21=DCMPLX(0.0D0,STQ*SM)
        SB22=DCMPLX(CQ,0.0D0)
C
        R11=SA11*SB11+SA12*SB21
        R12=SA11*SB12+SA12*SB22
        R21=SA21*SB11+SA22*SB21
        R22=SA21*SB12+SA22*SB22
C
  100 CONTINUE
C
      A1=R12
      A2=R22
C
      RETURN
      END
