aboutsummaryrefslogtreecommitdiff
path: root/math/ieee/chap1/iftasm.f
blob: 6ec12c7d729a1da4d925c44d6e4539fe5e65f634 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
c
c-----------------------------------------------------------------------
c subroutine: iftasm
c compute idft for real, antisymmetric, n-point sequence x(m) using
c n/2-point fft
c antisymmetric sequence means x(m)=-x(n-m), m=1,...,n/2-1
c note: index m is sequence index--not fortran index
c-----------------------------------------------------------------------
c
      subroutine iftasm(x, n, y)
      dimension x(1), y(1)
c
c x = imaginary array which on input contains the n/2+1 real points of
c     the transform of the input--i.e. the zero valued real parts
c     are not given as input
c     on output x contains the n/2 points of the time sequence
c     (antisymmetrical)
c n = true size of input
c y = scratch array of size n/2+2
c
c
c for n = 2, assume x(1)=0, x(2)=0
c
      if (n.gt.2) go to 10
      x(1) = 0
      x(2) = 0
      return
  10  twopi = 8.*atan(1.0)
c
c first compute x1=x(1) term directly
c use recursion on the sine cosine terms
c
      no2 = n/2
      no4 = n/4
      tpn = twopi/float(n)
c
c scramble original dft (x(k)) to give y(k)
c use recursion relation to give sin(tpn*i) multiplier
c
      cosi = cos(tpn)
      sini = sin(tpn)
      cosd = cosi
      sind = sini
      nind = no4 + 1
      do 20 i=2,nind
        ind = 2*i
        ind1 = no2 + 2 - i
        ak = (x(i)-x(ind1))/2.
        bk = -(x(i)+x(ind1))
        y(ind) = ak
        y(ind-1) = bk*sini
        temp = cosi*cosd - sini*sind
        sini = cosi*sind + sini*cosd
        cosi = temp
  20  continue
      y(1) = 0.
      y(2) = 0.
c
c take n/2 point idft of y
c
      call fsst(y, no2)
c
c form x sequence from y sequence
c
      x(2) = y(1)/2.
      x(1) = 0.
      if (n.eq.4) go to 40
      do 30 i=2,no4
        ind = 2*i
        ind1 = no2 + 2 - i
        x(ind-1) = (y(i)-y(ind1))/2.
        t1 = (y(i)+y(ind1))/2.
        x(ind) = t1 + x(ind-2)
  30  continue
  40  x(no2) = -y(no4+1)/2.
      return
      end