[ 
https://issues.apache.org/jira/browse/MATH-1130?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14041058#comment-14041058
 ] 

Venkatesha Murthy TS edited comment on MATH-1130 at 6/23/14 6:16 PM:
---------------------------------------------------------------------

I have split the changes into independently appliable patches.

a) math-1130-checknotnan : a new method which handles ranges
b) math-1130-canequal : A faster equals method for nan equality tests when 
compared to Math,equals or Precision.equalsIncludingNaN. Sure yes, 
Precision.equalsIncludingNaN does check for both being NaN but falls short of 
covering the case of one of them being NaN, (please check the test code in this 
patch on how much it matters)
c) math-1130-remove : contains remove and removeInRange as discussed with a 
small helper private static method called findInRange.
d) math-1130-replace : contains replace and replaceInRange

Both removeInRange and replaceInRange  methods make use of canEqual


was (Author: vmurthy):
I have split the changes into independently appliable patches.

a) checknotnan : a new method which handles ranges
b) canequal : A faster equals method for nan equality tests when compared to 
Math,equals or Precision.equalsIncludingNaN (please check the test code here 
where the performance difference can be seen
c) remove : contains remove and removeInRange as discussed with a small helper 
private static method called findInRange.
d) replace : contains replace and replaceInRange

Both removeInRange and replaceInRange  methods make use of canEqual

> A new set of functions for copyof, remove and replace a given value on a 
> slice of array
> ---------------------------------------------------------------------------------------
>
>                 Key: MATH-1130
>                 URL: https://issues.apache.org/jira/browse/MATH-1130
>             Project: Commons Math
>          Issue Type: New Feature
>    Affects Versions: 3.4
>            Reporter: Venkatesha Murthy TS
>         Attachments: math-1130-canequal.patch, math-1130-checknotnan.patch, 
> math-1130-remove.patch, math-1130-replace.patch, math-1130.patch
>
>
> These are utility functions mostly required as part of MathArrays.
> MathArrays:
> =============
> The requirement is as follows:
> a) double[] copyOf(double[] values, int begin, int length) ;
> Similar to most other functions that support slice defined  by  the array 
> part from [begin, begin+length) ;its a requirement to copy a slice which is 
> not available (the closest is copyOf(array, int len) which misses out the 
> begin index)
> b) double[] removeAll(double[] values, int begin, int length, double 
> removable);
> Need a function to remove a value from array slice defined by 
> [begin,begin+length) and return the filtered version.
> c) double[] replaceAll(double[] values, int begin, int length, double 
> oldValue, double newValue);
> Need a function to replace inplace an oldValue substituted with newValue in 
> the array slice defined by [begin,begin+length) and return the original  
> complete array with just replaced values only in the segment 
> [begin,begin+length)
> MathUtils
> =========
> boolean canEqual(double d1, double d2) ;
> provide a canEqual function that is slightly better than exisitng 
> MathUtils.equals. We could also improve existing equals method however.
> So the change here is that the new enhanced canEqual can do a quick check on 
> Nans  and then move to a detailed Double.compare(..) method. This avoids the 
> Double.compare call when any one of them is NaN.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to