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