ivan@137: /************************************************************************** ivan@137: * ivan@137: * File name: omputils.h ivan@137: * ivan@137: * Ron Rubinstein ivan@137: * Computer Science Department ivan@137: * Technion, Haifa 32000 Israel ivan@137: * ronrubin@cs ivan@137: * ivan@137: * Last Updated: 18.8.2009 ivan@137: * ivan@137: * Utility definitions and functions for the OMP library. ivan@137: * ivan@137: *************************************************************************/ ivan@137: ivan@137: ivan@137: #ifndef __OMP_UTILS_H__ ivan@137: #define __OMP_UTILS_H__ ivan@137: ivan@137: #include "mex.h" ivan@137: ivan@137: ivan@137: /* constants for the representation mode of gamma */ ivan@137: ivan@137: extern const char FULL_GAMMA_STR[]; /* "full" */ ivan@137: extern const char SPARSE_GAMMA_STR[]; /* "sparse" */ ivan@137: ivan@137: ivan@137: #define FULL_GAMMA 1 ivan@137: #define SPARSE_GAMMA 2 ivan@137: #define INVALID_MODE 3 ivan@137: ivan@137: ivan@137: ivan@137: /************************************************************************** ivan@137: * Memory management for OMP2. ivan@137: * ivan@137: * GAMMA_INC_FACTOR: ivan@137: * The matrix GAMMA is allocated with sqrt(n)/2 coefficients per signal, ivan@137: * for a total of nzmax = L*sqrt(n)/2 nonzeros. Whenever GAMMA needs to be ivan@137: * increased, it is increased by a factor of GAMMA_INC_FACTOR. ivan@137: * ivan@137: * MAT_INC_FACTOR: ivan@137: * The matrices Lchol, Gsub and Dsub are allocated with sqrt(n)/2 ivan@137: * columns each. If additional columns are needed, this number is ivan@137: * increased by a factor of MAT_INC_FACTOR. ivan@137: **************************************************************************/ ivan@137: ivan@137: #define GAMMA_INC_FACTOR (1.4) ivan@137: #define MAT_INC_FACTOR (1.6) ivan@137: ivan@137: ivan@137: ivan@137: /************************************************************************** ivan@137: * Convert number of seconds to hour, minute and second representation. ivan@137: * ivan@137: * Parameters: ivan@137: * sectot - total number of seconds ivan@137: * hrs, mins, secs - output hours (whole) and minutes (whole) and seconds ivan@137: * ivan@137: **************************************************************************/ ivan@137: void secs2hms(double sectot, int *hrs, int *mins, double *secs); ivan@137: ivan@137: ivan@137: ivan@137: /************************************************************************** ivan@137: * QuickSort - public-domain C implementation by Darel Rex Finley. ivan@137: * ivan@137: * Modified to sort both the array vals[] and the array data[] according ivan@137: * to the values in the array vals[]. ivan@137: * ivan@137: **************************************************************************/ ivan@137: void quicksort(mwIndex vals[], double data[], mwIndex n); ivan@137: ivan@137: ivan@137: #endif ivan@137: