From 8070dc963753142bb86c4ed698d91fd623ed28e7 Mon Sep 17 00:00:00 2001 From: ziejd2 Date: Thu, 28 Sep 2017 15:04:40 -0500 Subject: BNW using Octave instead of Matlab. This version of BNW should perform the same as the original version. The only difference is that it uses Octave instead of Matlab when running BayesNet Toolbox during parameter learning. I am calling this BNW_1.02. It can be accessed at: compbio.uthsc.edu/BNW_1.02 --- .../BNT/potentials/Tables/mult_by_sparse_table.c | 155 +++++++++++++++++++++ 1 file changed, 155 insertions(+) create mode 100644 sourcecodes/bnt-master/BNT/potentials/Tables/mult_by_sparse_table.c (limited to 'sourcecodes/bnt-master/BNT/potentials/Tables/mult_by_sparse_table.c') diff --git a/sourcecodes/bnt-master/BNT/potentials/Tables/mult_by_sparse_table.c b/sourcecodes/bnt-master/BNT/potentials/Tables/mult_by_sparse_table.c new file mode 100644 index 00000000..c1331508 --- /dev/null +++ b/sourcecodes/bnt-master/BNT/potentials/Tables/mult_by_sparse_table.c @@ -0,0 +1,155 @@ +/* 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