Documentation
¶
Overview ¶
Package rsdic provides a rank/select dictionary supporting many basic operations in constant time using very small working space (smaller than original).
Index ¶
- Constants
- type BufferedBits
- type RSDic
- func (rs RSDic) Bit(pos uint64) bool
- func (rs RSDic) BitAndRank(pos uint64) (bool, uint64)
- func (rsd *RSDic) CloseWriter() error
- func (rsd *RSDic) CodecDecodeSelf(dec *codec.Decoder)
- func (rsd *RSDic) CodecEncodeSelf(enc *codec.Encoder)
- func (rsd *RSDic) LoadReader() error
- func (rsd *RSDic) LoadWriter() error
- func (rsd RSDic) MarshalBinary() (out []byte, err error)
- func (rs RSDic) Num() uint64
- func (rs RSDic) OneNum() uint64
- func (rs *RSDic) PushBack(bit bool)
- func (rs RSDic) Rank(pos uint64, bit bool) uint64
- func (rs RSDic) Select(rank uint64, bit bool) uint64
- func (rs RSDic) Select0(rank uint64) uint64
- func (rs RSDic) Select1(rank uint64) uint64
- func (rsd *RSDic) UnmarshalBinary(in []byte) (err error)
- func (rs RSDic) ZeroNum() uint64
- type Readers
- type Writers
Constants ¶
const ( BITS_FN = "bits.bin" POINTER_BLOCK_FN = "pointer.bin" RANK_BLOCK_FN = "rank_block.bin" SELECT_ONE_IND_FN = "select_one_ind.bin" SELECT_ZERO_IND_FN = "select_zero_ind.bin" RANK_SMALL_BLOCK_FN = "rank_small_block.bin" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BufferedBits ¶
type BufferedBits struct {
// contains filtered or unexported fields
}
func NewBits ¶
func NewBits() *BufferedBits
func (*BufferedBits) Length ¶
func (bb *BufferedBits) Length() int
type RSDic ¶
type RSDic struct {
// contains filtered or unexported fields
}
func (RSDic) BitAndRank ¶
BitAndRank returns the (pos+1)-th bit (=b) and Rank(pos, b) Although this is equivalent to b := Bit(pos), r := Rank(pos, b), BitAndRank is faster.
func (*RSDic) CloseWriter ¶
func (*RSDic) CodecDecodeSelf ¶
Selfer interface for codec library
func (*RSDic) CodecEncodeSelf ¶
Selfer interface for codec library
func (*RSDic) LoadReader ¶
func (*RSDic) LoadWriter ¶
func (RSDic) MarshalBinary ¶
MarshalBinary encodes the RSDic into a binary form and returns the result.
func (RSDic) Select ¶
Select returns the position of (rank+1)-th occurence of bit in B Select returns num if rank+1 is larger than the possible range. (i.e. Select(oneNum, true) = num, Select(zeroNum, false) = num)
func (*RSDic) UnmarshalBinary ¶
UnmarshalBinary decodes the RSDic from a binary from generated MarshalBinary