[3deeb5]: mex / comp_dgtreal_fb.c Maximize Restore History

Download this file

comp_dgtreal_fb.c    97 lines (65 with data), 2.0 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
95
96
#ifndef _LTFAT_MEX_FILE
#define _LTFAT_MEX_FILE
#define ISNARGINEQ 4
#define TYPEDEPARGS 0, 1
#define SINGLEARGS
#define REALARGS
#endif // _LTFAT_MEX_FILE - INCLUDED ONCE
#define MEX_FILE __BASE_FILE__
#include "ltfat_mex_template_helper.h"
#if defined(LTFAT_SINGLE) || defined(LTFAT_DOUBLE)
#include "ltfat_types.h"
// Calling convention:
// comp_dgtreal_fb(f,g,a,M);
void LTFAT_NAME(ltfatMexFnc)( int nlhs, mxArray *plhs[],int nrhs, const mxArray *prhs[] )
{
int L, gl,W, a, M, N, M2;
// Get matrix dimensions.
L = mxGetM(prhs[0]);
W = mxGetN(prhs[0]);
gl = mxGetM(prhs[1]);
a=(int)mxGetScalar(prhs[2]);
M=(int)mxGetScalar(prhs[3]);
M2=M/2+1;
N=L/a;
plhs[0] = ltfatCreateMatrix(M2, N*W,LTFAT_MX_CLASSID,mxCOMPLEX);
const LTFAT_REAL * f = (const LTFAT_REAL *) mxGetData(prhs[0]);
const LTFAT_REAL * g = (const LTFAT_REAL *) mxGetData(prhs[1]);
LTFAT_COMPLEX* out_combined = (LTFAT_COMPLEX*) mxGetData(plhs[0]);
LTFAT_NAME(dgtreal_fb)(f,g,L,gl,W,a,M,out_combined);
return;
}
#endif
/*
#include "mex.h"
#include "config.h"
#include "ltfat.h"
#include "ltfat-mex-helper.h"
// Calling convention:
// comp_dgtreal_fb(f,g,a,M);
void mexFunction( int nlhs, mxArray *plhs[],
int nrhs, const mxArray *prhs[] )
{
int L, gl,W, a, M, N, M2;
ltfat_complex *out_combined;
double *f, *g;
// Get matrix dimensions.
L = mxGetM(prhs[0]);
W = mxGetN(prhs[0]);
gl = mxGetM(prhs[1]);
a=(int)mxGetScalar(prhs[2]);
M=(int)mxGetScalar(prhs[3]);
M2=M/2+1;
N=L/a;
// Create temporary matrices to convert to correct complex layout.
out_combined=mxMalloc(M2*N*W*sizeof(ltfat_complex));
f=mxGetPr(prhs[0]);
g=mxGetPr(prhs[1]);
dgtreal_fb((const double*)f,(const double*)g,L,gl,W,a,M,
out_combined);
plhs[0] = mxCreateDoubleMatrix(M2, N*W, mxCOMPLEX);
combined2split(M2*N*W, (const ltfat_complex*)out_combined, plhs[0]);
mxFree(out_combined);
return;
}
*/