MSFStore

package module
v0.0.0-...-b4d767c Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2019 License: Apache-2.0 Imports: 5 Imported by: 0

README

This package implements a map-backed store inspired by HDR histograms. It needs neither parameters for minimum nor maximum, only for resolution. In this case resolution = # of significant figures kept from each measurement.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Histogram

type Histogram struct {
	// This will be used as an int, but it's a float to satisfy upstream
	// dependencies
	Resolution int
	// using strings as keys because I've used floats long enough
	// to not compare them for equality.
	Registers map[string]float64
}

Histogram is, for now, a map store implementing something akin to the HDRHistogram idea, meaning it's high-accuracy and has few restrictions. It can be an issue for space, as it will get bigger as more keys are added.

func Deserialize

func Deserialize(input []byte, res int) (Histogram, error)

Deserialize is the inverse of serialize.

func FromRawHist

func FromRawHist(x RawHist, Resolution int) Histogram

FromRawHist takes an interchange pair and regenerates a hist.

func New

func New(Resolution int) Histogram

NewHistogram returns a new map store, not very exciting

func (Histogram) Cancel

func (m Histogram) Cancel(x Histogram) Histogram

Cancel subtracts the argument from the base. It's called cancel and not diff or subtract because enjoy having negative values in your hists if you're not careful.

func (Histogram) Combine

func (m Histogram) Combine(x Histogram) Histogram

Combine adds two hists together.

func (Histogram) Insert

func (m Histogram) Insert(val float64, count float64) Histogram

Insert a count at a certain value into a histogram

func (Histogram) Min

func (m Histogram) Min(o Histogram) Histogram

Min returns the pointwise min of the two histograms.

func (Histogram) Read

func (m Histogram) Read(val float64) float64

Read a value out of a histogram

func (Histogram) Serialize

func (m Histogram) Serialize() []byte

Serialize turns a Histogram into bytes.

func (Histogram) ToRawHist

func (m Histogram) ToRawHist() RawHist

ToRawHist gives an interchangeable format for histograms as a pair of arrays of sorted values and weights.

func (Histogram) Total

func (m Histogram) Total() float64

Total gives the total of all elements in the histogram.

type RawHist

type RawHist struct {
	Location, Weight []float64
}

RawHist contains a gonum-compatible array pair.

Jump to

Keyboard shortcuts

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