/* C mex for distribute_evidence.c in @jtree_sparse_inf_engine directory*/ /* File enter_evidence.m in directory @jtree_sparse_inf_engine call it */ /*********************************************/ /* distribute_evidence has 3 input & 2 output*/ /* engine */ /* clpot */ /* seppot */ /* */ /* 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