Package gnu.trove.iterator

Examples of gnu.trove.iterator.TIntFloatIterator


        baseDistList.set(classid, base);
    }

    private float getBaseDist(int classid) {
        float base = 0.0f;
        TIntFloatIterator it = classCenter.get(classid).data.iterator();
        while (it.hasNext()) {
            it.advance();
            base += it.value() * it.value();
        }
        return base;
    }
View Full Code Here


    System.out.println("原字典大小"+index.size());
    System.out.println("原字典大小"+feature.size());
    StringFeatureAlphabet newfeat = new StringFeatureAlphabet();
    cl.factory.setDefaultFeatureAlphabet(newfeat);
    for(int i=0;i<weights.length;i++){
        TIntFloatIterator itt = weights[i].data.iterator();
        HashSparseVector ww = new HashSparseVector();
        while(itt.hasNext()){
          itt.advance();
          float v = itt.value();
          if(Math.abs(v)<1e-3f)
            continue;
          String fea = index.get(itt.key());
          int newidx = newfeat.lookupIndex(fea);
          ww.put(newidx, v);       
      }
      weights[i] = ww; 
    }
View Full Code Here

    this.indexes = new int[values.size()];
    this.values = new float[values.size()];
    // Import and sort the indexes
    {
      TIntFloatIterator iter = values.iterator();
      for (int i = 0; iter.hasNext(); i++) {
        iter.advance();
        this.indexes[i] = iter.key();
        i++;
      }
      Arrays.sort(this.indexes);
    }
    // Import the values accordingly
View Full Code Here

TOP

Related Classes of gnu.trove.iterator.TIntFloatIterator

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.