Program: 131588
Project: 131588
Buggy source:
public void createMessages(FgNode parent,Messages[] msgs,boolean logDomain){
  assert(this == parent.getFactor());
  double[] root=new double[n];
  double[][] child=new double[n][n];
  Utilities.fill(root,Double.NEGATIVE_INFINITY);
  Utilities.fill(child,Double.NEGATIVE_INFINITY);
  for (  FgEdge nbEdge : parent.getOutEdges()) {
    LinkVar link=(LinkVar)nbEdge.getVar();
    DenseFactor nbMsg=msgs[nbEdge.getId()].message;
    double oddsRatio;
    if (logDomain) {
      oddsRatio=nbMsg.getValue(LinkVar.TRUE) - nbMsg.getValue(LinkVar.FALSE);
    }
 else {
      oddsRatio=nbMsg.getValue(LinkVar.TRUE) / nbMsg.getValue(LinkVar.FALSE);
      oddsRatio=Utilities.log(oddsRatio);
    }
    if (link.getParent() == -1) {
      root[link.getChild()]=oddsRatio;
    }
 else {
      child[link.getParent()][link.getChild()]=oddsRatio;
    }
  }
  DepIoChart chart=ProjectiveDependencyParser.insideOutsideAlgorithm(root,child);
  double pi=logDomain ? 0.0 : 1.0;
  for (  FgEdge nbEdge : parent.getOutEdges()) {
    DenseFactor nbMsg=msgs[nbEdge.getId()].message;
    if (logDomain) {
      pi+=nbMsg.getValue(LinkVar.FALSE);
    }
 else {
      pi*=nbMsg.getValue(LinkVar.FALSE);
    }
  }
  double partition=logDomain ? pi + chart.getLogPartitionFunction() : pi * Utilities.exp(chart.getLogPartitionFunction());
  for (  FgEdge nbEdge : parent.getOutEdges()) {
    LinkVar link=(LinkVar)nbEdge.getVar();
    double beliefTrue;
    double beliefFalse;
    if (logDomain) {
      beliefTrue=pi + chart.getLogSumOfPotentials(link.getParent(),link.getChild());
      beliefFalse=Utilities.logSubtract(partition,beliefTrue);
    }
 else {
      beliefTrue=pi * Utilities.exp(chart.getLogSumOfPotentials(link.getParent(),link.getChild()));
      beliefFalse=partition - beliefTrue;
    }
    msgs[nbEdge.getId()].newMessage.setValue(LinkVar.FALSE,beliefFalse);
    msgs[nbEdge.getId()].newMessage.setValue(LinkVar.TRUE,beliefTrue);
  }
}

Fixed version (ground truth):
public void createMessages(FgNode parent,Messages[] msgs,boolean logDomain){
  assert(this == parent.getFactor());
  double[] root=new double[n];
  double[][] child=new double[n][n];
  Utilities.fill(root,Double.NEGATIVE_INFINITY);
  Utilities.fill(child,Double.NEGATIVE_INFINITY);
  for (  FgEdge inEdge : parent.getInEdges()) {
    LinkVar link=(LinkVar)inEdge.getVar();
    DenseFactor inMsg=msgs[inEdge.getId()].message;
    double oddsRatio;
    if (logDomain) {
      oddsRatio=inMsg.getValue(LinkVar.TRUE) - inMsg.getValue(LinkVar.FALSE);
    }
 else {
      oddsRatio=inMsg.getValue(LinkVar.TRUE) / inMsg.getValue(LinkVar.FALSE);
      oddsRatio=Utilities.log(oddsRatio);
    }
    if (link.getParent() == -1) {
      root[link.getChild()]=oddsRatio;
    }
 else {
      child[link.getParent()][link.getChild()]=oddsRatio;
    }
  }
  DepIoChart chart=ProjectiveDependencyParser.insideOutsideAlgorithm(root,child);
  double pi=logDomain ? 0.0 : 1.0;
  for (  FgEdge inEdge : parent.getInEdges()) {
    DenseFactor inMsg=msgs[inEdge.getId()].message;
    if (logDomain) {
      pi+=inMsg.getValue(LinkVar.FALSE);
    }
 else {
      pi*=inMsg.getValue(LinkVar.FALSE);
    }
  }
  double partition=logDomain ? pi + chart.getLogPartitionFunction() : pi * Utilities.exp(chart.getLogPartitionFunction());
  if (log.isTraceEnabled()) {
    log.trace(String.format("String_Node_Str",partition));
  }
  for (  FgEdge outEdge : parent.getOutEdges()) {
    LinkVar link=(LinkVar)outEdge.getVar();
    double beliefTrue;
    double beliefFalse;
    if (logDomain) {
      beliefTrue=pi + chart.getLogSumOfPotentials(link.getParent(),link.getChild());
      beliefFalse=Utilities.logSubtract(partition,beliefTrue);
    }
 else {
      beliefTrue=pi * Utilities.exp(chart.getLogSumOfPotentials(link.getParent(),link.getChild()));
      beliefFalse=partition - beliefTrue;
    }
    if (log.isTraceEnabled()) {
      log.trace(String.format("String_Node_Str",link.getParent(),link.getChild(),beliefTrue));
      log.trace(String.format("String_Node_Str",link.getParent(),link.getChild(),beliefFalse));
    }
    FgEdge inEdge=outEdge.getOpposing();
    DenseFactor inMsg=msgs[inEdge.getId()].message;
    if (logDomain) {
      beliefTrue-=inMsg.getValue(LinkVar.TRUE);
      log.debug(String.format("String_Node_Str",link.getParent(),link.getChild(),Utilities.exp(beliefTrue)));
      beliefFalse-=inMsg.getValue(LinkVar.FALSE);
      log.debug(String.format("String_Node_Str",link.getParent(),link.getChild(),Utilities.exp(beliefFalse)));
    }
 else {
      beliefTrue/=inMsg.getValue(LinkVar.TRUE);
      beliefFalse/=inMsg.getValue(LinkVar.FALSE);
    }
    msgs[outEdge.getId()].newMessage.setValue(LinkVar.FALSE,beliefFalse);
    msgs[outEdge.getId()].newMessage.setValue(LinkVar.TRUE,beliefTrue);
  }
}