Return-Path: X-Original-To: apmail-commons-dev-archive@www.apache.org Delivered-To: apmail-commons-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 0FADC109A9 for ; Fri, 18 Oct 2013 01:34:11 +0000 (UTC) Received: (qmail 91267 invoked by uid 500); 18 Oct 2013 01:34:10 -0000 Delivered-To: apmail-commons-dev-archive@commons.apache.org Received: (qmail 91136 invoked by uid 500); 18 Oct 2013 01:34:10 -0000 Mailing-List: contact dev-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Commons Developers List" Delivered-To: mailing list dev@commons.apache.org Received: (qmail 91128 invoked by uid 99); 18 Oct 2013 01:34:10 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 18 Oct 2013 01:34:10 +0000 X-ASF-Spam-Status: No, hits=1.7 required=5.0 tests=FREEMAIL_ENVFROM_END_DIGIT,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of yangshuan45@gmail.com designates 209.85.215.49 as permitted sender) Received: from [209.85.215.49] (HELO mail-la0-f49.google.com) (209.85.215.49) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 18 Oct 2013 01:34:03 +0000 Received: by mail-la0-f49.google.com with SMTP id ev20so145737lab.22 for ; Thu, 17 Oct 2013 18:33:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=ZVGc+JKOhG+ivGMpnWAyrzObYuZVneuBbHsJIJ4Q1Ho=; b=dFJcYpzWyxsxIdPsOwfBmERcjN1UBCsX0G2d/+R4jDpdpDNmsHN4FKNS4FPlBBPifr KzE0HrrkB18JE9nERv6asLVGFBuZYT9SvP5cg4mXh1xPnXHyNXQfXLNioa6AWZ7h9EUr oWsuXs5e6mwxHSS8G4XnqOOKWQwZLT0fuagu1ql0yBSA0OpA0JQgauVM27i60FgaEpvY c376A8Hl+ec69Ou0fhUVSkEK3rt/OdiKNtfExxUNkj9/p74/2HpPUYRtCAFKny+OiQrh EYRFVrNjG0vjEA8ncCkLjnwrMijviYHZnBdOQRPqPlTJAFBWU5wLSmkZJDZMsEkbfIO5 QOGw== MIME-Version: 1.0 X-Received: by 10.152.120.5 with SMTP id ky5mr252387lab.18.1382060022677; Thu, 17 Oct 2013 18:33:42 -0700 (PDT) Received: by 10.112.40.234 with HTTP; Thu, 17 Oct 2013 18:33:42 -0700 (PDT) In-Reply-To: <526043D0.6040806@gmail.com> References: <526043D0.6040806@gmail.com> Date: Fri, 18 Oct 2013 09:33:42 +0800 Message-ID: Subject: Re: [math] Method min, max, percentile in StatUtils support int[], long[], etc From: Karl Yang To: Commons Developers List Content-Type: multipart/alternative; boundary=089e01227ca4b5c65404e8f9ecaa X-Virus-Checked: Checked by ClamAV on apache.org --089e01227ca4b5c65404e8f9ecaa Content-Type: text/plain; charset=GB2312 Content-Transfer-Encoding: quoted-printable 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 > On 10/16/13 6:36 PM, =D1=EE=CB=A8 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 w= e > > 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 > > --089e01227ca4b5c65404e8f9ecaa--