idamnjanovic@60
|
1 /**************************************************************************
|
idamnjanovic@60
|
2 *
|
idamnjanovic@60
|
3 * File name: omputils.h
|
idamnjanovic@60
|
4 *
|
idamnjanovic@60
|
5 * Ron Rubinstein
|
idamnjanovic@60
|
6 * Computer Science Department
|
idamnjanovic@60
|
7 * Technion, Haifa 32000 Israel
|
idamnjanovic@60
|
8 * ronrubin@cs
|
idamnjanovic@60
|
9 *
|
idamnjanovic@60
|
10 * Last Updated: 18.8.2009
|
idamnjanovic@60
|
11 *
|
idamnjanovic@60
|
12 * Utility definitions and functions for the OMP library.
|
idamnjanovic@60
|
13 *
|
idamnjanovic@60
|
14 *************************************************************************/
|
idamnjanovic@60
|
15
|
idamnjanovic@60
|
16
|
idamnjanovic@60
|
17 #ifndef __OMP_UTILS_H__
|
idamnjanovic@60
|
18 #define __OMP_UTILS_H__
|
idamnjanovic@60
|
19
|
idamnjanovic@60
|
20 #include "mex.h"
|
idamnjanovic@60
|
21
|
idamnjanovic@60
|
22
|
idamnjanovic@60
|
23 /* constants for the representation mode of gamma */
|
idamnjanovic@60
|
24
|
idamnjanovic@60
|
25 extern const char FULL_GAMMA_STR[]; /* "full" */
|
idamnjanovic@60
|
26 extern const char SPARSE_GAMMA_STR[]; /* "sparse" */
|
idamnjanovic@60
|
27
|
idamnjanovic@60
|
28
|
idamnjanovic@60
|
29 #define FULL_GAMMA 1
|
idamnjanovic@60
|
30 #define SPARSE_GAMMA 2
|
idamnjanovic@60
|
31 #define INVALID_MODE 3
|
idamnjanovic@60
|
32
|
idamnjanovic@60
|
33
|
idamnjanovic@60
|
34
|
idamnjanovic@60
|
35 /**************************************************************************
|
idamnjanovic@60
|
36 * Memory management for OMP2.
|
idamnjanovic@60
|
37 *
|
idamnjanovic@60
|
38 * GAMMA_INC_FACTOR:
|
idamnjanovic@60
|
39 * The matrix GAMMA is allocated with sqrt(n)/2 coefficients per signal,
|
idamnjanovic@60
|
40 * for a total of nzmax = L*sqrt(n)/2 nonzeros. Whenever GAMMA needs to be
|
idamnjanovic@60
|
41 * increased, it is increased by a factor of GAMMA_INC_FACTOR.
|
idamnjanovic@60
|
42 *
|
idamnjanovic@60
|
43 * MAT_INC_FACTOR:
|
idamnjanovic@60
|
44 * The matrices Lchol, Gsub and Dsub are allocated with sqrt(n)/2
|
idamnjanovic@60
|
45 * columns each. If additional columns are needed, this number is
|
idamnjanovic@60
|
46 * increased by a factor of MAT_INC_FACTOR.
|
idamnjanovic@60
|
47 **************************************************************************/
|
idamnjanovic@60
|
48
|
idamnjanovic@60
|
49 #define GAMMA_INC_FACTOR (1.4)
|
idamnjanovic@60
|
50 #define MAT_INC_FACTOR (1.6)
|
idamnjanovic@60
|
51
|
idamnjanovic@60
|
52
|
idamnjanovic@60
|
53
|
idamnjanovic@60
|
54 /**************************************************************************
|
idamnjanovic@60
|
55 * Convert number of seconds to hour, minute and second representation.
|
idamnjanovic@60
|
56 *
|
idamnjanovic@60
|
57 * Parameters:
|
idamnjanovic@60
|
58 * sectot - total number of seconds
|
idamnjanovic@60
|
59 * hrs, mins, secs - output hours (whole) and minutes (whole) and seconds
|
idamnjanovic@60
|
60 *
|
idamnjanovic@60
|
61 **************************************************************************/
|
idamnjanovic@60
|
62 void secs2hms(double sectot, int *hrs, int *mins, double *secs);
|
idamnjanovic@60
|
63
|
idamnjanovic@60
|
64
|
idamnjanovic@60
|
65
|
idamnjanovic@60
|
66 /**************************************************************************
|
idamnjanovic@60
|
67 * QuickSort - public-domain C implementation by Darel Rex Finley.
|
idamnjanovic@60
|
68 *
|
idamnjanovic@60
|
69 * Modified to sort both the array vals[] and the array data[] according
|
idamnjanovic@60
|
70 * to the values in the array vals[].
|
idamnjanovic@60
|
71 *
|
idamnjanovic@60
|
72 **************************************************************************/
|
idamnjanovic@60
|
73 void quicksort(mwIndex vals[], double data[], mwIndex n);
|
idamnjanovic@60
|
74
|
idamnjanovic@60
|
75
|
idamnjanovic@60
|
76 #endif
|
idamnjanovic@60
|
77
|