program main
  use dot_fft_mod
  use sep
  implicit none
  
  

  integer  :: nw1, nw2, nw3, nw4
  integer  :: nt, nw
  real     :: dt, dw
  real     :: f1, f2, f3, f4, w1, w2, w3, w4
  real, dimension(:), allocatable :: dat, mod
  complex, dimension(:)    , allocatable :: mod1, mod2
  !complex   , dimension(:)    , allocatable :: dat1, dat2
  real, dimension(:), allocatable :: dat1, dat2
  real     :: dot(2)
  complex  :: cdot(2)
  logical  :: adj
  integer  :: stat

  real   , parameter :: PI = 3.14159265359
  logical, parameter :: T=.true., F=.false.

  f1 = 5.; f2 = 10. ; f3 = 35. ; f4 = 40.

  w1=2*PI*f1
  w2=2*PI*f2
  w3=2*PI*f3
  w4=2*PI*f4

  nt = 512
  dt = 0.004

  dw = 2*PI/(nt*dt)

  nw1=w1/dw+0.5
  nw2=w2/dw+0.5
  nw3=w3/dw+0.5
  nw4=w4/dw+0.5

  nw = nw4 - nw1 + 1

  allocate(dat1(nt), dat2(nt))
  allocate(mod1(nw), mod2(nw))  
  allocate(dat(nt), mod(nw))

  call random_number(dat)
  call random_number(mod)
!  dat1 = cmplx(dat, 0.)
  dat1 = dat
  mod2 = cmplx(mod, 0.)

  stat = dot_fft_init(nt, nw, nw1)
  stat = dot_fft_oper(T, F, mod1, dat1)
  stat = dot_fft_oper(F, F, mod2, dat2)


!  cdot(1) = sum(dat1*conjg(dat2))
  dot(1) = sum(dat1*dat2)
  cdot(2) = sum(mod1*conjg(mod2))

  write(0,*)dot
  write(0,*)cdot

end program









