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-master/BNT/potentials/Tables/CVS/Entries | 19 +++ .../BNT/potentials/Tables/CVS/Repository | 1 + .../bnt-master/BNT/potentials/Tables/CVS/Root | 1 + .../BNT/potentials/Tables/divide_by_sparse_table.c | 126 ++++++++++++++ .../BNT/potentials/Tables/divide_by_table.c | 120 ++++++++++++++ .../BNT/potentials/Tables/divide_by_table.m | 12 ++ .../BNT/potentials/Tables/extend_domain_table.m | 24 +++ .../BNT/potentials/Tables/marg_sparse_table.c | 181 +++++++++++++++++++++ .../bnt-master/BNT/potentials/Tables/marg_table.c | 175 ++++++++++++++++++++ .../bnt-master/BNT/potentials/Tables/marg_table.m | 27 +++ .../bnt-master/BNT/potentials/Tables/marg_tableC.c | 175 ++++++++++++++++++++ .../bnt-master/BNT/potentials/Tables/marg_tableM.m | 30 ++++ .../BNT/potentials/Tables/mult_by_sparse_table.c | 155 ++++++++++++++++++ .../BNT/potentials/Tables/mult_by_table.c | 114 +++++++++++++ .../BNT/potentials/Tables/mult_by_table.m | 7 + .../BNT/potentials/Tables/mult_by_table2.m | 30 ++++ .../BNT/potentials/Tables/mult_by_tableC.c | 114 +++++++++++++ .../BNT/potentials/Tables/mult_by_tableM.m | 7 + .../BNT/potentials/Tables/mult_by_table_global.m | 7 + .../bnt-master/BNT/potentials/Tables/rep_mult.c | 92 +++++++++++ .../BNT/potentials/Tables/repmat_and_mult.c | 97 +++++++++++ 21 files changed, 1514 insertions(+) create mode 100644 sourcecodes/bnt-master/BNT/potentials/Tables/CVS/Entries create mode 100644 sourcecodes/bnt-master/BNT/potentials/Tables/CVS/Repository create mode 100644 sourcecodes/bnt-master/BNT/potentials/Tables/CVS/Root create mode 100644 sourcecodes/bnt-master/BNT/potentials/Tables/divide_by_sparse_table.c create mode 100644 sourcecodes/bnt-master/BNT/potentials/Tables/divide_by_table.c create mode 100644 sourcecodes/bnt-master/BNT/potentials/Tables/divide_by_table.m create mode 100644 sourcecodes/bnt-master/BNT/potentials/Tables/extend_domain_table.m create mode 100644 sourcecodes/bnt-master/BNT/potentials/Tables/marg_sparse_table.c create mode 100644 sourcecodes/bnt-master/BNT/potentials/Tables/marg_table.c create mode 100644 sourcecodes/bnt-master/BNT/potentials/Tables/marg_table.m create mode 100644 sourcecodes/bnt-master/BNT/potentials/Tables/marg_tableC.c create mode 100644 sourcecodes/bnt-master/BNT/potentials/Tables/marg_tableM.m create mode 100644 sourcecodes/bnt-master/BNT/potentials/Tables/mult_by_sparse_table.c create mode 100644 sourcecodes/bnt-master/BNT/potentials/Tables/mult_by_table.c create mode 100644 sourcecodes/bnt-master/BNT/potentials/Tables/mult_by_table.m create mode 100644 sourcecodes/bnt-master/BNT/potentials/Tables/mult_by_table2.m create mode 100644 sourcecodes/bnt-master/BNT/potentials/Tables/mult_by_tableC.c create mode 100644 sourcecodes/bnt-master/BNT/potentials/Tables/mult_by_tableM.m create mode 100644 sourcecodes/bnt-master/BNT/potentials/Tables/mult_by_table_global.m create mode 100644 sourcecodes/bnt-master/BNT/potentials/Tables/rep_mult.c create mode 100644 sourcecodes/bnt-master/BNT/potentials/Tables/repmat_and_mult.c (limited to 'sourcecodes/bnt-master/BNT/potentials/Tables') diff --git a/sourcecodes/bnt-master/BNT/potentials/Tables/CVS/Entries b/sourcecodes/bnt-master/BNT/potentials/Tables/CVS/Entries new file mode 100644 index 00000000..f550f801 --- /dev/null +++ b/sourcecodes/bnt-master/BNT/potentials/Tables/CVS/Entries @@ -0,0 +1,19 @@ +/divide_by_sparse_table.c/1.1.1.1/Wed May 29 15:59:58 2002// +/divide_by_table.c/1.1.1.1/Wed May 29 15:59:58 2002// +/divide_by_table.m/1.1.1.1/Thu Aug 5 15:25:54 2004// +/extend_domain_table.m/1.1.1.1/Wed Aug 4 15:53:26 2004// +/marg_sparse_table.c/1.1.1.1/Wed May 29 15:59:58 2002// +/marg_table.c/1.1.1.1/Wed May 29 15:59:58 2002// +/marg_table.m/1.1.1.1/Wed Aug 4 15:51:48 2004// +/marg_tableC.c/1.1.1.1/Wed Oct 2 15:39:02 2002// +/marg_tableM.m/1.1.1.1/Tue Oct 1 17:39:08 2002// +/mult_by_sparse_table.c/1.1.1.1/Wed May 29 15:59:58 2002// +/mult_by_table.c/1.1.1.1/Tue Oct 1 21:23:22 2002// +/mult_by_table.m/1.1.1.1/Wed Aug 4 15:52:58 2004// +/mult_by_table2.m/1.1.1.1/Wed Oct 2 15:30:32 2002// +/mult_by_tableC.c/1.1.1.1/Tue Oct 1 21:33:50 2002// +/mult_by_tableM.m/1.1.1.1/Wed Oct 2 15:28:48 2002// +/mult_by_table_global.m/1.1.1.1/Sun Sep 29 10:21:30 2002// +/rep_mult.c/1.1.1.1/Wed May 29 15:59:58 2002// +/repmat_and_mult.c/1.1.1.1/Tue Oct 1 21:20:00 2002// +D diff --git a/sourcecodes/bnt-master/BNT/potentials/Tables/CVS/Repository b/sourcecodes/bnt-master/BNT/potentials/Tables/CVS/Repository new file mode 100644 index 00000000..e52428a3 --- /dev/null +++ b/sourcecodes/bnt-master/BNT/potentials/Tables/CVS/Repository @@ -0,0 +1 @@ +FullBNT/BNT/potentials/Tables diff --git a/sourcecodes/bnt-master/BNT/potentials/Tables/CVS/Root b/sourcecodes/bnt-master/BNT/potentials/Tables/CVS/Root new file mode 100644 index 00000000..f3bd14a6 --- /dev/null +++ b/sourcecodes/bnt-master/BNT/potentials/Tables/CVS/Root @@ -0,0 +1 @@ +:ext:nsaunier@bnt.cvs.sourceforge.net:/cvsroot/bnt diff --git a/sourcecodes/bnt-master/BNT/potentials/Tables/divide_by_sparse_table.c b/sourcecodes/bnt-master/BNT/potentials/Tables/divide_by_sparse_table.c new file mode 100644 index 00000000..d7645ab1 --- /dev/null +++ b/sourcecodes/bnt-master/BNT/potentials/Tables/divide_by_sparse_table.c @@ -0,0 +1,126 @@ +/* divide_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 +#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 +#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; i1 + sz = bigsz; + sz(map) = 1; % don't replicate along small domain, which is shared + % we can use repmat instead of myrepmat, because we know length(sz)>1 + smallT = repmat(smallT, sz(:)'); + bigT(:) = bigT(:) .* smallT(:); + end +end diff --git a/sourcecodes/bnt-master/BNT/potentials/Tables/mult_by_tableC.c b/sourcecodes/bnt-master/BNT/potentials/Tables/mult_by_tableC.c new file mode 100644 index 00000000..3f67983d --- /dev/null +++ b/sourcecodes/bnt-master/BNT/potentials/Tables/mult_by_tableC.c @@ -0,0 +1,114 @@ +/* mult_by_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 "mex.h" + +void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]){ + int i, j, count, NB, NS, siz_b, siz_s, ndim, temp; + int *mask, *sx, *sy, *cpsy, *subs, *s, *cpsy2; + double *pbDomain, *psDomain, *sp, *zp, *bs; + + plhs[0] = mxDuplicateArray(prhs[0]); + zp = mxGetPr(plhs[0]); + + siz_b = mxGetNumberOfElements(prhs[1]); + siz_s = mxGetNumberOfElements(prhs[4]); + pbDomain = mxGetPr(prhs[1]); + psDomain = mxGetPr(prhs[4]); + + NB = mxGetNumberOfElements(prhs[0]); + NS = mxGetNumberOfElements(prhs[3]); + sp = mxGetPr(prhs[3]); + + bs = mxGetPr(prhs[2]); + + if(NS == 1){ + for(i=0; i 1) + mexErrMsgTxt("Too many output arguments."); + + xnd = mxGetNumberOfDimensions(prhs[0]); + ynd = mxGetNumberOfDimensions(prhs[1]); + xdim = mxGetDimensions(prhs[0]); + ydim = mxGetDimensions(prhs[1]); + ndim = mxGetNumberOfElements(prhs[2]); + + pSizes = mxGetPr(prhs[2]); + + sx = (int *)malloc(sizeof(int)*ndim); + sy = (int *)malloc(sizeof(int)*ndim); + s = (int *)malloc(sizeof(int)*ndim); + s1 = (int *)malloc(sizeof(int)*ndim); + *(cpsx = (int *)malloc(sizeof(int)*ndim)) = 1; + *(cpsy = (int *)malloc(sizeof(int)*ndim)) = 1; + subs = (int *)malloc(sizeof(int)*ndim); + cpsx2 = (int *)malloc(sizeof(int)*ndim); + cpsy2 = (int *)malloc(sizeof(int)*ndim); + for(i=0; i 1) + mexErrMsgTxt("Too many output arguments."); + + plhs[0] = mxDuplicateArray(prhs[0]); + zp = mxGetPr(plhs[0]); + sp = mxGetPr(prhs[1]); + + xnd = mxGetNumberOfDimensions(prhs[0]); + ynd = mxGetNumberOfDimensions(prhs[1]); + xdim = mxGetDimensions(prhs[0]); + ydim = mxGetDimensions(prhs[1]); + ndim = xnd; + + NB = mxGetNumberOfElements(prhs[0]); + NS = mxGetNumberOfElements(prhs[1]); + + if(NS == 1){ + for(i=0; i