Package com.carrotsearch.hppc

Examples of com.carrotsearch.hppc.IntArrayList


  /* (non-Javadoc)
   * @see edu.colorado.clear.classification.vector.AbstractFeatureVector#init()
   */
  protected void init()
  {
    i_indices = new IntArrayList();
  }
View Full Code Here


    Set<String> skipPaths = new HashSet<String>();
    String line, ontoPath = "", semPath = "";
    int i, treeId, predId, prevId = -1;
    CTTree tree1 = null, tree2 = null;
    IntArrayList[] lists;
    IntArrayList list;
    String[] tmp;
   
    while ((line = fin.readLine()) != null)
    {
      tmp = line.split(" ");
      if (skipPaths.contains(tmp[0]))  continue;
     
      if (!semPath.equals(tmp[0]))
      {
        ontoPath = UTFile.replaceExtension("nw"+File.separator+tmp[0], "parse");
       
        if (!new File(ontoDir+File.separator+ontoPath).exists())
        {
          skipPaths.add(tmp[0]);
          continue;
        }
       
        semPath = tmp[0];
        prevId  = -1;
       
        reader1.close();
        reader2.close();
       
        reader1.open(UTInput.createBufferedFileReader(ontoDir+File.separator+ontoPath));
        reader2.open(UTInput.createBufferedFileReader(semDir +File.separator+semPath));
      }
     
      treeId = Integer.parseInt(tmp[1]);
      predId = Integer.parseInt(tmp[2]);
     
      for (i=0; i<treeId-prevId; i++)
      {
        tree1 = reader1.nextTree();
        tree2 = reader2.nextTree();
      }
     
      prevId = treeId;
      lists  = CTLib.getTokenMapList(tree2, tree1);
     
      if (lists == null)
      {
        skipPaths.add(tmp[0]);
        continue;
      }
     
      list = lists[tree2.getTerminal(predId).getTokenId()];
     
      if (list.size() > 1)
      {
        skipPaths.add(tmp[0]);
        continue;
      }
     
      predId = tree1.getToken(list.get(0)).getTerminalId();
      map.put(getKey(ontoPath, treeId, predId), tmp[4]);
    }
   
    return map;
  }
View Full Code Here

      terminals.add(curr);
  }
 
  public IntArrayList getSubTerminalIdList()
  {
    IntArrayList list = new IntArrayList();
   
    for (CTNode node : getSubTerminals())
      list.add(node.getTerminalId());
   
    return list;
  }
View Full Code Here

    int size1 = tokens1.size(), size2 = tokens2.size(), tId1, tId2, len1, len2;
    IntArrayList[] map = new IntArrayList[size1];
    String form1, form2;
   
    for (tId1=0; tId1<size1; tId1++)
      map[tId1] = new IntArrayList();
   
    for (tId1=0,tId2=0; tId1 < size1; tId1++,tId2++)
    {
      form1 = tokens1.get(tId1).form;
      form2 = tokens2.get(tId2).form;
View Full Code Here

    Random rand = new Random(5);
   
    final int N = space.getInstanceSize();
    final int D = space.getFeatureSize();
   
    IntArrayList        ys = space.getYs();
    ArrayList<int[]>    xs = space.getXs();
    ArrayList<double[]> vs = space.getVs();
   
    double[] alpha  = new double[N];
    double[] weight = new double[D];
View Full Code Here

   
    final int N = space.getInstanceSize();
    final int D = space.getFeatureSize();
    final double INNER_MIN = Math.min(1e-8, d_eps);
   
    IntArrayList        ys = space.getYs();
    ArrayList<int[]>    xs = space.getXs();
    ArrayList<double[]> vs = space.getVs();
   
    double[] alpha  = new double[2*N];
    double[] weight = new double[D];
View Full Code Here

    final int D  = space.getFeatureSize();
    final int L  = space.getLabelSize();
    final int N  = space.getInstanceSize();
    final int WS = D * L;
   
    IntArrayList        ys = space.getYs();
    ArrayList<int[]>    xs = space.getXs();
    ArrayList<double[]> vs = space.getVs();
   
    AbstractModel model = space.getModel();
    double[] cWeights = UTArray.toDoubleArray(model.getWeights());
    double[] gs = new double[WS];
   
    double stdev, prevScore, currScore = 0;
    int[] indices = UTArray.range(N);
    int i, j, correct;
   
    int      yi;
    int[]    xi;
    double[] vi = null;
   
    for (i=0; i<MAX_ITER; i++)
    {
      UTArray.shuffle(new Random(5), indices, N);
      prevScore = currScore;
      Arrays.fill(gs, 0);
      correct = 0;
     
      for (j=0; j<N; j++)
      {
        yi = ys.get(indices[j]);
        xi = xs.get(indices[j]);
        if (space.hasWeight())  vi = vs.get(indices[j]);
       
        if (!update(L, yi, xi, vi, gs, cWeights))
          correct++;
View Full Code Here

        }

        // NOTE: currently BytesRef inside Maps aren't converted here because
        // if the map is coming from a ESSearchTask/EsGetTask they already contain strings
        // and we have no case in which another Task returns a Map with ByteRefs/Strings inside.
        final IntArrayList stringColumns = new IntArrayList();
        final IntArrayList stringCollectionColumns = new IntArrayList();
        int idx = 0;
        for (DataType dataType : dataTypes) {
            if (BYTES_REF_TYPES.contains(dataType)) {
                stringColumns.add(idx);
            } else if ((DataTypes.isCollectionType(dataType)
                    && (BYTES_REF_TYPES.contains(((CollectionType)dataType).innerType())))) {
                stringCollectionColumns.add(idx);
            }
            idx++;
        }

        for (int r = 0; r < rows.length; r++) {
View Full Code Here

        }
        states = new ArrayList<>(fieldEnums.size());
        for (TermsEnum tEnum : fieldEnums) {
            states.add(new TermsEnumState(tEnum));
        }
        stateSlots = new IntArrayList(states.size());
    }
View Full Code Here

    public PortsRange(String portRange) {
        this.portRange = portRange;
    }

    public int[] ports() throws NumberFormatException {
        final IntArrayList ports = new IntArrayList();
        iterate(new PortCallback() {
            @Override
            public boolean onPortNumber(int portNumber) {
                ports.add(portNumber);
                return false;
            }
        });
        return ports.toArray();
    }
View Full Code Here

TOP

Related Classes of com.carrotsearch.hppc.IntArrayList

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.