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