cardinality

package
v0.4.8 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2026 License: MIT Imports: 5 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CommutativeDuplexes added in v0.4.8

type CommutativeDuplexes[T uint32 | uint64] struct {
	// contains filtered or unexported fields
}

func (*CommutativeDuplexes[T]) And added in v0.4.8

func (s *CommutativeDuplexes[T]) And(dc DuplexCommutation[T])

func (*CommutativeDuplexes[T]) Contains added in v0.4.8

func (s *CommutativeDuplexes[T]) Contains(value T) bool

func (*CommutativeDuplexes[T]) Or added in v0.4.8

func (s *CommutativeDuplexes[T]) Or(dc DuplexCommutation[T])

type Duplex

type Duplex[T uint32 | uint64] interface {
	Provider[T]

	Xor(other Provider[T])
	And(other Provider[T])
	AndNot(other Provider[T])
	Remove(value T)
	Slice() []T
	Contains(value T) bool
	Each(delegate func(value T) bool)
	CheckedAdd(value T) bool
	Clone() Duplex[T]
}

Duplex is a two-way cardinality provider that allows a user to retrieve encoded values back out of the provider. This interface is suitable for algorithms that behave similar to bitvectors.

func NewBitmap32

func NewBitmap32() Duplex[uint32]

func NewBitmap32With

func NewBitmap32With(values ...uint32) Duplex[uint32]

func NewBitmap64

func NewBitmap64() Duplex[uint64]

func NewBitmap64With

func NewBitmap64With(values ...uint64) Duplex[uint64]

func ThreadSafeDuplex

func ThreadSafeDuplex[T uint32 | uint64](provider Duplex[T]) Duplex[T]

type DuplexCommutation added in v0.4.8

type DuplexCommutation[T uint32 | uint64] []Duplex[T]

func CommutativeOr added in v0.4.8

func CommutativeOr[T uint32 | uint64](duplexes ...Duplex[T]) DuplexCommutation[T]

func (DuplexCommutation[T]) Contains added in v0.4.8

func (s DuplexCommutation[T]) Contains(value T) bool

func (DuplexCommutation[T]) Or added in v0.4.8

func (s DuplexCommutation[T]) Or(duplexes ...Duplex[T]) DuplexCommutation[T]

type DuplexConstructor

type DuplexConstructor[T uint32 | uint64] func() Duplex[T]

type Iterator

type Iterator[T uint32 | uint64] interface {
	HasNext() bool
	Next() T
}

Iterator allows enumeration of a duplex cardinality provider without requiring the allocation of the provider's set.

type Provider

type Provider[T uint32 | uint64] interface {
	Add(value ...T)
	Or(other Provider[T])
	Clear()
	Cardinality() uint64
}

Provider describes the most basic functionality of a cardinality provider algorithm: adding elements to the provider and producing the cardinality of those elements.

func CloneProvider

func CloneProvider[T uint32 | uint64](provider Provider[T]) Provider[T]

func NewBitmap32Provider

func NewBitmap32Provider() Provider[uint32]

func NewBitmap64Provider

func NewBitmap64Provider() Provider[uint64]

func NewHyperLogLog32Provider

func NewHyperLogLog32Provider() Provider[uint32]

func NewHyperLogLog64Provider

func NewHyperLogLog64Provider() Provider[uint64]

type ProviderConstructor

type ProviderConstructor[T uint32 | uint64] func() Provider[T]

type Simplex

type Simplex[T uint32 | uint64] interface {
	Provider[T]

	Clone() Simplex[T]
}

Simplex is a one-way cardinality provider that does not allow a user to retrieve encoded values back out of the provider. This interface is suitable for algorithms such as HyperLogLog which utilizes a hash function to merge identifiers into the cardinality provider.

func NewHyperLogLog32

func NewHyperLogLog32() Simplex[uint32]

func NewHyperLogLog64

func NewHyperLogLog64() Simplex[uint64]

func ThreadSafeSimplex

func ThreadSafeSimplex[T uint32 | uint64](provider Simplex[T]) Simplex[T]

type SimplexConstructor

type SimplexConstructor[T uint32 | uint64] func() Simplex[T]

Jump to

Keyboard shortcuts

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