Class SparseSelect
- All Implemented Interfaces:
it.unimi.dsi.fastutil.BigList<Long>, it.unimi.dsi.fastutil.longs.LongBigList, it.unimi.dsi.fastutil.longs.LongCollection, it.unimi.dsi.fastutil.longs.LongIterable, it.unimi.dsi.fastutil.longs.LongStack, it.unimi.dsi.fastutil.Size64, it.unimi.dsi.fastutil.Stack<Long>, Select, Serializable, Comparable<it.unimi.dsi.fastutil.BigList<? extends Long>>, Iterable<Long>, Collection<Long>
Instances of this classes do not add support to a bit vector: rather, they replace the bit vector with a succinct representation of the positions of the ones in the bit vector.
Note that some data may be shared with SparseRank: just use the factory method SparseRank.getSelect() to obtain an instance. In that
case, numBits() counts just the new data used to build the class, and not the shared part.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class EliasFanoMonotoneLongBigList
EliasFanoMonotoneLongBigList.EliasFanoMonotoneLongBigListIteratorNested classes/interfaces inherited from class it.unimi.dsi.fastutil.longs.AbstractLongBigList
it.unimi.dsi.fastutil.longs.AbstractLongBigList.LongRandomAccessSubList, it.unimi.dsi.fastutil.longs.AbstractLongBigList.LongSubList -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final booleanWhether this structure was built from aSparseRankstructure, and thus shares part of its internal state.Fields inherited from class EliasFanoMonotoneLongBigList
l, length, lowerBits, lowerBitsMask, selectUpper, upperBits -
Constructor Summary
ConstructorsModifierConstructorDescriptionSparseSelect(long[] bits, long length) Creates a new select structure using a long array.protectedSparseSelect(long n, long m, int l, long[] lowerBits, SimpleSelect selectUpper) SparseSelect(long n, long m, it.unimi.dsi.fastutil.longs.LongIterator iterator) Creates a new select structure using an iterator.SparseSelect(it.unimi.dsi.bits.BitVector bitVector) Creates a new select structure using a bit vector.SparseSelect(it.unimi.dsi.fastutil.longs.LongBigList list) Creates a new select structure using a big list of longs.SparseSelect(it.unimi.dsi.fastutil.longs.LongList list) Creates a new select structure using a list of longs. -
Method Summary
Modifier and TypeMethodDescriptionit.unimi.dsi.bits.BitVectorReturns the bit vector indexed; since the bits are not stored in this data structure, a copy is built on purpose and returned.booleanlonggetLong(long pos) Returns the element at the specified position.getRank()Creates a newSparseRankstructure sharing data with this instance.inthashCode()longnumBits()Returns the overall number of bits allocated by this structure.longselect(long rank) Returns the position of the bit of given rank.intsize()Deprecated.longsize64()toString()Methods inherited from class EliasFanoMonotoneLongBigList
dump, dump, fits, get, get, getDelta, iterator, listIterator, listIteratorMethods inherited from class it.unimi.dsi.fastutil.longs.AbstractLongBigList
add, add, add, addAll, addAll, addAll, addAll, addElements, addElements, clear, compareTo, contains, ensureIndex, ensureRestrictedIndex, forEach, get, getElements, indexOf, indexOf, lastIndexOf, lastIndexOf, peek, peekLong, pop, popLong, push, push, rem, remove, removeElements, removeLong, set, set, setElements, size, subList, top, topLongMethods inherited from class it.unimi.dsi.fastutil.longs.AbstractLongCollection
add, contains, containsAll, containsAll, forEach, remove, removeAll, removeAll, removeIf, retainAll, retainAll, toArray, toLongArray, toLongArrayMethods inherited from class AbstractCollection
isEmpty, toArray, toArrayMethods inherited from interface Collection
containsAll, isEmpty, removeAll, retainAll, toArray, toArray, toArrayMethods inherited from interface it.unimi.dsi.fastutil.longs.LongBigList
addAll, addAll, addAll, addAll, getElements, setElements, setElements, spliteratorMethods inherited from interface it.unimi.dsi.fastutil.longs.LongCollection
add, contains, containsAll, longIterator, longParallelStream, longSpliterator, longStream, parallelStream, remove, removeAll, removeIf, removeIf, removeIf, retainAll, stream, toArray, toLongArray, toLongArrayMethods inherited from interface it.unimi.dsi.fastutil.longs.LongIterable
forEach, forEachMethods inherited from interface it.unimi.dsi.fastutil.Stack
isEmpty
-
Field Details
-
fromRank
protected final boolean fromRankWhether this structure was built from aSparseRankstructure, and thus shares part of its internal state.
-
-
Constructor Details
-
SparseSelect
public SparseSelect(long[] bits, long length) Creates a new select structure using a long array.The resulting structure keeps no reference to the original array.
- Parameters:
bits- a long array containing the bits.length- the number of valid bits inbits.
-
SparseSelect
public SparseSelect(it.unimi.dsi.bits.BitVector bitVector) Creates a new select structure using a bit vector.The resulting structure keeps no reference to the original bit vector.
- Parameters:
bitVector- the input bit vector.
-
SparseSelect
public SparseSelect(long n, long m, it.unimi.dsi.fastutil.longs.LongIterator iterator) Creates a new select structure using an iterator.This constructor is particularly useful if the positions of the ones are provided by some sequential source.
- Parameters:
n- the number of bits in the underlying bit vector.m- the number of ones in the underlying bit vector.iterator- an iterator returning the positions of the ones in the underlying bit vector in increasing order.
-
SparseSelect
public SparseSelect(it.unimi.dsi.fastutil.longs.LongList list) Creates a new select structure using a list of longs.- Parameters:
list- the list of the positions of ones.
-
SparseSelect
public SparseSelect(it.unimi.dsi.fastutil.longs.LongBigList list) Creates a new select structure using a big list of longs.This constructor is particularly useful if the positions of the ones are provided by some sequential source.
- Parameters:
list- the list of the positions of ones.
-
SparseSelect
-
-
Method Details
-
getRank
Creates a newSparseRankstructure sharing data with this instance.- Returns:
- a new
SparseRankstructure sharing data with this instance.
-
size64
public long size64()- Specified by:
size64in interfaceit.unimi.dsi.fastutil.Size64- Overrides:
size64in classEliasFanoMonotoneLongBigList
-
size
Deprecated.- Specified by:
sizein interfaceit.unimi.dsi.fastutil.BigList<Long>- Specified by:
sizein interfaceCollection<Long>- Specified by:
sizein interfaceit.unimi.dsi.fastutil.Size64- Overrides:
sizein classit.unimi.dsi.fastutil.longs.AbstractLongBigList
-
getLong
public long getLong(long pos) Description copied from class:EliasFanoMonotoneLongBigListReturns the element at the specified position.- Specified by:
getLongin interfaceit.unimi.dsi.fastutil.longs.LongBigList- Overrides:
getLongin classEliasFanoMonotoneLongBigList- Parameters:
pos- a position in the list.- Returns:
- the element at the specified position; if
indexis out of bounds, behavior is undefined.
-
numBits
public long numBits()Description copied from interface:SelectReturns the overall number of bits allocated by this structure.- Specified by:
numBitsin interfaceSelect- Overrides:
numBitsin classEliasFanoMonotoneLongBigList- Returns:
- the overall number of bits allocated by this structure (not including the bits of the indexed vector).
-
select
public long select(long rank) Description copied from interface:SelectReturns the position of the bit of given rank. Equivalently, returns the greatest position that is preceded by the specified number of ones. -
bitVector
-
hashCode
public int hashCode()- Specified by:
hashCodein interfaceCollection<Long>- Overrides:
hashCodein classit.unimi.dsi.fastutil.longs.AbstractLongBigList
-
equals
- Specified by:
equalsin interfaceCollection<Long>- Overrides:
equalsin classit.unimi.dsi.fastutil.longs.AbstractLongBigList
-
toString
- Overrides:
toStringin classit.unimi.dsi.fastutil.longs.AbstractLongBigList
-