[ba1662]: mex / comp_col2diag.c  Maximize  Restore  History

Download this file

68 lines (58 with data), 1.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
#ifndef _LTFAT_MEX_FILE
#define _LTFAT_MEX_FILE
#define ISNARGINEQ 1
#define TYPEDEPARGS 0
#define SINGLEARGS
#define COMPLEXINDEPENDENT
#define NOCOMPLEXFMTCHANGE
#endif /* _LTFAT_MEX_FILE */
/* Assuming __BASE_FILE__ is known by the compiler.
Otherwise specify this filename
e.g. #define MEX_FILE "comp_col2diag.c" */
#define MEX_FILE __BASE_FILE__
#include "ltfat_mex_template_helper.h"
#if defined(LTFAT_SINGLE) || defined(LTFAT_DOUBLE)
#include "ltfat_types.h"
/*
Defining forwarders since there is no simple way of unified call to
col2diag since the real and imag planes are processed separatelly
*/
#ifdef LTFAT_DOUBLE
static inline void
LTFAT_NAME(fwd_col2diag)(const double* cin, const mwSize L, double* cout)
{
col2diag_d(cin,L,cout);
}
#endif /* LTFAT_DOUBLE */
#ifdef LTFAT_SINGLE
static inline void
LTFAT_NAME(fwd_col2diag)(const float* cin, const int L, float* cout)
{
col2diag_s(cin,L,cout);
}
#endif /* LTFAT_SINGLE */
/* Calling convention:
* cout=comp_col2diag(cin);
*/
void LTFAT_NAME(ltfatMexFnc)(int nlhs, mxArray *plhs[],
int nrhs, const mxArray *prhs[] )
{
mwSize L = mxGetM(prhs[0]);
plhs[0] = ltfatCreateMatrix(L, L, LTFAT_MX_CLASSID, LTFAT_MX_COMPLEXITY);
#ifdef NOCOMPLEXFMTCHANGE
LTFAT_REAL* cout_r = mxGetData(plhs[0]);
LTFAT_REAL* cin_r = mxGetData(prhs[0]);
LTFAT_NAME(fwd_col2diag)(cin_r,L,cout_r);
#ifdef LTFAT_COMPLEXTYPE
// Treat the imaginary part
LTFAT_REAL* cin_i= mxGetImagData(prhs[0]);
LTFAT_REAL* cout_i= mxGetImagData(plhs[0]);
LTFAT_NAME(fwd_col2diag)(cin_i, L,cout_i);
#endif /* LTFAT_COMPLEXTYPE */
#else /* not NOCOMPLEXFMTCHANGE */
LTFAT_TYPE* cin_r= mxGetData(prhs[0]);
LTFAT_TYPE* cout_r= mxGetData(plhs[0]);
LTFAT_NAME(col2diag)(cin_r, L,cout_r);
#endif /* NOCOMPLEXFMTCHANGE */
}
#endif /* LTFAT_SINGLE or LTFAT_DOUBLE */

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks