]> git.ipfire.org Git - thirdparty/util-linux.git/commit
libsmartcols: use standard deviation to optimize columns width
authorKarel Zak <kzak@redhat.com>
Wed, 12 Oct 2022 07:46:56 +0000 (09:46 +0200)
committerKarel Zak <kzak@redhat.com>
Tue, 25 Oct 2022 09:11:06 +0000 (11:11 +0200)
commit5470acc6a36aec1469bf77c75a8fb08a48c0b20a
tree07cec1847e4e63fe3b47c99d9862e481cb917600
parent9e85d5915c0d39b03349634c1d476f46093294f9
libsmartcols: use standard deviation to optimize columns width

The standard deviation together with mean (average) of the data width
can be used to detect "problematic" columns and to calculate optimal
width.

The idea is to sort column by avg+deviation and start columns width
reduction from the column with the most wide and variable width. The
width reduction is also optimized by 68–95–99 rule (aka empirical
rule, avg+n*deviation; where n={1,2,3}) to cover 95% or 68% data in
the column.

The disadvantage is we need to link libsmartcols with -lm (math) due
to sqrt() function.

Signed-off-by: Karel Zak <kzak@redhat.com>
libsmartcols/src/Makemodule.am
libsmartcols/src/calculate.c
libsmartcols/src/column.c
libsmartcols/src/smartcolsP.h