Examples of FloatArrayList


Examples of com.carrotsearch.hppc.FloatArrayList

        private final FloatArrayList values;

        public CustomFloatNumericDocValuesField(String  name, float value) {
            super(name);
            values = new FloatArrayList();
            add(value);
        }
View Full Code Here

Examples of com.clearnlp.collection.list.FloatArrayList

    return true;
  }
 
  public void threads(String[] args) throws Exception
  {
    FloatArrayList fs = new FloatArrayList();
    Random rand = new Random(0);
    int i, n = Integer.parseInt(args[0]), size = 100000000, gap = size / n;
    int[] is = new int[size];
    long st, et;
   
    for (i=0; i<size; i++)
      fs.add(i);
   
    for (i=0; i<size; i++)
      is[i] = rand.nextInt(size);
   
    st = System.currentTimeMillis();
View Full Code Here

Examples of com.clearnlp.collection.list.FloatArrayList

    }
  }
 
  void testObjectStream() throws Exception
  {
    FloatArrayList list = new FloatArrayList();
   
    list.add(0);
    list.add(1);
    list.add(2);
 
    System.out.println(Arrays.toString(list.toArray()));
   
    ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream("tmp.txt"));
    out.writeObject(list);
    out.close();
   
    ObjectInputStream in = new ObjectInputStream(new FileInputStream("tmp.txt"));
    list = (FloatArrayList)in.readObject();
    in.close();
   
    System.out.println(Arrays.toString(list.toArray()));
  }
View Full Code Here

Examples of com.clearnlp.collection.list.FloatArrayList

    m_labels    = new ObjectIntHashMap<String>();
    a_labels    = Lists.newArrayList();
    n_labels    = 0;
    m_features  = Maps.newHashMap();
    n_features  = 1;
    f_weights   = new FloatArrayList();   
  }
View Full Code Here

Examples of com.clearnlp.collection.list.FloatArrayList

    f_weights   = new FloatArrayList();   
  }
 
  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);
View Full Code Here

Examples of com.clearnlp.collection.list.FloatArrayList

 
  protected ObjectDoublePair<List<String>> developOnline(String[] developFiles, JointReader reader, AbstractOnlineStatisticalComponent<? extends AbstractState> component, StringModelAD model, AbstractAlgorithm algorithm, double bootstrapScore, byte flag) throws Exception
  {
    boolean prepareBootstrap = bootstrapScore > 0;
    List<String> currOutput, bestOutput = null;
    FloatArrayList bestWeights = null;
    double currScore, bestScore = 0;
    AbstractEval eval;
    int iter;
   
    for (iter=1; true; iter++)
View Full Code Here

Examples of com.gs.collections.impl.list.mutable.primitive.FloatArrayList

        return !predicate.accept(this.value1);
    }

    public ImmutableFloatCollection select(FloatPredicate predicate)
    {
        return predicate.accept(this.value1) ? FloatArrayList.newListWith(this.value1).toImmutable() : new FloatArrayList().toImmutable();
    }
View Full Code Here

Examples of it.unimi.dsi.fastutil.floats.FloatArrayList

   
    @Override
    public Explanation explain(int doc){
      String[] vals = _array.getTranslatedData(doc, _dataCache.valArray);
     
      FloatList scoreList = new FloatArrayList(_dataCache.valArray.size());
      ArrayList<Explanation> explList = new ArrayList<Explanation>(scoreList.size());
      for (String val : vals)
      {
        int idx = _dataCache.valArray.indexOf(val);
        if (idx>=0){
          scoreList.add(_function.score(_dataCache.freqs[idx], _boostList[idx]));
          explList.add(_function.explain(_dataCache.freqs[idx], _boostList[idx]));
        }
      }
      Explanation topLevel = _function.explain(scoreList.toFloatArray());
      for (Explanation sub : explList){
        topLevel.addDetail(sub);
      }
      return topLevel;
    }
View Full Code Here

Examples of it.unimi.dsi.fastutil.floats.FloatArrayList

    @Override
    public Explanation explain(int doc){
      int encoded=_dataCache.orderArray.get(doc);
     
      int count=1;
      FloatList scoreList = new FloatArrayList(_dataCache.valArray.size());
      ArrayList<Explanation> explList = new ArrayList<Explanation>(scoreList.size());
      while(encoded != 0)
      {
        if ((encoded & 0x00000001) != 0x0){
          int idx = count -1;
          scoreList.add(_function.score(_dataCache.freqs[idx], _boostList[idx]));
          explList.add(_function.explain(_dataCache.freqs[idx], _boostList[idx]));
        }
        count++;
        encoded >>>= 1;
      }
      Explanation topLevel = _function.explain(scoreList.toFloatArray());
      for (Explanation sub : explList){
        topLevel.addDetail(sub);
      }
      return topLevel;
    }
View Full Code Here

Examples of it.unimi.dsi.fastutil.floats.FloatArrayList

  @Override
  protected List<?> buildPrimitiveList(int capacity)
  {
    _type = Float.class;
    return capacity > 0 ? new FloatArrayList(capacity) : new FloatArrayList();
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.