1classdef nfsftTestcaseDelegateOnline < nfsftTestcaseDelegate
2  %NFSFTTESTCASEDELEGATE Summary of this class goes here
3  %   Detailed explanation goes here
4
5  properties(Hidden=true,SetAccess='protected',GetAccess='public')
6    trafo_type = '';
7  end
8
9  methods
10    function h = nfsftTestcaseDelegateOnline(N, M, trafo_type)
11      h.N = N;
12      h.M = M;
13      h.trafo_type = trafo_type;
14    end
15
16    function h = setup(h)
17
18      if (h.M==0)  % equispaced nodes
19        fprintf('%-31s', 'nfsft_online_equispaced');
20        ph=(-h.N-1:h.N)/(2*h.N+2)*2*pi;
21        th=(0:h.N)/(2*h.N+2)*2*pi;
22        [ph,th]=meshgrid(ph,th);
23        h.x=[ph(:)';th(:)'];
24        h.M=size(h.x,2);
25      else % random nodes
26        fprintf('%-31s', 'nfsft_online');
27        ph=rand(1,h.M)*2*pi;
28        th=rand(1,h.M)*pi;
29        h.x=[ph;th];
30      end
31
32      fprintf(' N = %-5d,', h.N);
33      fprintf(' M = %-5d,', h.M);
34
35      fprintf(' nthreads = %d', nfsft_get_num_threads);
36
37      switch h.trafo_type
38        case 'trafo'
39          fh = f_hat(rand((h.N+1)*(h.N+1),1));
40          h.f_hat = fh;
41
42          p = nfsft(h.N,h.M,NFSFT_USE_DPT,1000.0,6,FPT_NO_FAST_ALGORITHM);
43          p.fhat = fh;
44          p.x = h.x;
45          nfsft_trafo_direct(p);
46          h.f = p.f;
47        case 'adjoint'
48          f = rand(h.M,1) - 0.5 + 1i * (rand(h.M,1) - 0.5);
49          h.f = f;
50
51          p = nfsft(h.N,h.M,NFSFT_USE_DPT,1000.0,6,FPT_NO_FAST_ALGORITHM);
52          p.f = f;
53          p.x = h.x;
54          nfsft_adjoint_direct(p);
55          h.f_hat = p.fhat;
56        otherwise
57          error('type %s not supported', h.trafo_type);
58      end
59
60    end
61
62    function h = destroy(h)
63      h.x = [];
64      h.f_hat = [];
65      h.f = [];
66      h = destroy@nfsftTestcaseDelegate(h);
67    end
68  end
69
70end
71
72