On Tue, 31 May 2016 01:34:50 +0300, Artem Barger wrote:
Hi

On Tue, May 31, 2016 at 1:19 AM, Gilles <gil...@harfang.homelinux.org>
wrote:

Hi.

On Tue, 31 May 2016 00:05:55 +0300, Artem Barger wrote:

Hi.

Lately working w/ Apache Commons Math, library I've found myself
implementing functions which given an array of either doubles of integers return the min or max value among all elements of an array. Moreover I've
added an argmin/argmin functions as well, which for given array of
double/int values return an index of min/max element within that array.

Since I didn't find such functions available in the project, I'm willing
to
contribute these function into the framework and was curious whenever it's usable? Also what should be the right place to put these functions? I've added them as static method for MathArrays class, however not 100% sure
this is the right place.

Think further about these functions, I can easily make them work w/
instances of Comparable interface of accept Comparator<T> as second
parameter.

What should be the right way to handle this?


It might be added to MathArrays indeed.
Note that such a functionality is available in "RealVector".


​I might be looking on the wrong source tree, but I do not see it in
"RealVector".
Currently I'm using this repo: "
http://git-wip-us.apache.org/repos/asf/commons-math.git";
and looking on master branch.

https://git1-us-west.apache.org/repos/asf?p=commons-math.git;a=blob;f=src/main/java/org/apache/commons/math4/linear/RealVector.java;h=545a521ce729312b7ae630a9856fca4f22c45e00;hb=HEAD

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.

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

[Also, I think that the functionality which you proposed might be
available or fairly easily achievable in Java 8.]


Gilles


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org

Reply via email to