[77a22a]: mex / comp_col2diag.c  Maximize  Restore  History

Download this file

49 lines (35 with data), 917 Bytes

 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
#include "mex.h"
#include "config.h"
#include "ltfat.h"
/* Calling convention:
* cout=comp_col2diag(cin);
*/
void mexFunction( int nlhs, mxArray *plhs[],
int nrhs, const mxArray *prhs[] )
{
int L;
double *cin_r,*cin_i, *cout_r,*cout_i;
int ii;
/* Get matrix dimensions.*/
L = mxGetM(prhs[0]);
cin_r=mxGetPr(prhs[0]);
if (mxIsComplex(prhs[0]))
{
plhs[0] = mxCreateDoubleMatrix(L,L, mxCOMPLEX);
}
else
{
plhs[0] = mxCreateDoubleMatrix(L,L, mxREAL);
}
/* Treat the real part */
cout_r=mxGetPr(plhs[0]);
col2diag_r((double*)cin_r, L, (double*)cout_r);
if (mxIsComplex(prhs[0]))
{
/* Treat the imaginary part */
cin_i=mxGetPi(prhs[0]);
cout_i=mxGetPi(plhs[0]);
col2diag_r((double*)cin_i, L, (double*)cout_i);
}
return;
}

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

Sign up for the SourceForge newsletter:





No, thanks