Package gnu.trove

Examples of gnu.trove.THashSet$HashProcedure


    });
  }

  private void removeFromVariableCaches (Variable victim)
  {
    Set survivors = new THashSet (variablesSet ());
    survivors.remove (victim);

    int vi = 0;
    TIntIntHashMap dict = new TIntIntHashMap (survivors.size ());
    // dict.setDefaultValue (-1);  No longer supported, but this.getIndex() written to avoid need for this.
    my2global = new int[survivors.size ()];

    for (Iterator it = survivors.iterator (); it.hasNext();) {
      Variable var = (Variable) it.next ();
      int gvi = var.getIndex ();
      dict.put (gvi, vi);
      my2global [vi] = gvi;
    }
View Full Code Here


  /** Returns a collection of all factors that involve only the given variables.
   *   That is, all factors whose domain is a subset of the given collection.
   */
  public Collection allFactorsContaining (Collection vars)
  {
    THashSet factors = new THashSet ();
    for (Iterator it = factorsIterator (); it.hasNext ();) {
      Factor ptl = (Factor) it.next ();
      if (vars.containsAll (ptl.varSet ()))
        factors.add (ptl);
    }
    return factors;
  }
View Full Code Here

    return szs;
  }

  public static VarSet defaultIntersection (VarSet v1, VarSet v2)
  {// Grossly inefficient implementation
    THashSet hset = new THashSet (v1);
    hset.retainAll (v2);
    Variable[] ret = new Variable [hset.size ()];

    int vai = 0;
    for (int vi = 0; vi < v1.size(); vi++) {
      Variable var = v1.get (vi);
      if (hset.contains (var)) { ret[vai++] = var; }
    }

    return new HashVarSet (ret);
  }
View Full Code Here

    {
      Set container = (Set) obj2set.get (obj);
      if (container != null) {
        return container;
      } else {
        Set newSet = new THashSet ();
        newSet.add (obj);
        obj2set.put (obj, newSet);
        return newSet;
      }
    }
View Full Code Here

  }

  public void computeMarginals (FactorGraph fg)
  {
    initForGraph (fg);
    marked = new THashSet (); lambdaPropagation (fg, null, root);
    marked = new THashSet (); piPropagation (fg, root);
  }
View Full Code Here

  private void computeCousins ()
  {
    for (Iterator it = edgeIterator (); it.hasNext();) {
      RegionEdge edge = (RegionEdge) it.next ();
      Set cousins = new THashSet (edge.from.descendants);
      cousins.removeAll (edge.to.descendants);
      cousins.remove (edge.to);
      cousins.add (edge.from);
      edge.cousins = cousins;
    }
  }
View Full Code Here

    }
  }

  private void computeDescendantsRec (Region region)
  {
    Set descendants = new THashSet (region.children.size ());

    // all region graphs are DAGs, so no infinite regress
    for (Iterator it = region.children.iterator (); it.hasNext();) {
      Region child = (Region) it.next ();
      computeDescendantsRec (child);
      descendants.add (child);
      descendants.addAll (child.descendants);
    }

    region.descendants = descendants;
  }
View Full Code Here

  }


  public Set sepsetPotentials()
  {
    THashSet set = new THashSet();
    TIntObjectIterator it = sepsets.iterator();
    while (it.hasNext()) {
      it.advance();
      Factor ptl = ((Sepset) it.value()).ptl;
      set.add(ptl);
    }

    return set;
  }
View Full Code Here

    });
  }

  private void removeFromVariableCaches (Variable victim)
  {
    Set survivors = new THashSet (variablesSet ());
    survivors.remove (victim);

    int vi = 0;
    TIntIntHashMap dict = new TIntIntHashMap (survivors.size ());
    // dict.setDefaultValue (-1);  No longer supported, but this.getIndex() written to avoid need for this.
    my2global = new int[survivors.size ()];

    for (Iterator it = survivors.iterator (); it.hasNext();) {
      Variable var = (Variable) it.next ();
      int gvi = var.getIndex ();
      dict.put (gvi, vi);
      my2global [vi] = gvi;
    }
View Full Code Here

  /** Returns a collection of all factors that involve only the given variables.
   *   That is, all factors whose domain is a subset of the given collection.
   */
  public Collection allFactorsContaining (Collection vars)
  {
    THashSet factors = new THashSet ();
    for (Iterator it = factorsIterator (); it.hasNext ();) {
      Factor ptl = (Factor) it.next ();
      if (vars.containsAll (ptl.varSet ()))
        factors.add (ptl);
    }
    return factors;
  }
View Full Code Here

TOP

Related Classes of gnu.trove.THashSet$HashProcedure

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.