Package org.apache.mahout.math.list

Examples of org.apache.mahout.math.list.IntArrayList


  @Override
  public void readFields(DataInput in) throws IOException {
    super.readFields(in);
    this.mass = in.readInt();
    int numpoints = in.readInt();
    this.boundPoints = new IntArrayList();
    for (int i = 0; i < numpoints; i++) {
      this.boundPoints.add(in.readInt());
    }
    this.mass = boundPoints.size();
  }
View Full Code Here


    int start = groupId * maxPerGroup;
    int end = start + maxPerGroup;
    if (end > numFeatures) {
      end = numFeatures;
    }
    IntArrayList ret = new IntArrayList();
    for (int i = start; i < end; i++) {
      ret.add(i);
    }
    return ret;
  }
View Full Code Here

  public Map<Integer,MutableLong> generateFList() {
    Map<Integer,MutableLong> frequencyList = Maps.newHashMap();
    Iterator<Pair<IntArrayList,Long>> it = iterator();
    while (it.hasNext()) {
      Pair<IntArrayList,Long> p = it.next();
      IntArrayList items = p.getFirst();
      for (int idx = 0; idx < items.size(); idx++) {
        if (!frequencyList.containsKey(items.get(idx))) {
          frequencyList.put(items.get(idx), new MutableLong(0));
        }
        frequencyList.get(items.get(idx)).add(p.getSecond());
      }
    }
    return frequencyList;
  }
View Full Code Here

        int[] items = new int[length];
        for (int j = 0; j < length; j++) {
          vInt.readFields(in);
          items[j] = vInt.get();
        }
        Pair<IntArrayList,Long> transaction = new Pair<IntArrayList,Long>(new IntArrayList(items), support);
        transactionSet.add(transaction);
      }
    } else {
      vInt.readFields(in);
      nodes = vInt.get();
View Full Code Here

        vLong.write(out);

        vInt.set(transaction.getFirst().size());
        vInt.write(out);

        IntArrayList items = transaction.getFirst();
        for (int idx = 0; idx < items.size(); idx++) {
          int item = items.get(idx);
          vInt.set(item);
          vInt.write(out);
        }
      }
    } else {
View Full Code Here

    super.setUp();
    gen = RandomUtils.getRandom();
  }

  private IntArrayList generateRandomArray() {
    IntArrayList list = new IntArrayList();
    for (int i = 0; i < MAX_FEATURES; i++) {
      if (gen.nextInt() % SKIP_RATE == 0) {
        list.add(i);
      }
    }
    return list;
  }
View Full Code Here

   
    TransactionTree tree = new TransactionTree();
    int nodes = 0;
    int total = 0;
    for (int i = 0; i < MAX_TRANSACTIONS; i++) {
      IntArrayList array = generateRandomArray();
      total += array.size();
      nodes += tree.addPattern(array, 1 + gen.nextInt(MAX_DUPLICATION));
    }

    log.info("Input integers: {}", total);
    log.info("Input data Size: {}", total * SIZE_INT / (double) MEGABYTE);
View Full Code Here

   * (8,6,7)</tt>
   *
   * @param keyList the list to be filled, can have any size.
   */
  public void keysSortedByValue(ShortArrayList keyList) {
    pairsSortedByValue(keyList, new IntArrayList(size()));
  }
View Full Code Here

   * #forEachKey(ShortProcedure)}. <p> This method can be used to iterate over the values of the receiver.
   *
   * @return the values.
   */
  public IntArrayList values() {
    IntArrayList list = new IntArrayList(size());
    values(list);
    return list;
  }
View Full Code Here

   * #forEachKey(IntProcedure)}. <p> This method can be used to iterate over the keys of the receiver.
   *
   * @return the keys.
   */
  public IntArrayList keys() {
    IntArrayList list = new IntArrayList(size());
    keys(list);
    return list;
  }
View Full Code Here

TOP

Related Classes of org.apache.mahout.math.list.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.