C....*...1.........2.........3.........4.........5.........6.........7.*.......8
C     CQSMO    2/17/73
C
C     PURPOSE
C     SMOOTH A CROSS PERIODOGRAM USING WEIGHTS W.
C
C     USAGE
C     CALL CQSMO(C,Q,NP,W,LW,RC,RQ)
C
C     ARGUMENTS
C     C  - REAL PART OF THE CROSS PERIODOGRAM; VECTOR OF LENGTH NP.
C          REAL*8
C     Q  - IMAGINARY PART OF THE CROSS PERIODOGRAM; VECTOR OF LENGTH NP.
C          REAL*8
C     NP - LENGTH OF C, Q, RC, RQ.
C          INTEGER*4
C     W  - INPUT VECTOR OF WEIGHTS.
C          REAL*8
C     LW - LENGTH OF LW.  LW MUST BE AN ODD INTEGER LESS THAN NP.
C          INTEGER*4
C     RC - OUTPUT VECTOR OF LENGTH NP CONTAINING SMOOTHED VALUES OF C.
C          REAL*8
C     RQ - OUTPUT VECTOR OF LENGTH NP CONTAINING SMOOTHED VALUES OF Q.
C          REAL*8
C
C
C
      SUBROUTINE CQSMO(C,Q,NP,W,LW,RC,RQ)
      implicit real*8 (a-h,o-z)
      save
      REAL*8 C(2),Q(1),W(1),RC(1),RQ(1)
      INTEGER*4 CENTER
      C1=C(1)
      C(1)=C(2)
      CENTER=LW/2+1
      DO 15 I=1,NP
      S1=0.d0
      S2=0.d0
      DO 10 J=1,LW
      K=I+J-CENTER
      IF(K.LE.0)  S1=S1+W(J)*C(IABS(K)+2)
      IF(K.LE.0)  S2=S2-W(J)*Q(IABS(K)+2)
      IF(K.GE.NP) S1=S1+W(J)*C(NP+NP-K)
      IF(K.GE.NP) S2=S2-W(J)*Q(NP+NP-K)
      IF((K.GT.0).AND.(K.LT.NP)) S1=S1+W(J)*C(K)
10    IF((K.GT.0).AND.(K.LT.NP)) S2=S2+W(J)*Q(K)
      RC(I)=S1
15    RQ(I)=S2
      C(1)=C1
      RETURN
      END
