public double doOperation() throws OperatorFailedException {
  double priorPrecision=1.0 / prior.variance();
  double priorMean=prior.mean();
  double likelihoodPrecision=1.0 / likelihood.variance();
  double total=0;
  int n=0;
  for (  Attribute<double[]> statistic : dataList) {
    for (    double x : statistic.getAttributeValue()) {
      if (isLog)       total+=Math.log(x);
 else       total+=x;
      n++;
    }
  }
  double precision=priorPrecision + likelihoodPrecision * n;
  double mu=(priorPrecision * priorMean + likelihoodPrecision * total) / precision;
  meanParameter.setParameterValue(0,MathUtils.nextGaussian() / Math.sqrt(precision) + mu);
  return 0;
}

public double doOperation ( ) throws OperatorFailedException { double priorPrecision = 1.0 / prior . variance ( ) ; double priorMean = prior . mean ( ) ; double likelihoodPrecision = 1.0 / likelihood . variance ( ) ; double total = 0 ; int n = 0 ; for ( Attribute < double [ ] > statistic : dataList ) { for ( double x : statistic . getAttributeValue ( ) ) { if ( isLog ) total += Math . log ( x ) ; else total += x ; n ++ ; } } double precision = priorPrecision + likelihoodPrecision * n ; double mu = ( priorPrecision * priorMean + likelihoodPrecision * total ) / precision ; meanParameter . setParameterValue ( 0 , MathUtils . nextGaussian ( ) / Math . sqrt ( precision ) + mu ) ; return 0 ; }
called by operate ( ) , does the actual operation .
