Skip to content

Instantly share code, notes, and snippets.

@majiang
Created October 27, 2013 16:49
Show Gist options
  • Select an option

  • Save majiang/7184833 to your computer and use it in GitHub Desktop.

Select an option

Save majiang/7184833 to your computer and use it in GitHub Desktop.
void main()
{
import std.algorithm, std.random, std.range, std.numeric;
auto obj = new Fft2D!Fft(4, 4); // FFT を提供するクラスのインスタンスは1つあれば十分な気がする (x, y でサイズが違っても大きい方を持ってよい)
double[][] input;
foreach (i; 0..4)
input ~= iota(0, 4).map!(b => uniform(0.0, 1.0))().array();
auto result = obj.fft!real(input);
auto inv = obj.inverseFft!real(result);
import std.stdio;
writeln(input);
writeln(result);
writeln(inv);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment