[jira] [Commented] (MATH-1130) A new set of functions for copyof, remove and replace a given value on a slice of array
[ https://issues.apache.org/jira/browse/MATH-1130?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14052311#comment-14052311 ] Gilles commented on MATH-1130: -- You can follow the discussions on the dev ML... As far as I understood correctly, there is a chance that these methods will be unnecessary. And there was no agreement to provide them independently. If you want to challenge this, please relaunch the discussion on the ML. 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: equalsIncludingNaN.dat, math-1130-checknotnan.patch, math-1130-precision-equals.patch, math-1130-remove.patch, math-1130-replace.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)
[jira] [Commented] (MATH-1130) A new set of functions for copyof, remove and replace a given value on a slice of array
[ https://issues.apache.org/jira/browse/MATH-1130?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14052128#comment-14052128 ] Venkatesha Murthy TS commented on MATH-1130: Please let know of any updates on this. 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: equalsIncludingNaN.dat, math-1130-checknotnan.patch, math-1130-precision-equals.patch, math-1130-remove.patch, math-1130-replace.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)
[jira] [Commented] (MATH-1130) A new set of functions for copyof, remove and replace a given value on a slice of array
[ https://issues.apache.org/jira/browse/MATH-1130?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14045588#comment-14045588 ] Venkatesha Murthy TS commented on MATH-1130: Ok, Sure.. i was not sure where to include the perf related tests and now will put those in say EqualsTestPerf which does not get into main testing. Do you need patches which can be serially applied in an order OR each patch file strictly independent of each other?. 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: equalsIncludingNaN.dat, math-1130-checknotnan.patch, math-1130-precision-equals.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)
[jira] [Commented] (MATH-1130) A new set of functions for copyof, remove and replace a given value on a slice of array
[ https://issues.apache.org/jira/browse/MATH-1130?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14045805#comment-14045805 ] Gilles commented on MATH-1130: -- bq. now will put \[perf related tests\] in say EqualsTestPerf which does not get into main testing. EqualsTestPerf is useless since the code in CM's trunk is now the same as the one being compared to in that class. Moreover, it is generally misleading to just time a tight loop that executes an elementary task. bq. Do you need patches which can be serially applied in an order OR each patch file strictly independent of each other? Preferably: Independent patches for independent changes. :) Or the smallest possible patch (containing only the changes agreed on during the discussion)... 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: equalsIncludingNaN.dat, math-1130-checknotnan.patch, math-1130-precision-equals.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)
[jira] [Commented] (MATH-1130) A new set of functions for copyof, remove and replace a given value on a slice of array
[ https://issues.apache.org/jira/browse/MATH-1130?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14044639#comment-14044639 ] Gilles commented on MATH-1130: -- equalsIncludingNaN modified in revision 1605777. Is there a reason for all the additional unit tests? The performance testing cannot really be assessed with a timeout (and it is commented out in the patch anyway). If some tests are missing for checking the semantics, please include them in the appropriate test method. 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: equalsIncludingNaN.dat, math-1130-checknotnan.patch, math-1130-precision-equals.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)
[jira] [Commented] (MATH-1130) A new set of functions for copyof, remove and replace a given value on a slice of array
[ https://issues.apache.org/jira/browse/MATH-1130?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14044673#comment-14044673 ] Gilles commented on MATH-1130: -- bq. I have split the changes into independently appliable patches. It does not seem so. The patches for replace and remove contain code for other changes. 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: equalsIncludingNaN.dat, math-1130-checknotnan.patch, math-1130-precision-equals.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)
[jira] [Commented] (MATH-1130) A new set of functions for copyof, remove and replace a given value on a slice of array
[ https://issues.apache.org/jira/browse/MATH-1130?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14043913#comment-14043913 ] Venkatesha Murthy TS commented on MATH-1130: Regarding equalsIncludingNaN: What is the test code used or the micro benchmark? can you please share ? What does N correspond to? In my measurements in my machine with respect to the test testMath1130ForDoubleEqual in PrecisionTest.java attached i j d time in seconds(old code) time in seconds(with venkats code) 10 10 1000.027 00.003 10 10 100 00.020 00.011 10 10 100000.038 00.023 10 100100000.066 00.073 10 1000 100000.287 00.127 10 1100002.280 00.947 10 11 22.217 09.275 10 110 224.454 91.918 10 10 1224.673 91.319 Well trying to understand a bit more. So as i am seeing most times the above timings... Wondering where am i seeing the gap as at every level (i,j,d) there is a clear difference from (10s of milliseconds to 100s of seconds)(bigger as the iterations go up) Basically If only one of them is NaN it does not make sense to get to a detailed compare which is what i have eliminated. Iam just following this tradition already existing in say MathArrays.equals(final float[] x, final float[] y) method where null checks are eliminated earlier in this fashion. Also if x!=x seems cryptic, i could replace with Double.isNaN() to make it bit obvious.(is this is the concern?) Please help me as to what is less clear 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: equalsIncludingNaN.dat, math-1130-checknotnan.patch, math-1130-precision-equals.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)
[jira] [Commented] (MATH-1130) A new set of functions for copyof, remove and replace a given value on a slice of array
[ https://issues.apache.org/jira/browse/MATH-1130?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14044169#comment-14044169 ] Gilles commented on MATH-1130: -- bq. What is the test code used or the micro benchmark? It's in {{src/test/java/org/apache/commons/math3/PerfTestUtils.java}}. The code I used is {code} package org.apache.commons.math3.util; import org.apache.commons.math3.PerfTestUtils; import org.apache.commons.math3.distribution.RealDistribution; import org.apache.commons.math3.distribution.UniformRealDistribution; import org.junit.BeforeClass; import org.junit.Test; import org.junit.Assert; /** * Performance tests for Precision.equals. * Not enabled by default, as the class does not end in Test. * * Invoke by runningbr/ * {@code mvn test -Dtest=EqualsTestPerf}br/ * or by runningbr/ * {@code mvn test -Dtest=EqualsTestPerf -DargLine=-DtestRuns=1234 -server}br/ */ public class EqualsTestPerf { private static final int RUNS = Integer.parseInt(System.getProperty(testRuns,1000)); @Test public void testSimpleBenchmark() { final String D = CM; final String DM = V; final int numStat = 100; final int numCall = RUNS / numStat; final RealDistribution d = new UniformRealDistribution(0, Double.MAX_VALUE); final double v = d.sample(); final double w = d.sample(); PerfTestUtils.timeAndReport(equalsIncludingNaN, numCall, numStat, false, new PerfTestUtils.RunTest(D) { @Override public Double call() throws Exception { return Precision.equalsIncludingNaN(v, w) ? 1d : 0d; } }, new PerfTestUtils.RunTest(DM) { @Override public Double call() throws Exception { return EqualsTestPerf.equalsIncludingNaN(v, w) ? 1d : 0d; } }); } public static boolean equalsIncludingNaN(double x, double y) { return (x != x || y != y) ? !(x != x ^ y != y) : Precision.equals(x, y, 1); } } {code} bq. What does N correspond to? The value of the testRuns property. bq. Basically If only one of them is NaN it does not make sense to get to a detailed compare which is what i have eliminated. OK. I got it. In that case (only one argument is NaN), your code should be faster indeed. In the general case (none of the arguments is NaN), it's not that obvious, and the benchmarking code does not seem to help figuring it out. You are most welcome to try it (and report flaws...). 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: equalsIncludingNaN.dat, math-1130-checknotnan.patch, math-1130-precision-equals.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(..)
[jira] [Commented] (MATH-1130) A new set of functions for copyof, remove and replace a given value on a slice of array
[ https://issues.apache.org/jira/browse/MATH-1130?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14040564#comment-14040564 ] Venkatesha Murthy TS commented on MATH-1130: I missed adding about checkNotNan(values, begin, length) in MathArrays which essentially adds a a range for check. One more point; If we are supporting replace and remove for entire array; naming them as removeInRange or replaceInRange IMO may not be a good fit. Instead without the InRange suffix ; we could to support both the flavours viz one with full array and another with a range with [begin, begin+length). 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.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 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)
[jira] [Commented] (MATH-1130) A new set of functions for copyof, remove and replace a given value on a slice of array
[ https://issues.apache.org/jira/browse/MATH-1130?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14040711#comment-14040711 ] Gilles commented on MATH-1130: -- Please make _separate_ patches for each new functionality. It will be clearer and easier to discuss them. You should also post on the dev ML, to avoid wasting time on something in case it is objected to there. In particular, I still don't get the purpose of canEqual. It looks like a duplicate of equalsIncludingNaN. bq. If we are supporting replace and remove for entire array; naming them as removeInRange or replaceInRange IMO may not be a good fit. We could have remove(double[] a, double v) and removeInRange(double[] a, int from, int to, double v), with {code} public static double[] remove(double[] a, double v) { return removeInRange(a, 0, a.length, v); } {code} bq. signature in verifyValues seemed more natural for me and hence continued the same tradition even to these methods. MathArrays was intended to collect methods akin to those in java.lang.Arrays and most methods there use from and to indices. verifyValues predates the creation of the MathArrays utility class... 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.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 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)
[jira] [Commented] (MATH-1130) A new set of functions for copyof, remove and replace a given value on a slice of array
[ https://issues.apache.org/jira/browse/MATH-1130?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14040715#comment-14040715 ] Gilles commented on MATH-1130: -- bq. verifyValues predates the creation of the MathArrays utility class... Oops. I'm wrong: it is from 3.3! I have missed it. Otherwise I would have pushed for another syntax. :( It is possible to deprecate those in 3.4 and switch to the other syntax... 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.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 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)
[jira] [Commented] (MATH-1130) A new set of functions for copyof, remove and replace a given value on a slice of array
[ https://issues.apache.org/jira/browse/MATH-1130?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14040861#comment-14040861 ] Venkatesha Murthy TS commented on MATH-1130: When you mean separate patch; are you saying 3 separate patch files for the same MATH-1130 issue? Just wanted to be sure. Say for eg: math-1130-remove.patch, math-1130-replace.patch , math-1130-canequal.patch Also when you mean from and to is to Inclusive or excluded. IMO when end index must be inclusive so that means when in a for loop for(int index = from; index = end; index++){ ... ... } 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.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 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)
[jira] [Commented] (MATH-1130) A new set of functions for copyof, remove and replace a given value on a slice of array
[ https://issues.apache.org/jira/browse/MATH-1130?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14040884#comment-14040884 ] Gilles commented on MATH-1130: -- bq. 3 separate patch files Yes. Changes should be as small as possible in order to ease reviewing. bq. same MATH-1130 Nothing forbids you to open separate issues (or create sub-tasks -- see the More tab on this page). bq. is to Inclusive or excluded. Excluded. See [Arrays.copyOfRange|http://docs.oracle.com/javase/7/docs/api/java/util/Arrays.html#copyOfRange(double\[\], int, int)] 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.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 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)
[jira] [Commented] (MATH-1130) A new set of functions for copyof, remove and replace a given value on a slice of array
[ https://issues.apache.org/jira/browse/MATH-1130?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14038793#comment-14038793 ] Gilles commented on MATH-1130: -- bq. a) double[] copyOf(double[] values, int begin, int length) ; New method copyOfRange added in revision 1604172. 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 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 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)
[jira] [Commented] (MATH-1130) A new set of functions for copyof, remove and replace a given value on a slice of array
[ https://issues.apache.org/jira/browse/MATH-1130?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14038800#comment-14038800 ] Gilles commented on MATH-1130: -- You are welcome to provide (separate) patches for removeInRange (b) and replaceInRange (c). I do not understand the purpose of canEqual. Can you provide an example of use? 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 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 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)