You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by 杨栓 <ya...@gmail.com> on 2013/10/17 03:36:54 UTC

[math] Method min, max, percentile in StatUtils support int[], long[], etc

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?

Re: [math] Method min, max, percentile in StatUtils support int[], long[], etc

Posted by Karl Yang <ya...@gmail.com>.
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 <ph...@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
>
>

Re: [math] Method min, max, percentile in StatUtils support int[], long[], etc

Posted by Phil Steitz <ph...@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


Re: [math] Method min, max, percentile in StatUtils support int[], long[], etc

Posted by Anshul Zunke <an...@gmail.com>.
+1


On Thu, Oct 17, 2013 at 7:06 AM, 杨栓 <ya...@gmail.com> 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?
>



-- 
Anshul Zunke