#!/usr/bin/env ruby
require("gsl")

n = 100
data = Vector.new(n)

for i in (n/3)...(2*n/3) do
  data[i] = 1.0
end

datasave = data.clone

rtable = FFT::Real::Wavetable.new(n)
rwork = FFT::Real::Workspace.new(n)
  
#data.real_transform(1, n, rtable, rwork)
#data.real_transform(n, rtable, rwork)
#data.real_transform(rtable, rwork)
#data.real_transform(n, rtable)
#data.real_transform(n, rwork)
#data.real_transform(n)
#data.real_transform(rtable)
#data.real_transform(rwork)
#data.real_transform()
FFT::Real.transform(data)

for i in 11...n do
  data[i] = 0.0
end
  
hctable = FFT::HalfComplex::Wavetable.new(n)
  
#data.halfcomplex_inverse(hctable, rwork)
data.halfcomplex_inverse()
#FFT::HalfComplex.inverse(data)

graph(nil, datasave, data, "-T X -C -g 3 -L 'Real-halfcomplex' -x 0 #{data.size}")
