Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 1D781200B22 for ; Wed, 1 Jun 2016 10:49:31 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 1BF45160A46; Wed, 1 Jun 2016 08:49:31 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 650A2160A41 for ; Wed, 1 Jun 2016 10:49:30 +0200 (CEST) Received: (qmail 80243 invoked by uid 500); 1 Jun 2016 08:49:29 -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 80229 invoked by uid 99); 1 Jun 2016 08:49:29 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 01 Jun 2016 08:49:29 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id AE034C0D08 for ; Wed, 1 Jun 2016 08:49:28 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.279 X-Spam-Level: * X-Spam-Status: No, score=1.279 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HTML_MESSAGE=2, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd4-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=bargr-net.20150623.gappssmtp.com Received: from mx2-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id U5kxf-oXNrg3 for ; Wed, 1 Jun 2016 08:49:24 +0000 (UTC) Received: from mail-it0-f43.google.com (mail-it0-f43.google.com [209.85.214.43]) by mx2-lw-eu.apache.org (ASF Mail Server at mx2-lw-eu.apache.org) with ESMTPS id E491A5F236 for ; Wed, 1 Jun 2016 08:49:23 +0000 (UTC) Received: by mail-it0-f43.google.com with SMTP id z189so73923408itg.0 for ; Wed, 01 Jun 2016 01:49:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bargr-net.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:date:message-id:subject:from:to; bh=9+1hsD+2vlW1zREgMd9jGl5nxsSZNjO+b3zN+T4SuGk=; b=vk8edxlcHNrZuue3IjdcFTJFHSwjnBGrUmz10msPFDLZh3jNPDqv7iXYgXLTpSChYE 19ogxFmQPNDkDAwylTRRLsOJZeeA10fcSISK+EoqSrVpZd+iPO9VTp3ft1/7nc2FmlH5 +sVqC3MRAoybfUT5Nk7njDFe6d51rJC4md9TzVTTyWWUT0/jXKlfRWumRaFRmQMTw4XY jJ+8PP2xncIgOpw6AMHTQ7rNCf/Rwcu9YswtizOg2ZK8AU8iXZHqrJu5pCycpbVK8yYo 19qKA4dCpyEiFuwPfZ94/haRS1E1prHZ8+LQmqEfDN7XWQBGTyJiL/SbIJPJKKeIvKwr m6jw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to; bh=9+1hsD+2vlW1zREgMd9jGl5nxsSZNjO+b3zN+T4SuGk=; b=L8aKWRjxHYFd44iQgplshBehTlijXk2knzKFXVOfgyWhIBsY04mQJQbeajsNPsS+0d SWOiNcQv0/aL2Ub0Xnc8YjyVB4f5ZKXZ6or6i+Tp/FxNuxj+dcJWtGGkIOUwLeB/1y19 0at9POfW5eEPP94mIzWlGsZdjxOp8RBXQRywQunahT/jUaicDx0REpiDNHXYEh41NvyX Yce0Fkgz88sXwmrn0+30IZpeEJN5l5KdaRI/esJJYYGPYFSsTI8qfgvaXy9ZLNlie4Tt abWChp2BBunIexf7c42K72k5TO2Q5HowC42BWHByQ8c/ud9X/qpOsQTtsIkPcDt5A/ME /Qgg== X-Gm-Message-State: ALyK8tKwLdaO1VY8OaYKm/k9zkea3CXoj1xnSNpDNZyguJ+Lr6S4o9dkfyWsrCgxXTNMSmZD+0TDyTpLgfVKkg== MIME-Version: 1.0 X-Received: by 10.36.22.130 with SMTP id a124mr17759837ita.58.1464770962743; Wed, 01 Jun 2016 01:49:22 -0700 (PDT) Received: by 10.36.50.87 with HTTP; Wed, 1 Jun 2016 01:49:22 -0700 (PDT) In-Reply-To: References: <3466d1d702525e6b72f3f47216397a35@scarlet.be> Date: Wed, 1 Jun 2016 11:49:22 +0300 Message-ID: Subject: Re: [Math] Adding min/max and argmin/argmax values for an arrays of double/int (Comparable). From: Artem Barger To: Commons Developers List Content-Type: multipart/alternative; boundary=001a114453c2e9ccee05343390c7 archived-at: Wed, 01 Jun 2016 08:49:31 -0000 --001a114453c2e9ccee05343390c7 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hi, I've create a JIRA ticket MATH-1372 and attached a patch to it, also submitted PR on GitHub: https://github.com/apache/commons-math/pull/36. Best regards, Artem Barger. On Tue, May 31, 2016 at 3:32 AM, Artem Barger wrote: > > On Tue, May 31, 2016 at 3:17 AM, Gilles > wrote: > >> On Tue, 31 May 2016 02:58:27 +0300, Artem Barger wrote: >> >>> Methods "getMinValue()", "getMinIndex()". >>>> >>>> Important note: any contribution should be based on the contents of >>>> the "develop" branch, not "master". See file >>>> doc/development/development.howto.txt >>>> in the source tree. >>>> >>>> >>>> =E2=80=8BSo in order to use them I need to instantiate a RealVector, r= ight? >>> >> >> Yes. >> And the iteration is probably not efficient since it use the >> high-level API. >> >> Hence I think the question whenever to add static method w/ >>> similar functionality to MathArrays class is still valid, especially if >>> I can enhance it to accept array or list of Comparables or to accept >>> Comparator as an additional parameter=E2=80=8B. >>> >> >> Yes. >> But perhaps a more general functionality would be useful. >> > > =E2=80=8BGeneral? Could you give an example? > Aren't these=E2=80=8B enough? > > public static > T min(T...array); > > public static > T max(T...array); > > public static > int argmin(T...array); > > public static > int argmax(T...array); > > > >> Especially with the new Java 8 function types. >> > > =E2=80=8BIt's easy to implement having Java 8 function types, not sure I'= m > following you > w/ how it could affect the API's of proposed methods.=E2=80=8B > > I think I will submit a JIRA ticket w/ these and submit a patch, reviewin= g > it we will > be able to eventually come to some reasonable solution. > > Anyway =E2=80=8Bif such functionality is already exist in "RealVector", I= guess >>>> >>>>> there is no point of adding >>>>> it to MathArrays, unless RealVector should be refactored and >>>>> functionality >>>>> should be removed from >>>>> there. >>>>> >>>>> >>>> Yes, refactored it should be: >>>> https://issues.apache.org/jira/browse/MATH-765 >>>> >>>> >>>> =E2=80=8BIt says that these methods to be removed from RealVector.=E2= =80=8B >>> >> >> A pity that what it says did not occur. :-} >> > > =E2=80=8B:)))=E2=80=8B > > =E2=80=8BBest, > Artem Barger.=E2=80=8B > > --001a114453c2e9ccee05343390c7--