mapping

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	A = 6.0 / 35.0
	B = -3.0 / 5.0
	C = 10.0 / 7.0
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CubicallyInterpolatedMapping

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

A fast IndexMapping that approximates the memory-optimal LogarithmicMapping by extracting the floor value of the logarithm to the base 2 from the binary representations of floating-point values and cubically interpolating the logarithm in-between. More detailed documentation of this method can be found in: <a href="https://github.com/DataDog/sketches-java/">sketches-java</a>

func NewCubicallyInterpolatedMapping

func NewCubicallyInterpolatedMapping(relativeAccuracy float64) (*CubicallyInterpolatedMapping, error)

func NewCubicallyInterpolatedMappingWithGamma

func NewCubicallyInterpolatedMappingWithGamma(gamma, indexOffset float64) (*CubicallyInterpolatedMapping, error)

func (*CubicallyInterpolatedMapping) Encode

func (m *CubicallyInterpolatedMapping) Encode(b *[]byte)

func (*CubicallyInterpolatedMapping) Equals

func (*CubicallyInterpolatedMapping) Index

func (m *CubicallyInterpolatedMapping) Index(value float64) int

func (*CubicallyInterpolatedMapping) LowerBound

func (m *CubicallyInterpolatedMapping) LowerBound(index int) float64

func (*CubicallyInterpolatedMapping) MaxIndexableValue

func (m *CubicallyInterpolatedMapping) MaxIndexableValue() float64

func (*CubicallyInterpolatedMapping) MinIndexableValue

func (m *CubicallyInterpolatedMapping) MinIndexableValue() float64

func (*CubicallyInterpolatedMapping) RelativeAccuracy

func (m *CubicallyInterpolatedMapping) RelativeAccuracy() float64

func (*CubicallyInterpolatedMapping) ToProto

func (*CubicallyInterpolatedMapping) Value

func (m *CubicallyInterpolatedMapping) Value(index int) float64

type IndexMapping

type IndexMapping interface {
	Equals(other IndexMapping) bool
	Index(value float64) int
	Value(index int) float64
	LowerBound(index int) float64
	RelativeAccuracy() float64
	MinIndexableValue() float64
	MaxIndexableValue() float64
	ToProto() *sketchpb.IndexMapping
	// Encode encodes a mapping and appends its content to the provided []byte.
	Encode(b *[]byte)
}

func Decode

func Decode(b *[]byte, flag enc.Flag) (IndexMapping, error)

Decode decodes a mapping and updates the provided []byte so that it starts immediately after the encoded mapping.

func FromProto

func FromProto(m *sketchpb.IndexMapping) (IndexMapping, error)

FromProto returns an Index mapping from the protobuf definition of it

func NewDefaultMapping

func NewDefaultMapping(relativeAccuracy float64) (IndexMapping, error)

type LinearlyInterpolatedMapping

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

A fast IndexMapping that approximates the memory-optimal LogarithmicMapping by extracting the floor value of the logarithm to the base 2 from the binary representations of floating-point values and linearly interpolating the logarithm in-between.

func NewLinearlyInterpolatedMapping

func NewLinearlyInterpolatedMapping(relativeAccuracy float64) (*LinearlyInterpolatedMapping, error)

func NewLinearlyInterpolatedMappingWithGamma

func NewLinearlyInterpolatedMappingWithGamma(gamma, indexOffset float64) (*LinearlyInterpolatedMapping, error)

func (*LinearlyInterpolatedMapping) Encode

func (m *LinearlyInterpolatedMapping) Encode(b *[]byte)

func (*LinearlyInterpolatedMapping) Equals

func (*LinearlyInterpolatedMapping) Index

func (m *LinearlyInterpolatedMapping) Index(value float64) int

func (*LinearlyInterpolatedMapping) LowerBound

func (m *LinearlyInterpolatedMapping) LowerBound(index int) float64

func (*LinearlyInterpolatedMapping) MaxIndexableValue

func (m *LinearlyInterpolatedMapping) MaxIndexableValue() float64

func (*LinearlyInterpolatedMapping) MinIndexableValue

func (m *LinearlyInterpolatedMapping) MinIndexableValue() float64

func (*LinearlyInterpolatedMapping) RelativeAccuracy

func (m *LinearlyInterpolatedMapping) RelativeAccuracy() float64

func (*LinearlyInterpolatedMapping) ToProto

Generates a protobuf representation of this LinearlyInterpolatedMapping.

func (*LinearlyInterpolatedMapping) Value

func (m *LinearlyInterpolatedMapping) Value(index int) float64

type LogarithmicMapping

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

An IndexMapping that is memory-optimal, that is to say that given a targeted relative accuracy, it requires the least number of indices to cover a given range of values. This is done by logarithmically mapping floating-point values to integers.

func NewLogarithmicMapping

func NewLogarithmicMapping(relativeAccuracy float64) (*LogarithmicMapping, error)

func NewLogarithmicMappingWithGamma

func NewLogarithmicMappingWithGamma(gamma, indexOffset float64) (*LogarithmicMapping, error)

func (*LogarithmicMapping) Encode

func (m *LogarithmicMapping) Encode(b *[]byte)

func (*LogarithmicMapping) Equals

func (m *LogarithmicMapping) Equals(other IndexMapping) bool

func (*LogarithmicMapping) Index

func (m *LogarithmicMapping) Index(value float64) int

func (*LogarithmicMapping) LowerBound

func (m *LogarithmicMapping) LowerBound(index int) float64

func (*LogarithmicMapping) MaxIndexableValue

func (m *LogarithmicMapping) MaxIndexableValue() float64

func (*LogarithmicMapping) MinIndexableValue

func (m *LogarithmicMapping) MinIndexableValue() float64

func (*LogarithmicMapping) RelativeAccuracy

func (m *LogarithmicMapping) RelativeAccuracy() float64

func (*LogarithmicMapping) ToProto

Generates a protobuf representation of this LogarithicMapping.

func (*LogarithmicMapping) Value

func (m *LogarithmicMapping) Value(index int) float64

Jump to

Keyboard shortcuts

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