public Variable findVariable (String name) { for (int i = 0; i < getNumVars (); i++) { Variable var = getVariable (i); if (var.getLabel().equals (name)) return var; } return null; }
public Variable findVariable (String name) { for (int i = 0; i < getNumVars (); i++) { Variable var = getVariable (i); if (var.getLabel().equals (name)) return var; } return null; }
public Variable findVariable (String name) { for (int i = 0; i < getNumVars (); i++) { Variable var = getVariable (i); if (var.getLabel().equals (name)) return var; } return null; }
private int computeSubsetHashValue (DiscreteFactor subset) { // If potentials have more than 32 variables, we need to use an // expandable bitset, but then again, you probably wouldn't have // enough memory to represent the potential anyway assert getNumVars () <= 32; int result = 0; double numVars = subset.varSet ().size (); int lrgi = 0; // relies on variables being sorted for (int smi = 0; smi < numVars; smi++) { Object var = subset.getVariable (smi); // this loop breaks if subset is not in fact a subset, but that is an error anyway while (var != this.getVariable (lrgi)) { lrgi++; } result |= (1 << lrgi); } return result; }
private int computeSubsetHashValue (DiscreteFactor subset) { // If potentials have more than 32 variables, we need to use an // expandable bitset, but then again, you probably wouldn't have // enough memory to represent the potential anyway assert getNumVars () <= 32; int result = 0; double numVars = subset.varSet ().size (); int lrgi = 0; // relies on variables being sorted for (int smi = 0; smi < numVars; smi++) { Object var = subset.getVariable (smi); // this loop breaks if subset is not in fact a subset, but that is an error anyway while (var != this.getVariable (lrgi)) { lrgi++; } result |= (1 << lrgi); } return result; }
private int computeSubsetHashValue (DiscreteFactor subset) { // If potentials have more than 32 variables, we need to use an // expandable bitset, but then again, you probably wouldn't have // enough memory to represent the potential anyway assert getNumVars () <= 32; int result = 0; double numVars = subset.varSet ().size (); int lrgi = 0; // relies on variables being sorted for (int smi = 0; smi < numVars; smi++) { Object var = subset.getVariable (smi); // this loop breaks if subset is not in fact a subset, but that is an error anyway while (var != this.getVariable (lrgi)) { lrgi++; } result |= (1 << lrgi); } return result; }
static Factor hackyMixture (AbstractTableFactor ptl1, AbstractTableFactor ptl2, double weight) if (ptl1.getNumVars() != ptl2.getNumVars()) { throw new IllegalArgumentException (); for (int i = 0; i < ptl2.getNumVars(); i++) { if (ptl1.getVariable (i) != ptl2.getVariable (i)) { throw new IllegalArgumentException ();
static Factor hackyMixture (AbstractTableFactor ptl1, AbstractTableFactor ptl2, double weight) if (ptl1.getNumVars() != ptl2.getNumVars()) { throw new IllegalArgumentException (); for (int i = 0; i < ptl2.getNumVars(); i++) { if (ptl1.getVariable (i) != ptl2.getVariable (i)) { throw new IllegalArgumentException ();
static Factor hackyMixture (AbstractTableFactor ptl1, AbstractTableFactor ptl2, double weight) if (ptl1.getNumVars() != ptl2.getNumVars()) { throw new IllegalArgumentException (); for (int i = 0; i < ptl2.getNumVars(); i++) { if (ptl1.getVariable (i) != ptl2.getVariable (i)) { throw new IllegalArgumentException ();