Documentation
¶
Index ¶
- Constants
- func Min[T constraints.Ordered](a, b T) T
- func SuggestNumBuckets(relativeError float64) (int32, error)
- func SuggestNumHashes(confidence float64) (int8, error)
- type CountMinSketch
- func (c *CountMinSketch) Deserialize(b []byte, seed int64) (*CountMinSketch, error)
- func (c *CountMinSketch) GetEstimate(item []byte) int64
- func (c *CountMinSketch) GetEstimateString(item string) int64
- func (c *CountMinSketch) GetEstimateUint64(item uint64) int64
- func (c *CountMinSketch) GetLowerBound(item []byte) int64
- func (c *CountMinSketch) GetLowerBoundUint64(item uint64) int64
- func (c *CountMinSketch) GetNumBuckets() int32
- func (c *CountMinSketch) GetNumHashes() int8
- func (c *CountMinSketch) GetRelativeError() float64
- func (c *CountMinSketch) GetSeed() int64
- func (c *CountMinSketch) GetTotalWeight() int64
- func (c *CountMinSketch) GetUpperBound(item []byte) int64
- func (c *CountMinSketch) GetUpperBoundUint64(item uint64) int64
- func (c *CountMinSketch) Merge(otherSketch *CountMinSketch) error
- func (c *CountMinSketch) Serialize(w io.Writer) error
- func (c *CountMinSketch) Update(item []byte, weight int64) error
- func (c *CountMinSketch) UpdateString(item string, weight int64) error
- func (c *CountMinSketch) UpdateUint64(item uint64, weight int64) error
Constants ¶
View Source
const ( PreambleLongsShort = 2 SerialVersion1 = 1 Null8 = 0 Null32 = 0 IsEmpty = 0 )
Variables ¶
This section is empty.
Functions ¶
func Min ¶
func Min[T constraints.Ordered](a, b T) T
func SuggestNumBuckets ¶
func SuggestNumHashes ¶
Types ¶
type CountMinSketch ¶
type CountMinSketch struct {
// contains filtered or unexported fields
}
Implementation of the CountMin sketch data structure of Cormode and Muthukrishnan. [1] - http://dimacs.rutgers.edu/~graham/pubs/papers/cm-full.pdf
func NewCountMinSketch ¶
func NewCountMinSketch(numHashes int8, numBuckets int32, seed int64) (*CountMinSketch, error)
NewCountMinSketch creates an instance of the CounrMin sketch given parameters numHashes, numBuckets and hash seed. The items inserted into the sketch can be arbitrary type, so long as they are hashable via murmurhash. Only update and estimate methods are added for uint64 and string types.
func (*CountMinSketch) Deserialize ¶
func (c *CountMinSketch) Deserialize(b []byte, seed int64) (*CountMinSketch, error)
func (*CountMinSketch) GetEstimate ¶
func (c *CountMinSketch) GetEstimate(item []byte) int64
func (*CountMinSketch) GetEstimateString ¶
func (c *CountMinSketch) GetEstimateString(item string) int64
func (*CountMinSketch) GetEstimateUint64 ¶
func (c *CountMinSketch) GetEstimateUint64(item uint64) int64
func (*CountMinSketch) GetLowerBound ¶
func (c *CountMinSketch) GetLowerBound(item []byte) int64
func (*CountMinSketch) GetLowerBoundUint64 ¶
func (c *CountMinSketch) GetLowerBoundUint64(item uint64) int64
func (*CountMinSketch) GetNumBuckets ¶
func (c *CountMinSketch) GetNumBuckets() int32
func (*CountMinSketch) GetNumHashes ¶
func (c *CountMinSketch) GetNumHashes() int8
func (*CountMinSketch) GetRelativeError ¶
func (c *CountMinSketch) GetRelativeError() float64
func (*CountMinSketch) GetSeed ¶
func (c *CountMinSketch) GetSeed() int64
func (*CountMinSketch) GetTotalWeight ¶
func (c *CountMinSketch) GetTotalWeight() int64
func (*CountMinSketch) GetUpperBound ¶
func (c *CountMinSketch) GetUpperBound(item []byte) int64
func (*CountMinSketch) GetUpperBoundUint64 ¶
func (c *CountMinSketch) GetUpperBoundUint64(item uint64) int64
func (*CountMinSketch) Merge ¶
func (c *CountMinSketch) Merge(otherSketch *CountMinSketch) error
func (*CountMinSketch) UpdateString ¶
func (c *CountMinSketch) UpdateString(item string, weight int64) error
func (*CountMinSketch) UpdateUint64 ¶
func (c *CountMinSketch) UpdateUint64(item uint64, weight int64) error
Click to show internal directories.
Click to hide internal directories.