File: comp_idwilt.cc

package info (click to toggle)
octave-ltfat 2.3.1%2Bdfsg-8
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 11,712 kB
  • sloc: ansic: 30,379; cpp: 8,808; java: 1,499; objc: 345; makefile: 248; xml: 182; python: 124; sh: 18; javascript: 12
file content (119 lines) | stat: -rw-r--r-- 3,808 bytes parent folder | download | duplicates (4)
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
#define TYPEDEPARGS 0, 1
#define SINGLEARGS
#define COMPLEXINDEPENDENT
#define OCTFILENAME comp_idwilt // change to filename
#define OCTFILEHELP "This function calls the C-library\n\
                     c=comp_idwilt(c,g);\n\
                     Yeah."


#include "ltfat_oct_template_helper.h"
/*
  dgtreal_ola forwarders
*/

static inline void
fwd_idwilt_fb(const Complex *c, const Complex *g,
              const octave_idx_type L, const octave_idx_type gl,
              const octave_idx_type W, const octave_idx_type M,
              Complex *f)
{
    ltfat_idwilt_fb_dc(reinterpret_cast<const ltfat_complex_d*>(c),
                 reinterpret_cast<const ltfat_complex_d*>(g),
                 L, gl, W, M, reinterpret_cast<ltfat_complex_d*>(f));
}

static inline void
fwd_idwilt_fb(const FloatComplex *c, const FloatComplex *g,
              const octave_idx_type L,  const octave_idx_type gl,
              const octave_idx_type W, const octave_idx_type M,
              FloatComplex *f)
{
    ltfat_idwilt_fb_sc(reinterpret_cast<const ltfat_complex_s*>(c),
                 reinterpret_cast<const ltfat_complex_s*>(g),
                 L, gl, W, M,
                 reinterpret_cast<ltfat_complex_s*>(f));
}

static inline void
fwd_idwilt_fb(const double *c, const double *g,
              const octave_idx_type L,  const octave_idx_type gl,
              const octave_idx_type W, const octave_idx_type M,
              double *f)
{
    ltfat_idwilt_fb_d(c, g, L, gl, W, M, f);
}

static inline void
fwd_idwilt_fb(const float *c, const float *g,
              const octave_idx_type L,  const octave_idx_type gl,
              const octave_idx_type W, const octave_idx_type M,
              float *f)
{
    ltfat_idwilt_fb_s(c, g, L, gl, W, M, f);
}

static inline void
fwd_idwilt_long(const Complex *c, const Complex *g,
                const octave_idx_type L, const octave_idx_type W,
                const octave_idx_type M, Complex *f)
{
    ltfat_idwilt_long_dc(reinterpret_cast<const ltfat_complex_d*>(c),
                   reinterpret_cast<const ltfat_complex_d*>(g),
                   L, W, M, reinterpret_cast<ltfat_complex_d*>(f));
}

static inline void
fwd_idwilt_long(const FloatComplex *c, const FloatComplex *g,
                const octave_idx_type L, const octave_idx_type W,
                const octave_idx_type M, FloatComplex *f)
{
    ltfat_idwilt_long_sc(reinterpret_cast<const ltfat_complex_s*>(c),
                   reinterpret_cast<const ltfat_complex_s*>(g),
                   L, W, M, reinterpret_cast<ltfat_complex_s*>(f));
}

static inline void
fwd_idwilt_long(const double *c, const double *g,
                const octave_idx_type L, const octave_idx_type W,
                const octave_idx_type M, double *f)
{
    ltfat_idwilt_long_d(c, g, L, W, M, f);
}

static inline void
fwd_idwilt_long(const float *c, const float *g,
                const octave_idx_type L, const octave_idx_type W,
                const octave_idx_type M, float *f)
{
    ltfat_idwilt_long_s(c, g, L, W, M, f);
}

template <class LTFAT_TYPE, class LTFAT_REAL, class LTFAT_COMPLEX>
octave_value_list octFunction(const octave_value_list& args, int nargout)
{
    DEBUGINFO;

    MArray<LTFAT_TYPE> c = ltfatOctArray<LTFAT_TYPE>(args(0));
    MArray<LTFAT_TYPE> g = ltfatOctArray<LTFAT_TYPE>(args(1));

    const octave_idx_type M = c.rows() / 2;
    const octave_idx_type gl = g.numel();
    const octave_idx_type N = 2 * c.columns();
    const octave_idx_type L = N * M;
    const octave_idx_type W = c.numel() / L;

    MArray<LTFAT_TYPE> f(dim_vector(L, W));

    if (gl < L)
    {
        fwd_idwilt_fb(c.data(), g.data(), L, gl, W, M, f.fortran_vec());
    }
    else
    {
        fwd_idwilt_long(c.data(), g.data(), L, W, M, f.fortran_vec());
    }

    return octave_value(f);
}