Files
obitools4/autodoc/docmd/pkg/obistats/stats.md
T
Eric Coissac 8c7017a99d ⬆️ version bump to v4.5
- Update obioptions.Version from "Release 4.4.29" to "/v/ Release v5"
- Update version.txt from 4.29 → .30
(automated by Makefile)
2026-04-13 13:34:53 +02:00

26 lines
1.1 KiB
Markdown

# `obistats` Package — Semantic Overview
The `*obistats*` Go package provides lightweight, type-generic statistical utilities for numerical data.
## Core Functions
- **`Median[T Number](data []T) float64`**
Computes the median of a slice. Internally copies and sorts input data to avoid mutation, handling both even- and odd-length slices correctly. Returns `0` for empty input.
- **`Mean[T Number](data []T) float64`**
Calculates the arithmetic mean by summing all elements (converted to `float64`) and dividing by count.
## Type Constraints
- Uses Go generics (`constraints.Float | constraints.Integer`), enabling use with `int`, `float32`, `float64`, etc.
## Design Notes
- Non-mutating (`Median` works on a copy).
- Simple, efficient implementations—no external dependencies beyond `golang.org/x/exp/constraints` and `slices`.
- Focused on central tendency measures only—no variance, std dev, or distribution stats.
## Use Case
Ideal for small-to-medium numerical datasets where minimal dependencies and clarity are prioritized over advanced statistics.