From: Olivier Date: 2006-12-02T20:39:50+09:00 Subject: Re: [OT] calculations on lists of numbers Le samedi 02 d�cembre 2006 05:02, ara.t.howard@noaa.gov a �crit�: > for years i've felt that i should be able to pipe numerical output into > some unix command like so > > cat list | mean > cat list | sum > cat list | minmax > > etc. > > and have never found one. right now i'm building a ruby version - before i > continue, does anyone know a standard unix or ruby version of this? > > cheers. > > -a Hi, I'm currently coding a ruby program for processing images. One of the class I wrote is intended to compute some stats about the luminance of a channel, but in fact it can be used on any set of numerical datas. The stats are : - an histogram - the mean - the variance - the deviation - the median - the skewness - the kurtosis It is very fast, since it uses no memory : the values are not stored internally, just the sub-results (so, a list of 2 values will use the same amount of memory than a list of a billion values), and also because the method that adds a value is generated depending of what stats you want to compute. It would be really easy to add min and max, but it would need one or two modifications to get rid of the "image-specific" things. Then, reading stdin and add the values would be no problem. If you want to base your work on my class then just tell me, I'll be happy to share it if it can help. -- Olivier