commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Artem Barger <ar...@bargr.net>
Subject Re: [Math] Adding min/max and argmin/argmax values for an arrays of double/int (Comparable).
Date Wed, 01 Jun 2016 08:49:22 GMT
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 <artem@bargr.net> wrote:

>
> On Tue, May 31, 2016 at 3:17 AM, Gilles <gilles@harfang.homelinux.org>
> 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.
>>>>
>>>>
>>>> ​So in order to use them I need to instantiate a RealVector, right?
>>>
>>
>> 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​.
>>>
>>
>> Yes.
>> But perhaps a more general functionality would be useful.
>>
>
> ​General? Could you give an example?
> Aren't these​ enough?
>
> public static <T extends Comparable<T>> T min(T...array);
>
> public static <T extends Comparable<T>> T max(T...array);
>
> public static <T extends Comparable<T>> int argmin(T...array);
>
> public static <T extends Comparable<T>> int argmax(T...array);
>
>
>
>> Especially with the new Java 8 function types.
>>
>
> ​It'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.​
>
> I think I will submit a JIRA ticket w/ these and submit a patch, reviewing
> it we will
> be able to eventually come to some reasonable solution.
>
> Anyway ​if 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
>>>>
>>>>
>>>> ​It says that these methods to be removed from RealVector.​
>>>
>>
>> A pity that what it says did not occur. :-}
>>
>
> ​:)))​
>
> ​Best,
>           Artem Barger.​
>
>

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