Daniel@0: /* divide_by_sparse_table.c ../potential/tables*/ Daniel@0: Daniel@0: /******************************************/ Daniel@0: /* 6 input & 1 output */ Daniel@0: /* Big table [0] */ Daniel@0: /* Big domain [1] */ Daniel@0: /* big sizes [2] */ Daniel@0: /* Small table [3] */ Daniel@0: /* small domain [4] */ Daniel@0: /* small sizes [5] */ Daniel@0: /* */ Daniel@0: /* New big table[0] */ Daniel@0: /******************************************/ Daniel@0: Daniel@0: #include Daniel@0: #include Daniel@0: #include "mex.h" Daniel@0: Daniel@0: int compare(const void* src1, const void* src2){ Daniel@0: int i1 = *(int*)src1 ; Daniel@0: int i2 = *(int*)src2 ; Daniel@0: return i1-i2 ; Daniel@0: } Daniel@0: Daniel@0: void ind_subv(int index, const int *cumprod, int n, int *bsubv){ Daniel@0: int i; Daniel@0: Daniel@0: for (i = n-1; i >= 0; i--) { Daniel@0: bsubv[i] = ((int)floor(index / cumprod[i])); Daniel@0: index = index % cumprod[i]; Daniel@0: } Daniel@0: } Daniel@0: Daniel@0: int subv_ind(const int n, const int *cumprod, const int *subv){ Daniel@0: int i, index=0; Daniel@0: Daniel@0: for(i=0; i