1 #define TYPEDEPARGS 0
2 #define SINGLEARGS
3 #define COMPLEXARGS
4 #define OCTFILENAME comp_nonsepwin2multi // change to filename
5 #define OCTFILEHELP "This function calls the C-library\n\
6                     c=comp_nonsepwin2multi(g,a,M,lt,L);\n"
7 
8 
9 #include "ltfat_oct_template_helper.h"
10 // octave_idx_type is 32 or 64 bit signed integer
11 
12 
13 static inline void
fwd_nonsepwin2multi(const Complex * g,const octave_idx_type L,const octave_idx_type Lg,const octave_idx_type a,const octave_idx_type M,const octave_idx_type lt1,const octave_idx_type lt2,Complex * mwin)14 fwd_nonsepwin2multi(const Complex *g,
15                     const octave_idx_type L, const octave_idx_type Lg,
16                     const octave_idx_type a, const octave_idx_type M,
17                     const octave_idx_type lt1, const octave_idx_type lt2,
18                     Complex *mwin)
19 {
20     ltfat_nonsepwin2multi_d(
21         reinterpret_cast<const ltfat_complex_d *>(g),
22         L,Lg,a,M,lt1,lt2,
23         reinterpret_cast<ltfat_complex_d *>(mwin));
24 }
25 
26 static inline void
fwd_nonsepwin2multi(const FloatComplex * g,const octave_idx_type L,const octave_idx_type Lg,const octave_idx_type a,const octave_idx_type M,const octave_idx_type lt1,const octave_idx_type lt2,FloatComplex * mwin)27 fwd_nonsepwin2multi(const FloatComplex *g,
28                     const octave_idx_type L, const octave_idx_type Lg,
29                     const octave_idx_type a, const octave_idx_type M,
30                     const octave_idx_type lt1, const octave_idx_type lt2,
31                     FloatComplex *mwin)
32 {
33     ltfat_nonsepwin2multi_s(
34         reinterpret_cast<const ltfat_complex_s *>(g),
35         L,Lg,a,M,lt1,lt2,
36         reinterpret_cast<ltfat_complex_s *>(mwin));
37 }
38 
39 template <class LTFAT_TYPE, class LTFAT_REAL, class LTFAT_COMPLEX>
octFunction(const octave_value_list & args,int nargout)40 octave_value_list octFunction(const octave_value_list& args, int nargout)
41 {
42     DEBUGINFO;
43     MArray<LTFAT_TYPE> g = ltfatOctArray<LTFAT_TYPE>(args(0));
44 
45     const int    a        = args(1).int_value();
46     const int    M        = args(2).int_value();
47     const Matrix lt       = args(3).matrix_value();
48     const int    L        = args(4).int_value();
49 
50     const int Lg = g.rows();
51     const int lt1 = ltfat_round(lt(0));
52     const int lt2 = ltfat_round(lt(1));
53 
54     MArray<LTFAT_COMPLEX> mwin(dim_vector(L,lt2));
55 
56     fwd_nonsepwin2multi(g.data(),L,Lg,a,M,lt1,lt2,mwin.fortran_vec());
57 
58     return octave_value(mwin);
59 }
60