Documentation
¶
Index ¶
- Constants
- func CountCoupons(bitMatrix []uint64) uint64
- func CpcSketchToString(mem []byte, detail bool) (string, error)
- func NewPairTable(lgSizeInts, numValidBits int) (*pairTable, error)
- type BitMatrix
- type CompressionCharacterization
- type CpcCompressedState
- type CpcFlavor
- type CpcFormat
- type CpcSketch
- func (c *CpcSketch) Copy() (*CpcSketch, error)
- func (c *CpcSketch) GetEstimate() float64
- func (c *CpcSketch) GetLgK() int
- func (c *CpcSketch) GetLowerBound(kappa int) float64
- func (c *CpcSketch) GetUpperBound(kappa int) float64
- func (c *CpcSketch) String() string
- func (c *CpcSketch) ToCompactSlice() ([]byte, error)
- func (c *CpcSketch) UpdateByteSlice(datum []byte) error
- func (c *CpcSketch) UpdateFloat64(datum float64) error
- func (c *CpcSketch) UpdateInt32Slice(datum []int32) error
- func (c *CpcSketch) UpdateInt64(datum int64) error
- func (c *CpcSketch) UpdateInt64Slice(datum []int64) error
- func (c *CpcSketch) UpdateString(datum string) error
- func (c *CpcSketch) UpdateUint64(datum uint64) error
- type CpcUnion
- type CpcWrapper
- type MergingValidation
- type QuickMergingValidation
- type StreamingValidation
Constants ¶
const ( NextWordIdx = 0 // ptrArr[0]: nextWordIndex BitBuf = 1 // ptrArr[1]: bitBuf BufBits = 2 // ptrArr[2]: bufBits )
Constants for ptrArr indices.
Variables ¶
This section is empty.
Functions ¶
func CountCoupons ¶
CountCoupons sums the number of set bits across all 64-bit words in bitMatrix.
func NewPairTable ¶
Types ¶
type BitMatrix ¶
type BitMatrix struct {
// contains filtered or unexported fields
}
BitMatrix is a test structure that tracks bit patterns for hashed 64-bit data. It is not part of the core CPC algorithm; it's just for certain tests.
func NewBitMatrixWithSeed ¶
NewBitMatrixWithSeed creates a BitMatrix with the given lgK and custom seed.
func (*BitMatrix) GetMatrix ¶
GetMatrix returns the underlying array of 64-bit words storing the bits.
func (*BitMatrix) GetNumCoupons ¶
GetNumCoupons returns the number of set bits (coupons) in the matrix. If numCouponsInvalid were ever set to true, it would recalculate by scanning the bitMatrix. By default, it’s always up to date.
type CompressionCharacterization ¶
type CompressionCharacterization struct {
// contains filtered or unexported fields
}
CompressionCharacterization is a harness that tests compression performance for various log(K) and N, measuring the time spent in creation, updates, compression, serialization, deserialization, uncompression, and equality checks.
func NewCompressionCharacterization ¶
func NewCompressionCharacterization( lgMinK, lgMaxK, lgMinT, lgMaxT, lgMulK, uPPO, incLgK int, pS, pW io.Writer, ) *CompressionCharacterization
func (*CompressionCharacterization) Start ¶
func (cc *CompressionCharacterization) Start() error
Start runs the entire characterization, printing the header first.
type CpcCompressedState ¶
type CpcCompressedState struct {
CsvIsValid bool
WindowIsValid bool
LgK int
SeedHash int16
FiCol int
MergeFlag bool // compliment of HIP Flag
NumCoupons uint64
Kxp float64
HipEstAccum float64
NumCsv uint64
CsvStream []int // may be longer than required
CsvLengthInts int
CwStream []int // may be longer than required
CwLengthInts int
}
func NewCpcCompressedState ¶
func NewCpcCompressedState(lgK int, seedHash int16) *CpcCompressedState
func NewCpcCompressedStateFromSketch ¶
func NewCpcCompressedStateFromSketch(sketch *CpcSketch) (*CpcCompressedState, error)
type CpcFormat ¶
type CpcFormat int
const ( CpcFormatEmptyMerged CpcFormat = 0 CpcFormatEmptyHip CpcFormat = 1 CpcFormatSparseHybridMerged CpcFormat = 2 CpcFormatSparseHybridHip CpcFormat = 3 CpcFormatPinnedSlidingMergedNosv CpcFormat = 4 CpcFormatPinnedSlidingHipNosv CpcFormat = 5 CpcFormatPinnedSlidingMerged CpcFormat = 6 CpcFormatPinnedSlidingHip CpcFormat = 7 )
type CpcSketch ¶
type CpcSketch struct {
// contains filtered or unexported fields
}
func NewCpcSketchFromSlice ¶
func NewCpcSketchWithDefault ¶
func (*CpcSketch) GetEstimate ¶
func (*CpcSketch) GetLowerBound ¶
func (*CpcSketch) GetUpperBound ¶
func (*CpcSketch) ToCompactSlice ¶
ToCompactSlice returns this sketch as a compressed byte slice.
func (*CpcSketch) UpdateByteSlice ¶
func (*CpcSketch) UpdateFloat64 ¶
func (*CpcSketch) UpdateInt32Slice ¶
func (*CpcSketch) UpdateInt64 ¶
func (*CpcSketch) UpdateInt64Slice ¶
func (*CpcSketch) UpdateString ¶
func (*CpcSketch) UpdateUint64 ¶
type CpcUnion ¶
type CpcUnion struct {
// contains filtered or unexported fields
}
func (*CpcUnion) GetBitMatrix ¶
func (*CpcUnion) GetFamilyId ¶
type CpcWrapper ¶
type CpcWrapper struct {
// contains filtered or unexported fields
}
CpcWrapper is a read-only view of a serialized CPC sketch.
func NewCpcWrapperFromBytes ¶
func NewCpcWrapperFromBytes(byteArray []byte) (*CpcWrapper, error)
NewCpcWrapperFromBytes constructs a read-only view of the given byte array that contains a CpcSketch. It checks that the preamble is valid and that the sketch is in compressed format.
func (*CpcWrapper) GetEstimate ¶
func (cw *CpcWrapper) GetEstimate() float64
GetEstimate returns the best estimate of the cardinality of the wrapped sketch. If the sketch is in HIP mode, we return the HIP accumulator; otherwise we return the ICON estimate.
func (*CpcWrapper) GetFamily ¶
func (cw *CpcWrapper) GetFamily() int
GetFamily returns the family ID for CPC sketches.
func (*CpcWrapper) GetLgK ¶
func (cw *CpcWrapper) GetLgK() int
GetLgK returns the log-base-2 of K for this sketch.
func (*CpcWrapper) GetLowerBound ¶
func (cw *CpcWrapper) GetLowerBound(kappa int) float64
GetLowerBound returns the lower bound of the confidence interval given kappa (the number of standard deviations from the mean).
func (*CpcWrapper) GetUpperBound ¶
func (cw *CpcWrapper) GetUpperBound(kappa int) float64
GetUpperBound returns the upper bound of the confidence interval given kappa (the number of standard deviations from the mean).
type MergingValidation ¶
type MergingValidation struct {
// contains filtered or unexported fields
}
func NewMergingValidation ¶
func NewMergingValidation( lgMinK, lgMaxK, lgMulK, uPPO, incLgK int, pS, pW io.Writer, ) *MergingValidation
func (*MergingValidation) Start ¶
func (mv *MergingValidation) Start() error
Start prints the header, then calls doRangeOfLgK.
type QuickMergingValidation ¶
type QuickMergingValidation struct {
// contains filtered or unexported fields
}
func NewQuickMergingValidation ¶
func NewQuickMergingValidation( lgMinK, lgMaxK, incLgK int, ps, pw io.Writer, ) *QuickMergingValidation
func (*QuickMergingValidation) Start ¶
func (qmv *QuickMergingValidation) Start() error
type StreamingValidation ¶
type StreamingValidation struct {
// contains filtered or unexported fields
}
StreamingValidation is a test/characterization harness that repeatedly updates a CPC sketch and a BitMatrix, checks their correctness, and logs results.
func NewStreamingValidation ¶
func NewStreamingValidation( lgMinK, lgMaxK, trials, ppoN int, pS, pW io.Writer, ) *StreamingValidation
func (*StreamingValidation) Start ¶
func (sv *StreamingValidation) Start()
Start begins the streaming validation process, printing column headers and running the test loops.
Source Files
¶
- bit_matrix.go
- compression_characterization.go
- compression_data.go
- confidence.go
- cpc_compressed_state.go
- cpc_sketch.go
- cpc_union.go
- cpc_wrapper.go
- icon_estimator.go
- icon_polynomial_coefficient.go
- merging_validation.go
- pair_table.go
- quick_merging_validation.go
- runtime_asserts.go
- streaming_validation.go
- test_util.go
- utils.go