From c4f926438dcb8abe805e910399940f79ff643c4b Mon Sep 17 00:00:00 2001 From: ziejd2 Date: Thu, 14 Sep 2017 15:39:41 -0500 Subject: Add files via upload --- sourcecodes/k-best/src/ls_NML.c | 77 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 sourcecodes/k-best/src/ls_NML.c (limited to 'sourcecodes/k-best/src/ls_NML.c') diff --git a/sourcecodes/k-best/src/ls_NML.c b/sourcecodes/k-best/src/ls_NML.c new file mode 100644 index 00000000..6c3523a4 --- /dev/null +++ b/sourcecodes/k-best/src/ls_NML.c @@ -0,0 +1,77 @@ +#include +#include "get_local_scores.h" +#include "ilogi.h" +#include "reg.h" +#include "ls_NML.h" + +extern int* nof_vals; +extern int N; + +#define BIG_NML_DATA (1<<16) + +/* NML = log(ML) - log(REGRET) */ + +score_t big_nml_score(int i, varset_t psi, int nof_freqs){ + + int vc_v = nof_vals[i]; + int* freqp = freqmem; + int* end_freqp = freqp + nof_freqs * vc_v; + + score_t res = 0.0; + + for(;freqp < end_freqp; freqp += vc_v) { + int pcfreq = 0; + int v; + for(v = 0; v