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