ivan@137
|
1 /**************************************************************************
|
ivan@137
|
2 *
|
ivan@137
|
3 * File name: ompcore.h
|
ivan@137
|
4 *
|
ivan@137
|
5 * Ron Rubinstein
|
ivan@137
|
6 * Computer Science Department
|
ivan@137
|
7 * Technion, Haifa 32000 Israel
|
ivan@137
|
8 * ronrubin@cs
|
ivan@137
|
9 *
|
ivan@137
|
10 * Last Updated: 18.8.2009
|
ivan@137
|
11 *
|
ivan@137
|
12 * Contains the core implementation of Batch-OMP / OMP-Cholesky.
|
ivan@137
|
13 *
|
ivan@137
|
14 *************************************************************************/
|
ivan@137
|
15
|
ivan@137
|
16
|
ivan@137
|
17 #ifndef __OMP_CORE_H__
|
ivan@137
|
18 #define __OMP_CORE_H__
|
ivan@137
|
19
|
ivan@137
|
20
|
ivan@137
|
21 #include "mex.h"
|
ivan@137
|
22
|
ivan@137
|
23
|
ivan@137
|
24
|
ivan@137
|
25 /**************************************************************************
|
ivan@137
|
26 * Perform Batch-OMP or OMP-Cholesky on a specified set of signals, using
|
ivan@137
|
27 * either a fixed number of atoms or an error bound.
|
ivan@137
|
28 *
|
ivan@137
|
29 * Parameters (not all required):
|
ivan@137
|
30 *
|
ivan@137
|
31 * D - the dictionary, of size n X m
|
ivan@137
|
32 * x - the signals, of size n X L
|
ivan@137
|
33 * DtX - D'*x, of size m X L
|
ivan@137
|
34 * XtX - squared norms of the signals in x, sum(x.*x), of length L
|
ivan@137
|
35 * G - D'*D, of size m X m
|
ivan@137
|
36 * T - target sparsity, or maximal number of atoms for error-based OMP
|
ivan@137
|
37 * eps - target residual norm for error-based OMP
|
ivan@137
|
38 * gamma_mode - one of the constants FULL_GAMMA or SPARSE_GAMMA
|
ivan@137
|
39 * profile - if non-zero, profiling info is printed
|
ivan@137
|
40 * msg_delta - positive: the # of seconds between status prints, otherwise: nothing is printed
|
ivan@137
|
41 * erroromp - if nonzero indicates error-based OMP, otherwise fixed sparsity OMP
|
ivan@137
|
42 *
|
ivan@137
|
43 * Usage:
|
ivan@137
|
44 *
|
ivan@137
|
45 * The function can be called using different parameters, and will have
|
ivan@137
|
46 * different complexity depending on the parameters specified. Arrays which
|
ivan@137
|
47 * are not specified should be passed as null (0). When G is specified,
|
ivan@137
|
48 * Batch-OMP is performed. Otherwise, OMP-Cholesky is performed.
|
ivan@137
|
49 *
|
ivan@137
|
50 * Fixed-sparsity usage:
|
ivan@137
|
51 * ---------------------
|
ivan@137
|
52 * Either DtX, or D and x, must be specified. Specifying DtX is more efficient.
|
ivan@137
|
53 * XtX does not need to be specified.
|
ivan@137
|
54 * When D and x are specified, G is not required. However, not providing G
|
ivan@137
|
55 * will significantly degrade efficiency.
|
ivan@137
|
56 * The number of atoms must be specified in T. The value of eps is ignored.
|
ivan@137
|
57 * Finally, set erroromp to 0.
|
ivan@137
|
58 *
|
ivan@137
|
59 * Error-OMP usage:
|
ivan@137
|
60 * ----------------
|
ivan@137
|
61 * Either DtX and Xtx, or D and x, must be specified. Specifying DtX and XtX
|
ivan@137
|
62 * is more efficient.
|
ivan@137
|
63 * When D and x are specified, G is not required. However, not providing G
|
ivan@137
|
64 * will significantly degrade efficiency.
|
ivan@137
|
65 * The target error must be specified in eps. A hard limit on the number
|
ivan@137
|
66 * of atoms can also be specified via the parameter T. Otherwise, T should
|
ivan@137
|
67 * be negative. Finally, set erroromp to nonzero.
|
ivan@137
|
68 *
|
ivan@137
|
69 *
|
ivan@137
|
70 * Returns:
|
ivan@137
|
71 * An mxArray containing the sparse representations of the signals in x
|
ivan@137
|
72 * (allocated using the appropriate mxCreateXXX() function).
|
ivan@137
|
73 * The array is either full or sparse, depending on gamma_mode.
|
ivan@137
|
74 *
|
ivan@137
|
75 **************************************************************************/
|
ivan@137
|
76 mxArray* ompcore(double D[], double x[], double DtX[], double XtX[], double G[], mwSize n, mwSize m, mwSize L,
|
ivan@137
|
77 int T, double eps, int gamma_mode, int profile, double msg_delta, int erroromp);
|
ivan@137
|
78
|
ivan@137
|
79
|
ivan@137
|
80 #endif
|