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