Diff of /t/fftw.t [fa45ca] .. [9425cd] Maximize Restore

  Switch to unified view

a/t/fftw.t b/t/fftw.t
...
...
34
$ir = random $ir;
34
$ir = random $ir;
35
$ii = random $ii;
35
$ii = random $ii;
36
36
37
$i = cat $ir,$ii;
37
$i = cat $ir,$ii;
38
$i = $i->mv(2,0);
38
$i = $i->mv(2,0);
39
$fi = ifftw $i;
39
$fi = fftw $i;
40
40
41
$fir = $ir->copy;
41
$fir = $ir->copy;
42
$fii = $ii->copy;
42
$fii = $ii->copy;
43
fftnd $fir,$fii;
43
fftnd $fir,$fii;
44
$ffi = cat $fir,$fii;
44
$ffi = cat $fir,$fii;
45
$ffi = $ffi->mv(2,0);
45
$ffi = $ffi->mv(2,0);
46
46
47
my ( $t, $orig, $i2, $sffi );
47
my ( $t, $orig, $i2, $sffi );
48
$t = ($ffi-$fi)*($ffi-$fi);
48
$t = ($ffi-$fi)*($ffi-$fi);
49
49
50
# print diff fftnd and ifftw: ",sqrt($t->sum),"\n";
50
# print diff fftnd and fftw: ",sqrt($t->sum),"\n";
51
ok(approx(sqrt($t->sum),pdl(0),ABSDIFF),
51
ok(approx(sqrt($t->sum),pdl(0),ABSDIFF),
52
   "fftnd() and ifftw()");
52
   "fftnd() and fftw()");
53
53
54
$orig = fftw $fi;
54
$orig = ifftw $fi;
55
$orig /= $n*$m;
55
$orig /= $n*$m;
56
56
57
$t = ($orig-$i)*($orig-$i);
57
$t = ($orig-$i)*($orig-$i);
58
# print "diff ifftw fftw and orig: ",sqrt($t->sum),"\n";
58
# print "diff ifftw fftw and orig: ",sqrt($t->sum),"\n";
59
ok(approx(sqrt($t->sum),pdl(0),ABSDIFF),
59
ok(approx(sqrt($t->sum),pdl(0),ABSDIFF),
60
   "ifftw() fftw() and original");
60
   "ifftw() fftw() and original");
61
61
62
# Inplace FFT
62
# Inplace FFT
63
$i2 = $i->copy;
63
$i2 = $i->copy;
64
64
65
infftw($i2);
65
nfftw($i2);
66
66
67
$t = ($i2-$ffi)*($i2-$ffi);
67
$t = ($i2-$ffi)*($i2-$ffi);
68
# print "diff fftnd and infftw: ",sqrt($t->sum),"\n";
68
# print "diff fftnd and nfftw: ",sqrt($t->sum),"\n";
69
ok(approx(sqrt($t->sum),pdl(0),ABSDIFF),
69
ok(approx(sqrt($t->sum),pdl(0),ABSDIFF),
70
   "fftnd and infftw");
70
   "fftnd and nfftw");
71
71
72
$i2 = nfftw $i2;
72
$i2 = infftw $i2;
73
$i2 /= $n*$m;
73
$i2 /= $n*$m;
74
74
75
$t = ($i-$i2)*($i-$i2);
75
$t = ($i-$i2)*($i-$i2);
76
# print "diff infftw nfftw and orig: ",sqrt($t->sum),"\n";
76
# print "diff infftw nfftw and orig: ",sqrt($t->sum),"\n";
77
ok(approx(sqrt($t->sum),pdl(0),ABSDIFF),
77
ok(approx(sqrt($t->sum),pdl(0),ABSDIFF),
...
...
81
$ii = zeroes($n,$m)->$datatype();
81
$ii = zeroes($n,$m)->$datatype();
82
$ir = random $ir;
82
$ir = random $ir;
83
83
84
$fir = $ir->copy;
84
$fir = $ir->copy;
85
$fii = $ii->copy;
85
$fii = $ii->copy;
86
ifftnd $fir,$fii;
86
fftnd $fir,$fii;
87
$ffi = cat $fir,$fii;
87
$ffi = cat $fir,$fii;
88
$ffi = $ffi->mv(2,0);
88
$ffi = $ffi->mv(2,0);
89
$ffi *= $n*$m;
89
#$ffi *= $n*$m;
90
$sffi = $ffi->mslice('X',[0,$n/2],'X');
90
$sffi = $ffi->mslice('X',[0,$n/2],'X');
91
91
92
$fi = rfftw $ir;
92
$fi = rfftw $ir;
93
93
94
$t = ($sffi-$fi)*($sffi-$fi);
94
$t = ($sffi-$fi)*($sffi-$fi);