@Override public void write(DataOutput out) throws IOException { out.writeInt(neighbors.size()); IntIterator neighborsIt = neighbors.iterator(); while (neighborsIt.hasNext()) { out.writeInt(neighborsIt.nextInt()); } }
@Override public void hashValues(DimensionSelector dimSelector, HyperLogLogCollector collector) { for (IntIterator rowIt = dimSelector.getRow().iterator(); rowIt.hasNext(); ) { int index = rowIt.nextInt(); final String value = dimSelector.lookupName(index); collector.add( CardinalityAggregator.hashFn.hashUnencodedChars(nullToSpecial(value)).asBytes()); } }
@Override @Nonnull public VectorEntry next() { int pos = iter.nextInt(); boolean isSet = state == VectorEntry.State.SET || keys.indexIsActive(pos); double v = isSet ? values[pos] : Double.NaN; entry.set(pos, keys.getKey(pos), v, isSet); return entry; }
/** * Get the collection of values of this vector. * * @return The collection of all values in this vector. */ public DoubleCollection values() { DoubleArrayList lst = new DoubleArrayList(size()); IntIterator iter = keys.activeIndexIterator(false); while (iter.hasNext()) { int idx = iter.nextInt(); lst.add(values[idx]); } return lst; }
@Override @Nonnull public VectorEntry next() { int pos = iter.nextInt(); return new VectorEntry(SparseVector.this, pos, keys.getKey(pos), values[pos], true); }