You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by venkatesha murthy <ve...@gmail.com> on 2014/07/04 13:51:10 UTC

Re: [MATH-1130] Patch on remove and replace (math-1130-remove.patch and math-1130-replace.patch)

Hi All

Just wanted to converge on the inclusion of this patch. (this was discussed
in another context..however i am using this mail since it directly pertains
to remove and replace methods).

Do you see utility for these general functions(remove and replace methods)
within MathArrays and is a good addition.

If this is not suitable within MathArrays; would you suggest
a) any other equivalent function(s) from any other commons lib or math.
Would we then allow (say perhaps commons-collection/lang) such libs to be
part of our pom.xml?
b) adding these to any other class existing within commons math (such as
perhaps DoubleArray)
c) just to retain these as private static within which ever main class
wanted it

Please let know your opinion on these.

thanks
venkat.


On Tue, Jun 24, 2014 at 12:19 AM, venkatesha murthy <
venkateshamurthyts@gmail.com> wrote:

> I am adding the following 2 methods in MathArrays. Please let me know
> if any one has concerns.(The math-1130-remove.patch and
> math-1130-replace.patch has te code for reference)
>
> a) Replace a old val with new val in a double array
> i) public static double[] replaceInRange(final double[] values,final int
> from,
>                                                           final int
> to, final double oldValue,
>                                                           final double
> newValue) ;
>
> ii)public static double[] replace(final double[] values, final double
> oldValue,
>                                              final double newValue)
>
> b) Remove a value from a doible array
> i) public static double[] removeInRange(final double[] values, final int
> from,
>                                                          final int to,
> final double item)
>
> ii)public static double[] remove(final double[] values, final double item)
>
> Basically i needed this feature from Math-1120 where handling of NaN
> required to remove NaNs. Even replacing of Nan is astrategy and hence
> the need for replace function
>
> Thanks
> Venkat
>