C....*...1.........2.........3.........4.........5.........6.........7.*.......8
C     DCXSX    10/15/74
C
C     PURPOSE
C     COMPUTE:
C     CX=SUM(X(I)*COS((I-1)*W))    (I=1,2,...,N)
C     SX=SUM(X(I)*SIN((I-1)*W))    (I=1,2,...,N)
C
C     USAGE
C     CALL DCXSX(X,N,W,CX,SX)
C
C     ARGUMENTS
C     X  - INPUT VECTOR OF LENGTH N.
C          REAL*8
C     N  - LENGTH OF X.
C          INTEGER
C     W  - FREQUENCY IN RADIANS.
C          REAL*8
C     CX - COSINE TRANSFORM
C          REAL*8
C     SX - SINE TRANSFORM
C          REAL*8
C
C     REFERENCE
C     R. C. SINGLETON.  AN ALGORITHM FOR COMPUTING THE MIXED RADIX FAST
C     FOURIER TRANSFORM. IEEE TRANSACTIONS ON AUDIO AND ELECTROACOUSTICS
C     AU-17.  JUNE 1969.
C
      SUBROUTINE DCXSX(X,N,W,CX,SX)
      IMPLICIT REAL*8 (A-H,O-Z)
      save
      REAL*8 X(1),W,CX,SX
      REAL*8 RN,IN,RZK,IZK,RZN,IZN
      RN=-2.D0*DSIN(W/2.D0)**2
      IN=DSIN(W)
      LX=N
      L=N-1
      RZK=X(LX)
      IZK=0.D0
      DO 10 K=1,L
      I=LX-K
      RZN=RN*RZK-IN*IZK+RZK+X(I)
      IZN=RN*IZK+IN*RZK+IZK
      RZK=RZN
10    IZK=IZN
      CX=RZN
      SX=IZN
      RETURN
      END
