ivan@137: /************************************************************************** ivan@137: * ivan@137: * File name: ompcore.h ivan@137: * ivan@137: * Ron Rubinstein ivan@137: * Computer Science Department ivan@137: * Technion, Haifa 32000 Israel ivan@137: * ronrubin@cs ivan@137: * ivan@137: * Last Updated: 18.8.2009 ivan@137: * ivan@137: * Contains the core implementation of Batch-OMP / OMP-Cholesky. ivan@137: * ivan@137: *************************************************************************/ ivan@137: ivan@137: ivan@137: #ifndef __OMP_CORE_H__ ivan@137: #define __OMP_CORE_H__ ivan@137: ivan@137: ivan@137: #include "mex.h" ivan@137: ivan@137: ivan@137: ivan@137: /************************************************************************** ivan@137: * Perform Batch-OMP or OMP-Cholesky on a specified set of signals, using ivan@137: * either a fixed number of atoms or an error bound. ivan@137: * ivan@137: * Parameters (not all required): ivan@137: * ivan@137: * D - the dictionary, of size n X m ivan@137: * x - the signals, of size n X L ivan@137: * DtX - D'*x, of size m X L ivan@137: * XtX - squared norms of the signals in x, sum(x.*x), of length L ivan@137: * G - D'*D, of size m X m ivan@137: * T - target sparsity, or maximal number of atoms for error-based OMP ivan@137: * eps - target residual norm for error-based OMP ivan@137: * gamma_mode - one of the constants FULL_GAMMA or SPARSE_GAMMA ivan@137: * profile - if non-zero, profiling info is printed ivan@137: * msg_delta - positive: the # of seconds between status prints, otherwise: nothing is printed ivan@137: * erroromp - if nonzero indicates error-based OMP, otherwise fixed sparsity OMP ivan@137: * ivan@137: * Usage: ivan@137: * ivan@137: * The function can be called using different parameters, and will have ivan@137: * different complexity depending on the parameters specified. Arrays which ivan@137: * are not specified should be passed as null (0). When G is specified, ivan@137: * Batch-OMP is performed. Otherwise, OMP-Cholesky is performed. ivan@137: * ivan@137: * Fixed-sparsity usage: ivan@137: * --------------------- ivan@137: * Either DtX, or D and x, must be specified. Specifying DtX is more efficient. ivan@137: * XtX does not need to be specified. ivan@137: * When D and x are specified, G is not required. However, not providing G ivan@137: * will significantly degrade efficiency. ivan@137: * The number of atoms must be specified in T. The value of eps is ignored. ivan@137: * Finally, set erroromp to 0. ivan@137: * ivan@137: * Error-OMP usage: ivan@137: * ---------------- ivan@137: * Either DtX and Xtx, or D and x, must be specified. Specifying DtX and XtX ivan@137: * is more efficient. ivan@137: * When D and x are specified, G is not required. However, not providing G ivan@137: * will significantly degrade efficiency. ivan@137: * The target error must be specified in eps. A hard limit on the number ivan@137: * of atoms can also be specified via the parameter T. Otherwise, T should ivan@137: * be negative. Finally, set erroromp to nonzero. ivan@137: * ivan@137: * ivan@137: * Returns: ivan@137: * An mxArray containing the sparse representations of the signals in x ivan@137: * (allocated using the appropriate mxCreateXXX() function). ivan@137: * The array is either full or sparse, depending on gamma_mode. ivan@137: * ivan@137: **************************************************************************/ ivan@137: mxArray* ompcoreGabor(double D[], double x[], double DtX[], double XtX[], double G[], mwSize n, mwSize m, mwSize L, ivan@137: int T, double eps, int gamma_mode, int profile, double msg_delta, int erroromp); ivan@137: ivan@137: ivan@137: #endif