Class Rank16
java.lang.Object
it.unimi.dsi.sux4j.bits.AbstractRank
it.unimi.dsi.sux4j.bits.Rank16
- All Implemented Interfaces:
Rank, Serializable
A
rank16 implementation.
rank16 is a ranking structure using just 18.75% additional space
and providing fast ranking. It is the natural ranking structure for 128-bit processors.
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionit.unimi.dsi.bits.BitVectorReturns the bit vector indexed by this structure.longcount()Returns the number of ones in the bit vector indexed by this class.longlastOne()longnumBits()Returns the overall number of bits allocated by this structure.longrank(long pos) Returns the number of ones preceding the specified position.longrank(long from, long to) Returns the number of ones in the specified interval.Methods inherited from class AbstractRank
rankZero, rankZero
-
Field Details
-
bits
protected transient long[] bits -
superCount
protected final long[] superCount -
count
protected final short[] count -
numWords
protected final int numWords -
numOnes
protected final long numOnes -
lastOne
protected final long lastOne -
bitVector
protected final it.unimi.dsi.bits.BitVector bitVector
-
-
Constructor Details
-
Rank16
public Rank16(long[] bits, long length) -
Rank16
public Rank16(it.unimi.dsi.bits.BitVector bitVector)
-
-
Method Details
-
rank
public long rank(long pos) Description copied from interface:RankReturns the number of ones preceding the specified position. -
numBits
public long numBits()Description copied from interface:RankReturns the overall number of bits allocated by this structure.- Specified by:
numBitsin interfaceRank- Returns:
- the overall number of bits allocated by this structure (not including the bits of the indexed vector).
-
count
public long count()Description copied from interface:RankReturns the number of ones in the bit vector indexed by this class.- Specified by:
countin interfaceRank- Overrides:
countin classAbstractRank- Returns:
- number of ones in the bit vector indexed by this class.
-
rank
public long rank(long from, long to) Description copied from interface:RankReturns the number of ones in the specified interval.- Specified by:
rankin interfaceRank- Overrides:
rankin classAbstractRank- Parameters:
from- a position in the bit vector between 0 (inclusive) and the length of the bit vector (inclusive).to- a position in the bit vector between 0 (inclusive) and the length of the bit vector (inclusive); must be greater than or equal tofrom.- Returns:
- the number of ones between
from(inclusive) andto(exclusive); if the parameters are out of bounds, behavior is undefined.
-
lastOne
public long lastOne() -
bitVector
-