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