File: nfftTestcaseInitDelegate.m

package info (click to toggle)
nfft 3.5.3-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 8,972 kB
  • sloc: ansic: 44,442; lisp: 1,697; makefile: 1,322; sh: 744; sed: 5
file content (56 lines) | stat: -rw-r--r-- 1,450 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
classdef nfftTestcaseInitDelegate
  %NFFTTESTCASEDELEGATEINIT Summary of this class goes here
  %   Detailed explanation goes here
  
  properties
    name = '';
    m = 0;
    flags = 0;
    fftw_flags = 0;
    K;
    sigma;
  end
  
  methods
    function h = nfftTestcaseInitDelegate(name, m, flags, fftw_flags)
      h.name = name;
      if (m==0)
        h.m = nfftmex('get_default_window_cut_off_m');
      else
        h.m = m;
      end
      h.flags = flags;
      h.fftw_flags = fftw_flags;
    end
    
    function [h, plan] = init(h, d, N, M)
      n = 2.^(ceil(log2(N))+1);
      h.sigma = n./N;
      switch h.name
        case 'init_guru'
          argsin = num2cell([d, N(:)', M, n(:)', h.m, h.flags, h.fftw_flags]);
          plan = nfft_init_guru(argsin{:});
        case 'init_class_no_flags'
          argsin = num2cell([n(:)', h.m]);
          plan = nfft(d,N,M,argsin{:});
        case 'init_class_flags'
          argsin = num2cell([n(:)', h.m, h.flags, h.fftw_flags]);
          plan = nfft(d,N,M,argsin{:});
        case 'init_1d'
          plan = nfft_init_1d(N, M);
        case 'init_2d'
          plan = nfft_init_2d(N(1), N(2), M);
        case 'init_3d'
          plan = nfft_init_3d(N(1), N(2), N(3), M);
        case 'init'
          plan = nfft_init(N, M);
        case 'init_class'
          plan = nfft(d, N, M);
        otherwise
          error('Unknown init name: %s', h.name);
      end
    end
  end
  
end