Le 05/07/2015 21:39, Gilles a écrit :
> On Sun, 05 Jul 2015 18:32:16 -0000, luc@apache.org wrote:
>> Add getXmax, getXmin, getYmax, getYmin to BicubicInterpolatingFunction.
>>
>> These can be useful to manage an OutOfRangeException without the need to
>> access the original x and y arrays.
>
> IIRC, this "feature" has been requested before but eventually without a
> convincing use-case. [In general, the user knows the valid range since
> he called "interpolate".]
User do not always keep the arrays. As the interpolator does jeep them,
we just have to ask it.
>
>> Closes #9.
>
> Shouldn't we discuss API change on the ML?
If we start discussing every single getter, we will grind to halt. We
are already not responsive enough (and I put most of the blame on myself).
best regards,
Luc
>
>
> Regards,
> Gilles
>
>> Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
>> Commit:
>> http://git-wip-us.apache.org/repos/asf/commons-math/commit/3ac3ff62
>> Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/3ac3ff62
>> Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/3ac3ff62
>>
>> Branch: refs/heads/master
>> Commit: 3ac3ff62b862ee89effcf1a4889b04f32fd8dbb2
>> Parents: 088d0f9
>> Author: Luc Maisonobe <luc@apache.org>
>> Authored: Sun Jul 5 10:21:53 2015 +0200
>> Committer: Luc Maisonobe <luc@apache.org>
>> Committed: Sun Jul 5 10:21:53 2015 +0200
>>
>>
>> ----------------------------------------------------------------------
>> src/changes/changes.xml | 5 +++
>> .../BicubicInterpolatingFunction.java | 32
>> ++++++++++++++++++++
>> .../BicubicInterpolatingFunctionTest.java | 14 +++++++--
>> 3 files changed, 49 insertions(+), 2 deletions(-)
>>
>> ----------------------------------------------------------------------
>>
>>
>>
>> http://git-wip-us.apache.org/repos/asf/commons-math/blob/3ac3ff62/src/changes/changes.xml
>>
>>
>> ----------------------------------------------------------------------
>> diff --git a/src/changes/changes.xml b/src/changes/changes.xml
>> index 83d03e1..63df40a 100644
>> --- a/src/changes/changes.xml
>> +++ b/src/changes/changes.xml
>> @@ -54,6 +54,11 @@ If the output is not quite correct, check for
>> invisible trailing spaces!
>> </release>
>>
>> <release version="4.0" date="XXXX-XX-XX" description="">
>> + <action dev="luc" type="add" due-to="Lorenzoexe">
>> + Add getXmax(), getXmin(), getYmax(), getYmin() to bicubic
>> interpolating function.
>> + These can be useful to manage an OutOfRangeException without
>> the need to access
>> + the original x and y arrays.
>> + </action>
>> <action dev="luc" type="add" >
>> Added mapping functions to MathArrays. These methods allow to
>> map
>> any univariate or bivariate functions to arrays.
>>
>>
>> http://git-wip-us.apache.org/repos/asf/commons-math/blob/3ac3ff62/src/main/java/org/apache/commons/math4/analysis/interpolation/BicubicInterpolatingFunction.java
>>
>>
>> ----------------------------------------------------------------------
>> diff --git
>>
>> a/src/main/java/org/apache/commons/math4/analysis/interpolation/BicubicInterpolatingFunction.java
>>
>>
>> b/src/main/java/org/apache/commons/math4/analysis/interpolation/BicubicInterpolatingFunction.java
>>
>> index b89a517..f1c10f8 100644
>> ---
>>
>> a/src/main/java/org/apache/commons/math4/analysis/interpolation/BicubicInterpolatingFunction.java
>>
>> +++
>>
>> b/src/main/java/org/apache/commons/math4/analysis/interpolation/BicubicInterpolatingFunction.java
>>
>> @@ -185,6 +185,38 @@ public class BicubicInterpolatingFunction
>> }
>>
>> /**
>> + * Returns the minimum value of the first coordinate
>> + * @return xval[0].
>> + */
>> + public double getXmin() {
>> + return xval[0];
>> + }
>> +
>> + /**
>> + * Returns the maximum value of the second coordinate
>> + * @return xval[xval.length - 1].
>> + */
>> + public double getXmax() {
>> + return xval[xval.length - 1];
>> + }
>> +
>> + /**
>> + * Returns the minimum value of the second coordinate
>> + * @return yval[0].
>> + */
>> + public double getYmin() {
>> + return yval[0];
>> + }
>> +
>> + /**
>> + * Returns the maximum value of the second coordinate
>> + * @return yval[yval.length - 1].
>> + */
>> + public double getYmax() {
>> + return yval[yval.length - 1];
>> + }
>> +
>> + /**
>> * @param c Coordinate.
>> * @param val Coordinate samples.
>> * @return the index in {@code val} corresponding to the interval
>>
>>
>> http://git-wip-us.apache.org/repos/asf/commons-math/blob/3ac3ff62/src/test/java/org/apache/commons/math4/analysis/interpolation/BicubicInterpolatingFunctionTest.java
>>
>>
>> ----------------------------------------------------------------------
>> diff --git
>>
>> a/src/test/java/org/apache/commons/math4/analysis/interpolation/BicubicInterpolatingFunctionTest.java
>>
>>
>> b/src/test/java/org/apache/commons/math4/analysis/interpolation/BicubicInterpolatingFunctionTest.java
>>
>> index 0ec77aa..b54c750 100644
>> ---
>>
>> a/src/test/java/org/apache/commons/math4/analysis/interpolation/BicubicInterpolatingFunctionTest.java
>>
>> +++
>>
>> b/src/test/java/org/apache/commons/math4/analysis/interpolation/BicubicInterpolatingFunctionTest.java
>>
>> @@ -160,7 +160,12 @@ public final class
>> BicubicInterpolatingFunctionTest {
>> try {
>> bcf.value(x, y);
>> Assert.fail("OutOfRangeException expected");
>> - } catch (OutOfRangeException expected) {}
>> + } catch (OutOfRangeException expected) {
>> + Assert.assertEquals(xMin, bcf.getXmin(), 1.0e-15);
>> + Assert.assertEquals(xMax, bcf.getXmax(), 1.0e-15);
>> + Assert.assertEquals(yMin, bcf.getYmin(), 1.0e-15);
>> + Assert.assertEquals(yMax, bcf.getYmax(), 1.0e-15);
>> + }
>>
>> x = xMin;
>> y = yMax + small;
>> @@ -169,7 +174,12 @@ public final class
>> BicubicInterpolatingFunctionTest {
>> try {
>> bcf.value(x, y);
>> Assert.fail("OutOfRangeException expected");
>> - } catch (OutOfRangeException expected) {}
>> + } catch (OutOfRangeException expected) {
>> + Assert.assertEquals(xMin, bcf.getXmin(), 1.0e-15);
>> + Assert.assertEquals(xMax, bcf.getXmax(), 1.0e-15);
>> + Assert.assertEquals(yMin, bcf.getYmin(), 1.0e-15);
>> + Assert.assertEquals(yMax, bcf.getYmax(), 1.0e-15);
>> + }
>> }
>>
>> /**
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org
|