/* C mex init_pot for in @jtree_sparse_inf_engine directory */ /* The file enter_evidence.m in directory @jtree_sparse_inf_engine call it*/ /**************************************/ /* init_pot.c has 6 input & 2 output */ /* engine */ /* clqs */ /* pots */ /* pot_type */ /* onodes */ /* ndx */ /* */ /* clpot */ /* seppot */ /**************************************/ #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