Package com.carrotsearch.hppc

Examples of com.carrotsearch.hppc.IntIntOpenHashMap


public class IntIntHppcOpenHashMap extends AbstractWritableIntIntMap {
  protected final IntIntOpenHashMap myMap;

  public IntIntHppcOpenHashMap() {
    myMap = new IntIntOpenHashMap();
  }
View Full Code Here


  public IntIntHppcOpenHashMap() {
    myMap = new IntIntOpenHashMap();
  }

  public IntIntHppcOpenHashMap(int initialCapacity) {
    myMap = new IntIntOpenHashMap(initialCapacity);
  }
View Full Code Here

  public IntIntHppcOpenHashMap(int initialCapacity) {
    myMap = new IntIntOpenHashMap(initialCapacity);
  }

  public IntIntHppcOpenHashMap(int initialCapacity, float loadFactor) {
    myMap = new IntIntOpenHashMap(initialCapacity, loadFactor);
  }
View Full Code Here

  }
 
  public void trimFeatures(Logger log, float threshold)
  {
    FloatArrayList tWeights = new FloatArrayList(f_weights.size());
    IntIntOpenHashMap map = new IntIntOpenHashMap();
    ObjectIntHashMap<String> m;
    int i, j, tFeatures = 1;
    boolean trim;
    String s;
   
    log.info("Trimming: ");
   
    // bias
    for (j=0; j<n_labels; j++)
      tWeights.add(f_weights.get(j));
   
    // rest
    for (i=1; i<n_features; i++)
    {
      trim = true;
     
      for (j=0; j<n_labels; j++)
      {
        if (Math.abs(f_weights.get(i*n_labels+j)) > threshold)
        {
          trim = false;
          break;
        }
      }
     
      if (!trim)
      {
        map.put(i, tFeatures++);
       
        for (j=0; j<n_labels; j++)
          tWeights.add(f_weights.get(i*n_labels+j));       
      }
    }
   
    log.info(String.format("%d -> %d\n", n_features, tFeatures));
    tWeights.trimToSize();
   
    // map
    for (String type : Lists.newArrayList(m_features.keySet()))
    {
      m = m_features.get(type);
     
      for (ObjectIntPair<String> p : m.toList())
      {
        i = map.get(p.i);
        s = (String)p.o;
       
        if (i > 0m.put(s, i);
        else    m.remove(s);
      }
View Full Code Here

      this.columns = columns;
      this.desiredFields = desiredFields;

      this.fieldNames = Lists.newArrayListWithCapacity(desiredFields.size());
      this.types = Lists.newArrayListWithCapacity(desiredFields.size());
      IntIntOpenHashMap oldToNewIds = new IntIntOpenHashMap();

      int i =0;
      for(DesiredField f : desiredFields){
        fieldNames.add(f.name);
        types.add(f.field.getType());
        oldToNewIds.put(f.origIndex, i);
        i++;
      }
      this.rewriter = new InputRewriter(oldToNewIds);
    }
View Full Code Here

public class IntIntHppcOpenHashMap extends AbstractWritableIntIntMap {
  protected final IntIntOpenHashMap myMap;

  public IntIntHppcOpenHashMap() {
    myMap = new IntIntOpenHashMap();
  }
View Full Code Here

  public IntIntHppcOpenHashMap() {
    myMap = new IntIntOpenHashMap();
  }

  public IntIntHppcOpenHashMap(int initicalCapacity) {
    myMap = new IntIntOpenHashMap(initicalCapacity);
  }
View Full Code Here

  public IntIntHppcOpenHashMap(int initicalCapacity) {
    myMap = new IntIntOpenHashMap(initicalCapacity);
  }

  public IntIntHppcOpenHashMap(int initialCapacity, float loadFactor) {
    myMap = new IntIntOpenHashMap(initialCapacity, loadFactor);
  }
View Full Code Here

      this.columns = columns;
      this.desiredFields = desiredFields;

      this.fieldNames = Lists.newArrayListWithCapacity(desiredFields.size());
      this.types = Lists.newArrayListWithCapacity(desiredFields.size());
      IntIntOpenHashMap oldToNewIds = new IntIntOpenHashMap();

      int i =0;
      for (DesiredField f : desiredFields) {
        fieldNames.add(f.name);
        types.add(f.field.getType());
        oldToNewIds.put(f.origIndex, i);
        i++;
      }
      this.rewriter = new InputRewriter(oldToNewIds);
    }
View Full Code Here

{
    public void accessAnonymousClassFieldInForEach()
    {
        // [[[start:foreach-counting]]]
        // Create a map.
        final IntIntOpenHashMap map = new IntIntOpenHashMap();
        map.put(1, 2);
        map.put(2, 5);
        map.put(3, 10);

        int count = map.forEach(new IntIntProcedure()
        {
           int count;
           public void apply(int key, int value)
           {
               if (value >= 5) count++;
View Full Code Here

TOP

Related Classes of com.carrotsearch.hppc.IntIntOpenHashMap

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.