minmax

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package minmax provides a library of data structures/algorithms for calculating the online minimum or maximum from a stream of data.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Max

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

Max keeps track of the maximum of a stream.

func NewGlobalMax

func NewGlobalMax() *Max

NewGlobalMax instantiates a global Max struct. This is equivalent to calling NewMax(0).

func NewMax

func NewMax(window int) (*Max, error)

NewMax instantiates a Max struct.

func (*Max) Clear

func (m *Max) Clear()

Clear resets the metric.

func (*Max) Push

func (m *Max) Push(x float64) error

Push adds a number for calculating the maximum.

func (*Max) String

func (m *Max) String() string

String returns a string representation of the metric.

func (*Max) Value

func (m *Max) Value() (float64, error)

Value returns the value of the maximum.

type Min

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

Min keeps track of the minimum of a stream.

func NewGlobalMin

func NewGlobalMin() *Min

NewGlobalMin instantiates a global Min struct. This is equivalent to calling NewMin(0).

func NewMin

func NewMin(window int) (*Min, error)

NewMin instantiates a Min struct.

func (*Min) Clear

func (m *Min) Clear()

Clear resets the metric.

func (*Min) Push

func (m *Min) Push(x float64) error

Push adds a number for calculating the minimum.

func (*Min) String

func (m *Min) String() string

String returns a string representation of the metric.

func (*Min) Value

func (m *Min) Value() (float64, error)

Value returns the value of the minimum.

Jump to

Keyboard shortcuts

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