#include "mex.h" //#include "stdio.h" /*Function takes a vector x, a sparsity K, and cluster count C and returns the appropriate support and cost*/ void bestKCsparse(double* xx, double* supp,int N, int K, int C) { //Compute sum of xx double sum_xx = 0.0; for (int ii=0;iilcost+rcost) { bkc_cost[ii][jj][kk][cc] = lcost+rcost; //Loop through all count? for (int count=0;countncols) N = mrows; else N=ncols; /* set the output pointer to the output matrix */ plhs[0] = mxCreateDoubleMatrix(mrows,ncols,mxREAL); /* create a C pointer to a copy of the output matrix */ supp = mxGetPr(plhs[0]); /* call the C subroutine */ bestKCsparse(xx,supp,N,K,C); }