From 33994330b8395c4c44ad0ddc1e678372404c3566 Mon Sep 17 00:00:00 2001 From: desaicwtf Date: Mon, 5 Jul 2010 15:26:42 +0000 Subject: forget to add files git-svn-id: https://ws10smt.googlecode.com/svn/trunk@126 ec762483-ff6d-05da-a07a-a48fb63a330f --- gi/posterior-regularisation/prjava/src/arr/F.java | 70 +++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 gi/posterior-regularisation/prjava/src/arr/F.java (limited to 'gi/posterior-regularisation/prjava/src/arr') diff --git a/gi/posterior-regularisation/prjava/src/arr/F.java b/gi/posterior-regularisation/prjava/src/arr/F.java new file mode 100644 index 00000000..c194496e --- /dev/null +++ b/gi/posterior-regularisation/prjava/src/arr/F.java @@ -0,0 +1,70 @@ +package arr; + +public class F { + public static void randomise(double probs[]) + { + double z = 0; + for (int i = 0; i < probs.length; ++i) + { + probs[i] = 3 + Math.random(); + z += probs[i]; + } + + for (int i = 0; i < probs.length; ++i) + probs[i] /= z; + } + + public static void l1normalize(double [] a){ + double sum=0; + for(int i=0;i m) + { + m = probs[i]; + mi = i; + } + } + return mi; + } + +} -- cgit v1.2.3