Skip to content

Commit

Permalink
Add tests for highly perturbed frequences.
Browse files Browse the repository at this point in the history
  • Loading branch information
ajt60gaibb committed Feb 4, 2018
1 parent 32ffb98 commit 5933bc6
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/misc/test_nufft.m
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,15 @@
count = count + 1;
end

% Test on random inputs:
N = 50;
omega = N*randn(1,N);
c = rand(N,1) + 1i*rand(N,1);
F = exp(-2*pi*1i*((0:N-1)/N).'*omega);
f = chebfun.nufft(c, omega.', 1);
pass(count) = ( norm( f - F*c ) < 300*N*tol*norm(c,1) );
count = count + 1;

% Test NUFFT-II:
for N = 10.^(0:4)
x = linspace(0,1,N+1)'; x(end) = [];
Expand All @@ -31,6 +40,15 @@
count = count + 1;
end

% Test on random inputs:
N = 50;
x = 100*rand(N,1);
c = rand(N,1) + 1i*rand(N,1);
F = exp(-2*pi*1i*x*(0:N-1));
f = chebfun.nufft(c, x);
pass(count) = ( norm( f - F*c ) < 300*N*tol*norm(c,1) );
count = count + 1;

% Test NUFFT-III
for N = 10.^(0:4)
omega = (0:N-1)';
Expand Down

0 comments on commit 5933bc6

Please sign in to comment.