Venkatesha Murthy TS created MATH-1130:
------------------------------------------

             Summary: A new set of functions to copyof, remove and replace for 
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


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 and return the filtered version 
which again must support slice.

c) double[] replaceAll(double[] values, int begin, int length, double oldValue, 
double newValue);

Need a function to replace inplace an oldValue substituted with newValue and 
return the original array with replaced values.

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 as well as both +ve and -ve Infinities faster and then move to a 
detailed Double.compare(..) method. This avoids the Double.compare call for 
infinities and NaN with faster reference equal check (i.e == ).




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

Reply via email to