commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Karl Yang <yangshua...@gmail.com>
Subject Re: [math] Method min, max, percentile in StatUtils support int[], long[], etc
Date Fri, 18 Oct 2013 01:33:42 GMT
Define statistics such as percentiles, mean etc that expect integer arrays
as arguments is what I wish, but the return type is decided by the method,
for method min(int[]) and max(int[]), the return type must be integer; for
method mean, the return type may be double.
If not I need to convert int[] to double[] every time, this would cost a
lot memory. Due to the data is very large, JVM would call GC to free the
memory many times in a thread, it's a big cost. The only way I can fix this
performance problem is to implement my method based on
commons-math's algorithm that can accept integer arrays.


2013/10/18 Phil Steitz <phil.steitz@gmail.com>

> On 10/16/13 6:36 PM, 杨栓 wrote:
> > Hi,
> >
> > I always need to compute min value, max value, percentile values of
> > millions data, these data may are int, long or double. But class
> StatUtils only
> > supports double[], I need to convert int[], long[] to double[]. Shall we
> > add a feature that StatUtils supports any other numeric type?
> >
> It would be trivial to just add overloaded versions of the methods
> that do the conversion for you. Is that what you mean? They would
> still return doubles as results. Is that what you mean? Or do you
> mean defining statistics such as percentiles, mean, etc. that expect
> integer arrays as arguments and return results coerced to integer
> values? If the latter, what exactly is the use case - i.e., what is
> the practical need for this?
>
> Phil
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message