numeric

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package numeric provides deterministic numeric, statistical, and vector helpers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Clamp

func Clamp(value, low, high float64) (float64, error)

Clamp limits value to the inclusive interval [low, high].

func Correlation

func Correlation(x, y []float64, method string) (float64, error)

Correlation returns Pearson or Spearman correlation for paired values.

func Covariance

func Covariance(x, y []float64, method string) (float64, error)

Covariance returns population or sample covariance for paired values.

func Distance

func Distance(x, y any, method string) (float64, error)

Distance measures numeric vectors or strings with the selected distance method.

func Dot

func Dot(x, y []float64) (float64, error)

Dot returns the dot product of two equally sized finite vectors.

func Exp

func Exp(value float64) (float64, error)

Exp returns e raised to value when the finite result fits in a float64.

func Log

func Log(value float64, base ...float64) (float64, error)

Log returns the logarithm of value using the natural base or an optional base.

func Norm

func Norm(values []float64) (float64, error)

Norm returns the Euclidean norm of a non-empty finite vector.

func Normalize

func Normalize(values []float64) ([]float64, error)

Normalize scales a finite vector to unit Euclidean norm.

func Options

func Options() []exprlib.Option

Options returns the Expr registrations for numeric and vector helpers.

func Quantile

func Quantile(values []float64, p float64) (float64, error)

Quantile returns the linearly interpolated quantile at p in [0, 1].

func RoundTo

func RoundTo(value float64, places int) (float64, error)

RoundTo rounds value to places decimal places, bounded to the supported range.

func Similarity

func Similarity(x, y any, method string) (float64, error)

Similarity measures vectors, sets, or strings with the selected method.

func Sqrt

func Sqrt(value float64) (float64, error)

Sqrt returns the square root of a finite, non-negative value.

func StdDev

func StdDev(values []float64, method string) (float64, error)

StdDev returns the population or sample standard deviation.

func Variance

func Variance(values []float64, method string) (float64, error)

Variance returns population or sample variance for finite values.

Types

This section is empty.

Jump to

Keyboard shortcuts

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