Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

[3deeb5]: oct / comp_ufilterbank_fft.cc Maximize Restore History

Download this file

comp_ufilterbank_fft.cc    95 lines (75 with data), 2.9 kB

 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
#define TYPEDEPARGS 0, 1
#define SINGLEARGS
#define COMPLEXARGS
#define OCTFILENAME comp_ufilterbank_fft // change to filename
#define OCTFILEHELP "This function calls the C-library\n\
c=comp_ufilterbank_fft(f,g,a);\n\
Yeah."
#include "ltfat_oct_template_helper.h"
// octave_idx_type is 32 or 64 bit signed integer
static inline void fwd_ufilterbank_fft( const Complex *f, const Complex *g,
const octave_idx_type L, const octave_idx_type gl,
const octave_idx_type W, const octave_idx_type a,
const octave_idx_type M, Complex *cout)
{
ufilterbank_fft_d(
reinterpret_cast<const double _Complex*>(f),
reinterpret_cast<const double _Complex*>(g),
L,gl,W,a,M,
reinterpret_cast<double _Complex*>(cout));
}
static inline void fwd_ufilterbank_fft( const FloatComplex *f, const FloatComplex *g,
const octave_idx_type L, const octave_idx_type gl,
const octave_idx_type W, const octave_idx_type a,
const octave_idx_type M, FloatComplex *cout)
{
ufilterbank_fft_s(
reinterpret_cast<const float _Complex*>(f),
reinterpret_cast<const float _Complex*>(g),
L,gl,W,a,M,
reinterpret_cast<float _Complex*>(cout));
}
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> f = ltfatOctArray<LTFAT_TYPE>(args(0));
MArray<LTFAT_TYPE> g = ltfatOctArray<LTFAT_TYPE>(args(1));
const octave_idx_type a = args(2).int_value();
const octave_idx_type L = f.rows();
const octave_idx_type W = f.columns();
const octave_idx_type gl = g.rows();
const octave_idx_type M = g.columns();
const octave_idx_type N = L/a;
dim_vector dims_out(N,M,W);
dims_out.chop_trailing_singletons();
MArray<LTFAT_COMPLEX> cout(dims_out);
cout.fill(0);
fwd_ufilterbank_fft(f.data(),g.data(),L,gl,W,a,M,cout.fortran_vec());
return octave_value(cout);
}
/*
#include <octave/oct.h>
#include "config.h"
#include "ltfat.h"
DEFUN_DLD (comp_ufilterbank_fft, args, ,
"This function calls the C-library\n\
c=comp_pfilt_fir(f,g,a);\n\
Yeah.")
{
const ComplexMatrix f = args(0).complex_matrix_value();
const ComplexMatrix g = args(1).complex_matrix_value();
const int a = args(2).int_value();
const int L = f.rows();
const int W = f.columns();
const int gl = g.rows();
const int M = g.columns();
const int N = L/a;
dim_vector dims_out(N,M,W);
dims_out.chop_trailing_singletons();
ComplexNDArray cout(dims_out);
ufilterbank_fft((const ltfat_complex*)f.data(),(const ltfat_complex*)g.data(),
L,gl,W,a,M,(ltfat_complex*)cout.data());
return octave_value (cout);
}
*/