Factor ptl = unrolled.factorOf (clique);
double logZ = Math.log (ptl.sum ());
// for each assigment to the clique
// xxx SLOW this will need to be sparsified
AssignmentIterator assnIt = clique.assignmentIterator ();
int i = 0;
while (assnIt.hasNext ()) {
double marginal = Math.exp (ptl.logValue (assnIt) - logZ);
expectations [tidx][i].plusEqualsSparse (clique.getFv (), marginal);
if (defaultExpectations[tidx].location (i) != -1)
defaultExpectations [tidx].incrementValue (i, marginal);
assnIt.advance (); i++;
}
value += (ptl.logValue (observations) - logZ);
}
return value;