Documentation
¶
Index ¶
- Constants
- Variables
- func EncodeDouble(sketch *Double, withBuffer bool) ([]byte, error)
- type Double
- func (d *Double) CDF(splitPoints []float64) ([]float64, error)
- func (d *Double) IsEmpty() bool
- func (d *Double) K() uint16
- func (d *Double) MaxValue() (float64, error)
- func (d *Double) Merge(other *Double) error
- func (d *Double) MinValue() (float64, error)
- func (d *Double) PMF(splitPoints []float64) ([]float64, error)
- func (d *Double) Quantile(rank float64) (float64, error)
- func (d *Double) Rank(value float64) (float64, error)
- func (d *Double) SerializedSizeBytes(withBuffer bool) int
- func (d *Double) String(shouldPrintCentroids bool) string
- func (d *Double) TotalWeight() uint64
- func (d *Double) Update(value float64) error
- type DoubleDecoder
- type DoubleEncoder
Constants ¶
const (
DefaultK = 200
)
Variables ¶
var ( ErrEmpty = errors.New("operation is undefined for an empty sketch") ErrNaN = errors.New("operation is undefined for NaN") ErrInfinity = errors.New("operation is undefined for Infinity") ErrInvalidRank = errors.New("normalized rank must be between 0 and 1 inclusive") ErrInvalidK = errors.New("k must be at least 10") )
Functions ¶
Types ¶
type Double ¶
type Double struct {
// contains filtered or unexported fields
}
Double provides an implementation of t-Digest double precision type for estimating quantiles and ranks. This implementation is based on the paper: Ted Dunning, Otmar Ertl. "Extremely Accurate Quantiles Using t-Digests" and the reference implementation: https://github.com/tdunning/t-digest NOTE: This implementation is similar to MergingDigest in the above Java implementation
func DecodeDouble ¶
DecodeDouble deserializes bytes into a Double.
func (*Double) CDF ¶
CDF returns an approximation to the Cumulative Distribution Function (CDF) which is the cumulative analog of the PMF of the input stream.
func (*Double) PMF ¶
PMF returns an approximation to the Probability Mass Function (PMF) of the input stream.
func (*Double) Quantile ¶
Quantile computes the approximate quantile value corresponding to the given normalized rank
func (*Double) SerializedSizeBytes ¶
SerializedSizeBytes computes the serialized size in bytes of the t-Digest.
func (*Double) TotalWeight ¶
TotalWeight returns the total weight of all values
type DoubleDecoder ¶
type DoubleDecoder struct{}
DoubleDecoder decodes a Double from the given reader.
func NewDoubleDecoder ¶
func NewDoubleDecoder() DoubleDecoder
NewDoubleDecoder creates and returns a new instance of DoubleDecoder.
type DoubleEncoder ¶
type DoubleEncoder struct {
// contains filtered or unexported fields
}
DoubleEncoder encodes a Double to bytes.
func NewDoubleEncoder ¶
func NewDoubleEncoder(w io.Writer, withBuffer bool) DoubleEncoder
NewDoubleEncoder creates a new encoder.
func (*DoubleEncoder) Encode ¶
func (enc *DoubleEncoder) Encode(sketch *Double) error
Encode encodes a Double to bytes.