| Crates.io | meansd |
| lib.rs | meansd |
| version | 2.1.0 |
| created_at | 2020-03-15 16:33:56.893641+00 |
| updated_at | 2023-08-17 15:31:32.822469+00 |
| description | calculate mean and standard deviation |
| homepage | https://gitlab.com/umcdev/meansd |
| repository | https://gitlab.com/umcdev/meansd |
| max_upload_size | |
| id | 218891 |
| size | 18,083 |
Calculates mean and standard deviation.
Simple execution mode:
$ seq 1 3 | meansd
n=3 ∅ 2 ± 1
Binning:
$ seq 2 7 | meansd --bin-width 5
From To Size Mean SD
0 4 3 3 1
5 9 3 6 1
n=6 ∅ 5 ± 2
For more command line options, see meansd --help.
This tool uses so-called online algorithms. This means that the input is not stored and you can pipe an indefinite amount to this tool without increasing its memory requirement.
Without binning, VmPeak is only 4884 kB, measured with:
# generate 2 byte unsigned numbers and pipe to meansd
od -v -A n -t u2 -w2 /dev/urandom |
meansd --progress 1000000
# measure VmPeak
rg VmPeak /proc/$(pgrep meansd)/status
With binning, the memory requirements increase only ever so slightly per bin.
During the memory tests, my observation was that meansd consumes the numbers
faster than the random number generator can produce them. While od was at
100% CPU utilization, meansd was at about 50% without binning and 90% with
binning.