/usr/share/doc/ruby-gsl/examples/fft/forward2.rb is in ruby-gsl 2.1.0.3+dfsg1-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | #!/usr/bin/env ruby
require("gsl")
n = 630
data = GSL::Vector::Complex.alloc(n)
table = GSL::FFT::ComplexWavetable.alloc(n)
space = GSL::FFT::ComplexWorkspace.alloc(n)
data[0] = 1.0
for i in 1..10 do
data[i] = GSL::Complex[1.0, 0.0]
data[n-i] = GSL::Complex[1.0, 0.0]
end
org = data.clone
# Select whichever you like
#data.forward!(table, space)
#data.forward!(table)
#data.forward!(space)
#data.forward!()
#data.transform!(table, space, GSL::FFT::Forward)
#data.transform!(GSL::FFT::Forward)
data.forward!(table, space)
data /= Math::sqrt(n)
GSL::graph(nil, org.re, data.re, "-C -g 3")
|