annotate solvers/SMALL_ompGabor/ompmex.c @ 241:423de9f24d98 ver_2.0

removed unnecessary files
author luisf <luis.figueira@eecs.qmul.ac.uk>
date Wed, 25 Apr 2012 15:05:38 +0100
parents 31d2864dfdd4
children
rev   line source
ivan@140 1 /**************************************************************************
ivan@140 2 *
ivan@140 3 * File name: ompmex.c
ivan@140 4 *
ivan@140 5 * Ron Rubinstein
ivan@140 6 * Computer Science Department
ivan@140 7 * Technion, Haifa 32000 Israel
ivan@140 8 * ronrubin@cs
ivan@140 9 *
ivan@140 10 * Last Updated: 18.8.2009
ivan@140 11 *
ivan@140 12 *************************************************************************/
ivan@140 13
ivan@140 14 #include "ompcore.h"
ivan@140 15 #include "omputils.h"
ivan@140 16 #include "mexutils.h"
ivan@140 17
ivan@140 18
ivan@140 19 /* Input Arguments */
ivan@140 20
ivan@140 21 #define IN_D prhs[0]
ivan@140 22 #define IN_X prhs[1]
ivan@140 23 #define IN_DtX prhs[2]
ivan@140 24 #define IN_G prhs[3]
ivan@140 25 #define IN_T prhs[4]
ivan@140 26 #define IN_SPARSE_G prhs[5]
ivan@140 27 #define IN_MSGDELTA prhs[6]
ivan@140 28 #define IN_PROFILE prhs[7]
ivan@140 29
ivan@140 30
ivan@140 31 /* Output Arguments */
ivan@140 32
ivan@140 33 #define GAMMA_OUT plhs[0]
ivan@140 34
ivan@140 35
ivan@140 36 /***************************************************************************************/
ivan@140 37
ivan@140 38
ivan@140 39 void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray*prhs[])
ivan@140 40
ivan@140 41 {
ivan@140 42 double *D, *x, *DtX, *G, msgdelta;
ivan@140 43 int gmode, profile, T;
ivan@140 44 mwSize m, n, L; /* D is n x m , X is n x L, DtX is m x L */
ivan@140 45
ivan@140 46
ivan@140 47 /* check parameters */
ivan@140 48
ivan@140 49 checkmatrix(IN_D, "OMP", "D");
ivan@140 50 checkmatrix(IN_X, "OMP", "X");
ivan@140 51 checkmatrix(IN_DtX, "OMP", "DtX");
ivan@140 52 checkmatrix(IN_G, "OMP", "G");
ivan@140 53
ivan@140 54 checkscalar(IN_T, "OMP", "T");
ivan@140 55 checkscalar(IN_SPARSE_G, "OMP", "sparse_g");
ivan@140 56 checkscalar(IN_MSGDELTA, "OMP", "msgdelta");
ivan@140 57 checkscalar(IN_PROFILE, "OMP", "profile");
ivan@140 58
ivan@140 59
ivan@140 60 /* get parameters */
ivan@140 61
ivan@140 62 x = D = DtX = G = 0;
ivan@140 63
ivan@140 64 if (!mxIsEmpty(IN_D))
ivan@140 65 D = mxGetPr(IN_D);
ivan@140 66
ivan@140 67 if (!mxIsEmpty(IN_X))
ivan@140 68 x = mxGetPr(IN_X);
ivan@140 69
ivan@140 70 if (!mxIsEmpty(IN_DtX))
ivan@140 71 DtX = mxGetPr(IN_DtX);
ivan@140 72
ivan@140 73 if (!mxIsEmpty(IN_G))
ivan@140 74 G = mxGetPr(IN_G);
ivan@140 75
ivan@140 76 T = (int)(mxGetScalar(IN_T)+1e-2);
ivan@140 77 if ((int)(mxGetScalar(IN_SPARSE_G)+1e-2)) {
ivan@140 78 gmode = SPARSE_GAMMA;
ivan@140 79 }
ivan@140 80 else {
ivan@140 81 gmode = FULL_GAMMA;
ivan@140 82 }
ivan@140 83 msgdelta = mxGetScalar(IN_MSGDELTA);
ivan@140 84 profile = (int)(mxGetScalar(IN_PROFILE)+1e-2);
ivan@140 85
ivan@140 86
ivan@140 87 /* check sizes */
ivan@140 88
ivan@140 89 if (D && x) {
ivan@140 90 n = mxGetM(IN_D);
ivan@140 91 m = mxGetN(IN_D);
ivan@140 92 L = mxGetN(IN_X);
ivan@140 93
ivan@140 94 if (mxGetM(IN_X) != n) {
ivan@140 95 mexErrMsgTxt("D and X have incompatible sizes.");
ivan@140 96 }
ivan@140 97
ivan@140 98 if (G) {
ivan@140 99 if (mxGetN(IN_G)!=mxGetM(IN_G)) {
ivan@140 100 mexErrMsgTxt("G must be a square matrix.");
ivan@140 101 }
ivan@140 102 if (mxGetN(IN_G) != m) {
ivan@140 103 mexErrMsgTxt("D and G have incompatible sizes.");
ivan@140 104 }
ivan@140 105 }
ivan@140 106 }
ivan@140 107
ivan@140 108 else if (DtX) {
ivan@140 109 m = mxGetM(IN_DtX);
ivan@140 110 L = mxGetN(IN_DtX);
ivan@140 111
ivan@140 112 n = T; /* arbitrary - it is enough to assume signal length is T */
ivan@140 113
ivan@140 114 if (mxGetN(IN_G)!=mxGetM(IN_G)) {
ivan@140 115 mexErrMsgTxt("G must be a square matrix.");
ivan@140 116 }
ivan@140 117 if (mxGetN(IN_G) != m) {
ivan@140 118 mexErrMsgTxt("DtX and G have incompatible sizes.");
ivan@140 119 }
ivan@140 120 }
ivan@140 121
ivan@140 122 else {
ivan@140 123 mexErrMsgTxt("Either D and X, or DtX, must be specified.");
ivan@140 124 }
ivan@140 125
ivan@140 126
ivan@140 127 /* Do OMP! */
ivan@140 128
ivan@140 129 GAMMA_OUT = ompcore(D, x, DtX, 0, G, n, m, L, T, 0, gmode, profile, msgdelta, 0);
ivan@140 130
ivan@140 131 return;
ivan@140 132 }
ivan@140 133