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