Statistics
| Branch: | Revision:

root / synthbench / euroben-dm / mod2f / .svn / text-base / twiddle.f.svn-base @ 0:839f52ef7657

History | View | Annotate | Download (1.4 kB)

1
      Subroutine twiddle( arr, ari, m, n )
2
! ---------------------------------------------------------------------
3
! --- 'twiddle' does a complex multiplication with the appropriate
4
!     twiddle factors for the elements of 'arr' & 'ari' which represent
5
!     the Real and Imaginary parts of a 1-D 'm*(n*nodes)' length FFT, 
6
!     factored as a sequence of 'n*nodes' FFTs of length 'm'. 'nodes'
7
!     is the number of processors over which the 'm'-length FFTs are
8
!     distributed.
9
! ---------------------------------------------------------------------
10
      Use              mpi_module
11
      Use              numerics
12
      Implicit         None
13

    
14
      Integer       :: m, n
15
      Real(l_)      :: arr(0:m-1,0:n-1), ari(0:m-1,0:n-1)
16

    
17
      Integer       :: i, j, nbase
18
      Real(l_)      :: arg, fac, fr, fi, temp
19
! ---------------------------------------------------------------------
20
      fac   = 8.0_l_ * Atan( 1.0_l_ ) / ( m*n*nodes )
21
      nbase = me*n     
22
      Do j = 0, n - 1
23
         Do i = 0, m - 1
24
            arg      = ( i*( nbase + j ) )*fac
25
            fr       = Cos( arg )
26
            fi       = Sin( arg )
27
            temp     = arr(i,j)*fr - ari(i,j)*fi
28
            ari(i,j) = arr(i,j)*fi + ari(i,j)*fr
29
            arr(i,j) = temp
30
         End Do
31
      End Do
32
! ---------------------------------------------------------------------
33
      End Subroutine twiddle