it.unimi.dsi.fastutil.bytes.ByteSet Java Examples

The following examples show how to use it.unimi.dsi.fastutil.bytes.ByteSet. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BooleanColumn.java    From tablesaw with Apache License 2.0 5 votes vote down vote up
@Override
public int countUnique() {
  ByteSet count = new ByteOpenHashSet(3);
  for (byte next : data) {
    count.add(next);
  }
  return count.size();
}
 
Example #2
Source File: BooleanColumn.java    From tablesaw with Apache License 2.0 5 votes vote down vote up
@Override
public BooleanColumn unique() {
  ByteSet count = new ByteOpenHashSet(3);
  for (byte next : data) {
    count.add(next);
  }
  ByteArrayList list = new ByteArrayList(count);
  return new BooleanColumn(name() + " Unique values", list);
}
 
Example #3
Source File: SocialProofGenerator.java    From GraphJet with Apache License 2.0 5 votes vote down vote up
/**
 * Collect social proofs for a given {@link SocialProofRequest}.
 *
 * @param leftSeedNodesWithWeight Engagement edges from these left nodes are iterated and collected
 * @param rightNodeIds            Right nodes for which we want to generate social proofs
 * @param validSocialProofTypes   Social proof types that we are interested in
 */
private void collectRightNodeInfo(
  Long2DoubleMap leftSeedNodesWithWeight, LongSet rightNodeIds, byte[] validSocialProofTypes) {
  ByteSet socialProofTypeSet = new ByteArraySet(validSocialProofTypes);

  // Iterate through the set of left node seeds with weights.
  // For each left node, go through its edges and collect the engagements on the right nodes
  for (Long2DoubleMap.Entry entry: leftSeedNodesWithWeight.long2DoubleEntrySet()) {
    long leftNode = entry.getLongKey();
    EdgeIterator edgeIterator = leftIndexedBipartiteGraph.getLeftNodeEdges(leftNode);
    if (edgeIterator == null) {
      continue;
    }

    int numEdgePerNode = 0;
    double weight = entry.getDoubleValue();
    seenEdgesPerNode.clear();

    // Sequentially iterate through the latest MAX_EDGES_PER_NODE edges per node
    while (edgeIterator.hasNext() && numEdgePerNode++ < MAX_EDGES_PER_NODE) {
      long rightNode = idMask.restore(edgeIterator.nextLong());
      byte edgeType = edgeIterator.currentEdgeType();

      boolean hasSeenRightNodeFromEdge =
        seenEdgesPerNode.containsKey(rightNode) && seenEdgesPerNode.get(rightNode) == edgeType;

      boolean isValidEngagement = rightNodeIds.contains(rightNode) &&
        socialProofTypeSet.contains(edgeType);

      if (hasSeenRightNodeFromEdge || !isValidEngagement) {
        continue;
      }
      updateVisitedRightNodes(leftNode, rightNode, edgeType, weight);
    }
  }
}
 
Example #4
Source File: BooleanColumn.java    From tablesaw with Apache License 2.0 5 votes vote down vote up
@Override
public int countUnique() {
  ByteSet count = new ByteOpenHashSet(3);
  for (byte next : data) {
    count.add(next);
  }
  return count.size();
}
 
Example #5
Source File: BooleanColumn.java    From tablesaw with Apache License 2.0 5 votes vote down vote up
@Override
public BooleanColumn unique() {
  ByteSet count = new ByteOpenHashSet(3);
  for (byte next : data) {
    count.add(next);
  }
  ByteArrayList list = new ByteArrayList(count);
  return new BooleanColumn(name() + " Unique values", list);
}