/*********************************************************************** * mexexpand.c : C mex file * * z = mexexpand(blk,x); * * Input: blk = [n1, n2, ..., nk] * * Output: [x1 x1...x1, x2 x2...x2, ...., xk xk...xk]' * n1 n2 nk * * SDPT3: version 3.0 * Copyright (c) 1997 by * K.C. Toh, M.J. Todd, R.H. Tutuncu * Last Modified: 2 Feb 01 ***********************************************************************/ #include #include #if !defined(MAX) #define MAX(A, B) ((A) > (B) ? (A) : (B)) #endif /********************************************************** * ***********************************************************/ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] ) { double *blksize, *x, *z; int k, l, blkdim, numblk, cols, idx; /* CHECK FOR PROPER NUMBER OF ARGUMENTS */ if (nrhs != 2){ mexErrMsgTxt("mexexpand: requires 2 input arguments."); } if (nlhs > 1){ mexErrMsgTxt("mexexpand: requires 1 output argument."); } /* CHECK THE DIMENSIONS */ numblk = MAX(mxGetM(prhs[0]),mxGetN(prhs[0])); blksize = mxGetPr(prhs[0]); cols = 0; for (k=0; k