Skip to content

Latest commit

 

History

History
155 lines (85 loc) · 4.02 KB

countminsketch.md

File metadata and controls

155 lines (85 loc) · 4.02 KB

countminsketch

import "github.com/andy2046/gopie/pkg/countminsketch"

Package countminsketch implements Count-Min Sketch.

countmin.go

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

CountMinSketch struct.

func New(width, depth uint) (*CountMinSketch, error)

New returns new Count-Min Sketch with the given width and depth.

func NewGuess(epsilon, delta float64) (*CountMinSketch, error)

NewGuess returns new Count-Min Sketch with the given error rate epsilon and confidence delta.

func (*CountMinSketch) Add

func (c *CountMinSketch) Add(data []byte, count ...uint64)

Add add the data to the sketch. count default to 1.

func (*CountMinSketch) AddString

func (c *CountMinSketch) AddString(data string, count ...uint64)

AddString add the data string to the sketch. count default to 1.

func (*CountMinSketch) Count

func (c *CountMinSketch) Count() uint64

Count returns the number of items added to the sketch.

func (*CountMinSketch) Depth

func (c *CountMinSketch) Depth() uint

Depth returns the matrix depth.

func (*CountMinSketch) Estimate

func (c *CountMinSketch) Estimate(data []byte) uint64

Estimate estimate the frequency of the data.

func (*CountMinSketch) EstimateString

func (c *CountMinSketch) EstimateString(data string) uint64

EstimateString estimate the frequency of the data string.

func (*CountMinSketch) Merge

func (c *CountMinSketch) Merge(other *CountMinSketch) error

Merge combines the sketch with another.

func (*CountMinSketch) Reset

func (c *CountMinSketch) Reset()

Reset reset the sketch to its original state.

func (*CountMinSketch) Width

func (c *CountMinSketch) Width() uint

Width returns the matrix width.


Generated by godoc2md