/*
# %M% %Y% %I%
# The latest update : %G% at %U%
#
#%Z% eosBayesEstimation ver %I%
#%Z% Created by 
#%Z%
#%Z% Usage : eosBayesEstimation 
#%Z% Attention
#%Z%
*/
static char __sccs_id[] = "%Z%eosBayesEstimation ver%I%; Date:%D% %Z%";

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include "../inc/eosBayes.h"

#define DEBUG
//#include "genUtil.h"

void eosBayesEstimation(eosBayes* d, int mode){
	int i;
	int j;
	double sum = 0;


	for(i=0;i<d->numDistribution;i++){
		sum=0;

		for(j=0;j<d->prior[i].n;j++){
			d->posterior[i].prob[j] = d->likelihood[i].prob[j]*d->prior[i].prob[j];
			sum += d->posterior[i].prob[j];
		}
		for(j=0;j<d->prior[i].n;j++){
			d->posterior[i].prob[j] /= sum;
		}

	}

}
