gsl-ocaml / examples /

open Gsl

let print_data { = a } =
  for i = 0 to Array.length a - 1 do
    Printf.printf "%d: %e\n" i a.(i)
  done ;
  Printf.printf "\n"

let init_data n =
  let data = Array.make n 0. in
  Array.fill data (n / 3) (n / 3) 1. ;
  { Fft.layout = Fft.Real ; data = data }

let main n =
  let data = init_data n in
  print_data data ;
  let ws = Fft.Real.make_workspace n
  and wt = Fft.Real.make_wavetable n in
  Fft.Real.transform data wt ws ;
  Array.fill 11 (n - 11) 0. ;
  let wt_hc = Fft.Halfcomplex.make_wavetable n in
  Fft.Halfcomplex.inverse data wt_hc ws ;
  print_data data

let _ =
  main 100
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.