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.

Closes #9.
This commit is contained in:
Luc Maisonobe 2015-07-05 10:21:53 +02:00
parent 088d0f9222
commit 3ac3ff62b8
3 changed files with 49 additions and 2 deletions

View File

@ -54,6 +54,11 @@ If the output is not quite correct, check for invisible trailing spaces!
</release> </release>
<release version="4.0" date="XXXX-XX-XX" description=""> <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" > <action dev="luc" type="add" >
Added mapping functions to MathArrays. These methods allow to map Added mapping functions to MathArrays. These methods allow to map
any univariate or bivariate functions to arrays. any univariate or bivariate functions to arrays.

View File

@ -184,6 +184,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 c Coordinate.
* @param val Coordinate samples. * @param val Coordinate samples.

View File

@ -160,7 +160,12 @@ public final class BicubicInterpolatingFunctionTest {
try { try {
bcf.value(x, y); bcf.value(x, y);
Assert.fail("OutOfRangeException expected"); 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; x = xMin;
y = yMax + small; y = yMax + small;
@ -169,7 +174,12 @@ public final class BicubicInterpolatingFunctionTest {
try { try {
bcf.value(x, y); bcf.value(x, y);
Assert.fail("OutOfRangeException expected"); 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);
}
} }
/** /**