You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by er...@apache.org on 2012/09/02 01:54:53 UTC
svn commit: r1379904 -
/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/interpolation/
Author: erans
Date: Sat Sep 1 23:54:52 2012
New Revision: 1379904
URL: http://svn.apache.org/viewvc?rev=1379904&view=rev
Log:
MATH-854
Populate "throws" clause.
Modified:
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/interpolation/BicubicSplineInterpolatingFunction.java
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/interpolation/BicubicSplineInterpolator.java
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/interpolation/BivariateGridInterpolator.java
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/interpolation/DividedDifferenceInterpolator.java
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/interpolation/LinearInterpolator.java
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/interpolation/LoessInterpolator.java
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/interpolation/MicrosphereInterpolatingFunction.java
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/interpolation/MicrosphereInterpolator.java
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/interpolation/NevilleInterpolator.java
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/interpolation/SmoothingPolynomialBicubicSplineInterpolator.java
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/interpolation/SplineInterpolator.java
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/interpolation/TricubicSplineInterpolatingFunction.java
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/interpolation/TricubicSplineInterpolator.java
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/interpolation/TrivariateGridInterpolator.java
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/interpolation/UnivariatePeriodicInterpolator.java
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/interpolation/BicubicSplineInterpolatingFunction.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/interpolation/BicubicSplineInterpolatingFunction.java?rev=1379904&r1=1379903&r2=1379904&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/interpolation/BicubicSplineInterpolatingFunction.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/interpolation/BicubicSplineInterpolatingFunction.java Sat Sep 1 23:54:52 2012
@@ -20,6 +20,7 @@ import org.apache.commons.math3.analysis
import org.apache.commons.math3.exception.DimensionMismatchException;
import org.apache.commons.math3.exception.NoDataException;
import org.apache.commons.math3.exception.OutOfRangeException;
+import org.apache.commons.math3.exception.NonMonotonicSequenceException;
import org.apache.commons.math3.util.MathArrays;
/**
@@ -84,8 +85,8 @@ public class BicubicSplineInterpolatingF
* every grid point.
* @throws DimensionMismatchException if the various arrays do not contain
* the expected number of elements.
- * @throws org.apache.commons.math3.exception.NonMonotonicSequenceException
- * if {@code x} or {@code y} are not strictly increasing.
+ * @throws NonMonotonicSequenceException if {@code x} or {@code y} are
+ * not strictly increasing.
* @throws NoDataException if any of the arrays has zero length.
*/
public BicubicSplineInterpolatingFunction(double[] x,
@@ -94,7 +95,9 @@ public class BicubicSplineInterpolatingF
double[][] dFdX,
double[][] dFdY,
double[][] d2FdXdY)
- throws DimensionMismatchException {
+ throws DimensionMismatchException,
+ NoDataException,
+ NonMonotonicSequenceException {
final int xLen = x.length;
final int yLen = y.length;
@@ -155,7 +158,8 @@ public class BicubicSplineInterpolatingF
/**
* {@inheritDoc}
*/
- public double value(double x, double y) {
+ public double value(double x, double y)
+ throws OutOfRangeException {
final int i = searchIndex(x, xval);
if (i == -1) {
throw new OutOfRangeException(x, xval[0], xval[xval.length - 1]);
@@ -176,8 +180,12 @@ public class BicubicSplineInterpolatingF
* @param y y-coordinate.
* @return the value at point (x, y) of the first partial derivative with
* respect to x.
+ * @throws OutOfRangeException if {@code x} (resp. {@code y}) is outside
+ * the range defined by the boundary values of {@code xval} (resp.
+ * {@code yval}).
*/
- public double partialDerivativeX(double x, double y) {
+ public double partialDerivativeX(double x, double y)
+ throws OutOfRangeException {
return partialDerivative(0, x, y);
}
/**
@@ -185,8 +193,12 @@ public class BicubicSplineInterpolatingF
* @param y y-coordinate.
* @return the value at point (x, y) of the first partial derivative with
* respect to y.
+ * @throws OutOfRangeException if {@code x} (resp. {@code y}) is outside
+ * the range defined by the boundary values of {@code xval} (resp.
+ * {@code yval}).
*/
- public double partialDerivativeY(double x, double y) {
+ public double partialDerivativeY(double x, double y)
+ throws OutOfRangeException {
return partialDerivative(1, x, y);
}
/**
@@ -194,8 +206,12 @@ public class BicubicSplineInterpolatingF
* @param y y-coordinate.
* @return the value at point (x, y) of the second partial derivative with
* respect to x.
+ * @throws OutOfRangeException if {@code x} (resp. {@code y}) is outside
+ * the range defined by the boundary values of {@code xval} (resp.
+ * {@code yval}).
*/
- public double partialDerivativeXX(double x, double y) {
+ public double partialDerivativeXX(double x, double y)
+ throws OutOfRangeException {
return partialDerivative(2, x, y);
}
/**
@@ -203,16 +219,24 @@ public class BicubicSplineInterpolatingF
* @param y y-coordinate.
* @return the value at point (x, y) of the second partial derivative with
* respect to y.
+ * @throws OutOfRangeException if {@code x} (resp. {@code y}) is outside
+ * the range defined by the boundary values of {@code xval} (resp.
+ * {@code yval}).
*/
- public double partialDerivativeYY(double x, double y) {
+ public double partialDerivativeYY(double x, double y)
+ throws OutOfRangeException {
return partialDerivative(3, x, y);
}
/**
* @param x x-coordinate.
* @param y y-coordinate.
* @return the value at point (x, y) of the second partial cross-derivative.
+ * @throws OutOfRangeException if {@code x} (resp. {@code y}) is outside
+ * the range defined by the boundary values of {@code xval} (resp.
+ * {@code yval}).
*/
- public double partialDerivativeXY(double x, double y) {
+ public double partialDerivativeXY(double x, double y)
+ throws OutOfRangeException {
return partialDerivative(4, x, y);
}
@@ -221,8 +245,12 @@ public class BicubicSplineInterpolatingF
* @param x x-coordinate.
* @param y y-coordinate.
* @return the value at point (x, y) of the selected partial derivative.
+ * @throws OutOfRangeException if {@code x} (resp. {@code y}) is outside
+ * the range defined by the boundary values of {@code xval} (resp.
+ * {@code yval}).
*/
- private double partialDerivative(int which, double x, double y) {
+ private double partialDerivative(int which, double x, double y)
+ throws OutOfRangeException {
if (partialDerivatives == null) {
computePartialDerivatives();
}
@@ -267,7 +295,7 @@ public class BicubicSplineInterpolatingF
* @param val Coordinate samples.
* @return the index in {@code val} corresponding to the interval
* containing {@code c}, or {@code -1} if {@code c} is out of the
- * range defined by the end values of {@code val}.
+ * range defined by the boundary values of {@code val}.
*/
private int searchIndex(double c, double[] val) {
if (c < val[0]) {
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/interpolation/BicubicSplineInterpolator.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/interpolation/BicubicSplineInterpolator.java?rev=1379904&r1=1379903&r2=1379904&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/interpolation/BicubicSplineInterpolator.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/interpolation/BicubicSplineInterpolator.java Sat Sep 1 23:54:52 2012
@@ -20,6 +20,8 @@ import org.apache.commons.math3.analysis
import org.apache.commons.math3.analysis.polynomials.PolynomialSplineFunction;
import org.apache.commons.math3.exception.DimensionMismatchException;
import org.apache.commons.math3.exception.NoDataException;
+import org.apache.commons.math3.exception.NumberIsTooSmallException;
+import org.apache.commons.math3.exception.NonMonotonicSequenceException;
import org.apache.commons.math3.util.MathArrays;
/**
@@ -35,7 +37,10 @@ public class BicubicSplineInterpolator
*/
public BicubicSplineInterpolatingFunction interpolate(final double[] xval,
final double[] yval,
- final double[][] fval) {
+ final double[][] fval)
+ throws NoDataException,
+ DimensionMismatchException,
+ NonMonotonicSequenceException {
if (xval.length == 0 || yval.length == 0 || fval.length == 0) {
throw new NoDataException();
}
@@ -118,23 +123,24 @@ public class BicubicSplineInterpolator
}
/**
- * Compute the next index of an array, clipping if necessary.
- * It is assumed (but not checked) that {@code i} is larger than or equal to 0}.
+ * Computes the next index of an array, clipping if necessary.
+ * It is assumed (but not checked) that {@code i >= 0}.
*
- * @param i Index
- * @param max Upper limit of the array
- * @return the next index
+ * @param i Index.
+ * @param max Upper limit of the array.
+ * @return the next index.
*/
private int nextIndex(int i, int max) {
final int index = i + 1;
return index < max ? index : index - 1;
}
/**
- * Compute the previous index of an array, clipping if necessary.
- * It is assumed (but not checked) that {@code i} is smaller than the size of the array.
+ * Computes the previous index of an array, clipping if necessary.
+ * It is assumed (but not checked) that {@code i} is smaller than the size
+ * of the array.
*
- * @param i Index
- * @return the previous index
+ * @param i Index.
+ * @return the previous index.
*/
private int previousIndex(int i) {
final int index = i - 1;
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/interpolation/BivariateGridInterpolator.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/interpolation/BivariateGridInterpolator.java?rev=1379904&r1=1379903&r2=1379904&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/interpolation/BivariateGridInterpolator.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/interpolation/BivariateGridInterpolator.java Sat Sep 1 23:54:52 2012
@@ -17,6 +17,8 @@
package org.apache.commons.math3.analysis.interpolation;
import org.apache.commons.math3.analysis.BivariateFunction;
+import org.apache.commons.math3.exception.DimensionMismatchException;
+import org.apache.commons.math3.exception.NoDataException;
/**
* Interface representing a bivariate real interpolating function where the
@@ -35,11 +37,11 @@ public interface BivariateGridInterpolat
* @param fval The values of the interpolation points on all the grid knots:
* {@code fval[i][j] = f(xval[i], yval[j])}.
* @return a function which interpolates the dataset.
- * @throws org.apache.commons.math3.exception.NoDataException if any of
- * the arrays has zero length.
- * @throws org.apache.commons.math3.exception.DimensionMismatchException
- * if the array lengths are inconsistent.
+ * @throws NoDataException if any of the arrays has zero length.
+ * @throws DimensionMismatchException if the array lengths are inconsistent.
*/
BivariateFunction interpolate(double[] xval, double[] yval,
- double[][] fval);
+ double[][] fval)
+ throws NoDataException,
+ DimensionMismatchException;
}
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/interpolation/DividedDifferenceInterpolator.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/interpolation/DividedDifferenceInterpolator.java?rev=1379904&r1=1379903&r2=1379904&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/interpolation/DividedDifferenceInterpolator.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/interpolation/DividedDifferenceInterpolator.java Sat Sep 1 23:54:52 2012
@@ -19,6 +19,10 @@ package org.apache.commons.math3.analysi
import java.io.Serializable;
import org.apache.commons.math3.analysis.polynomials.PolynomialFunctionLagrangeForm;
import org.apache.commons.math3.analysis.polynomials.PolynomialFunctionNewtonForm;
+import org.apache.commons.math3.exception.DimensionMismatchException;
+import org.apache.commons.math3.exception.NoDataException;
+import org.apache.commons.math3.exception.NumberIsTooSmallException;
+import org.apache.commons.math3.exception.NonMonotonicSequenceException;
/**
* Implements the <a href="
@@ -44,14 +48,15 @@ public class DividedDifferenceInterpolat
* @param x Interpolating points array.
* @param y Interpolating values array.
* @return a function which interpolates the dataset.
- * @throws org.apache.commons.math3.exception.DimensionMismatchException
- * if the array lengths are different.
- * @throws org.apache.commons.math3.exception.NumberIsTooSmallException
- * if the number of points is less than 2.
- * @throws org.apache.commons.math3.exception.NonMonotonicSequenceException
- * if {@code x} is not sorted in strictly increasing order.
+ * @throws DimensionMismatchException if the array lengths are different.
+ * @throws NumberIsTooSmallException if the number of points is less than 2.
+ * @throws NonMonotonicSequenceException if {@code x} is not sorted in
+ * strictly increasing order.
*/
- public PolynomialFunctionNewtonForm interpolate(double x[], double y[]) {
+ public PolynomialFunctionNewtonForm interpolate(double x[], double y[])
+ throws DimensionMismatchException,
+ NumberIsTooSmallException,
+ NonMonotonicSequenceException {
/**
* a[] and c[] are defined in the general formula of Newton form:
* p(x) = a[0] + a[1](x-c[0]) + a[2](x-c[0])(x-c[1]) + ... +
@@ -87,14 +92,15 @@ public class DividedDifferenceInterpolat
* @param x Interpolating points array.
* @param y Interpolating values array.
* @return a fresh copy of the divided difference array.
- * @throws org.apache.commons.math3.exception.DimensionMismatchException
- * if the array lengths are different.
- * @throws org.apache.commons.math3.exception.NumberIsTooSmallException
- * if the number of points is less than 2.
- * @throws org.apache.commons.math3.exception.NonMonotonicSequenceException
+ * @throws DimensionMismatchException if the array lengths are different.
+ * @throws NumberIsTooSmallException if the number of points is less than 2.
+ * @throws NonMonotonicSequenceException
* if {@code x} is not sorted in strictly increasing order.
*/
- protected static double[] computeDividedDifference(final double x[], final double y[]) {
+ protected static double[] computeDividedDifference(final double x[], final double y[])
+ throws DimensionMismatchException,
+ NumberIsTooSmallException,
+ NonMonotonicSequenceException {
PolynomialFunctionLagrangeForm.verifyInterpolationArray(x, y, true);
final double[] divdiff = y.clone(); // initialization
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/interpolation/LinearInterpolator.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/interpolation/LinearInterpolator.java?rev=1379904&r1=1379903&r2=1379904&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/interpolation/LinearInterpolator.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/interpolation/LinearInterpolator.java Sat Sep 1 23:54:52 2012
@@ -16,12 +16,13 @@
*/
package org.apache.commons.math3.analysis.interpolation;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
import org.apache.commons.math3.analysis.polynomials.PolynomialFunction;
import org.apache.commons.math3.analysis.polynomials.PolynomialSplineFunction;
import org.apache.commons.math3.util.MathArrays;
+import org.apache.commons.math3.exception.DimensionMismatchException;
+import org.apache.commons.math3.exception.NumberIsTooSmallException;
+import org.apache.commons.math3.exception.NonMonotonicSequenceException;
+import org.apache.commons.math3.exception.util.LocalizedFormats;
/**
* Implements a linear function for interpolation of real univariate functions.
@@ -31,17 +32,21 @@ import org.apache.commons.math3.util.Mat
public class LinearInterpolator implements UnivariateInterpolator {
/**
* Computes a linear interpolating function for the data set.
+ *
* @param x the arguments for the interpolation points
* @param y the values for the interpolation points
* @return a function which interpolates the data set
* @throws DimensionMismatchException if {@code x} and {@code y}
* have different sizes.
- * @throws org.apache.commons.math3.exception.NonMonotonicSequenceException
- * if {@code x} is not sorted in strict increasing order.
+ * @throws NonMonotonicSequenceException if {@code x} is not sorted in
+ * strict increasing order.
* @throws NumberIsTooSmallException if the size of {@code x} is smaller
* than 2.
*/
- public PolynomialSplineFunction interpolate(double x[], double y[]) {
+ public PolynomialSplineFunction interpolate(double x[], double y[])
+ throws DimensionMismatchException,
+ NumberIsTooSmallException,
+ NonMonotonicSequenceException {
if (x.length != y.length) {
throw new DimensionMismatchException(x.length, y.length);
}
@@ -62,7 +67,7 @@ public class LinearInterpolator implemen
m[i] = (y[i + 1] - y[i]) / (x[i + 1] - x[i]);
}
- PolynomialFunction polynomials[] = new PolynomialFunction[n];
+ final PolynomialFunction polynomials[] = new PolynomialFunction[n];
final double coefficients[] = new double[2];
for (int i = 0; i < n; i++) {
coefficients[0] = y[i];
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/interpolation/LoessInterpolator.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/interpolation/LoessInterpolator.java?rev=1379904&r1=1379903&r2=1379904&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/interpolation/LoessInterpolator.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/interpolation/LoessInterpolator.java Sat Sep 1 23:54:52 2012
@@ -25,6 +25,8 @@ import org.apache.commons.math3.exceptio
import org.apache.commons.math3.exception.DimensionMismatchException;
import org.apache.commons.math3.exception.NoDataException;
import org.apache.commons.math3.exception.NumberIsTooSmallException;
+import org.apache.commons.math3.exception.NonMonotonicSequenceException;
+import org.apache.commons.math3.exception.NotFiniteNumberException;
import org.apache.commons.math3.exception.util.LocalizedFormats;
import org.apache.commons.math3.util.FastMath;
import org.apache.commons.math3.util.MathUtils;
@@ -47,7 +49,7 @@ import org.apache.commons.math3.util.Mat
* @since 2.0
*/
public class LoessInterpolator
- implements UnivariateInterpolator, Serializable {
+ implements UnivariateInterpolator, Serializable {
/** Default value of the bandwidth parameter. */
public static final double DEFAULT_BANDWIDTH = 0.3;
/** Default value of the number of robustness iterations. */
@@ -143,7 +145,9 @@ public class LoessInterpolator
* @see #LoessInterpolator(double, int)
* @since 2.1
*/
- public LoessInterpolator(double bandwidth, int robustnessIters, double accuracy) {
+ public LoessInterpolator(double bandwidth, int robustnessIters, double accuracy)
+ throws OutOfRangeException,
+ NotPositiveException {
if (bandwidth < 0 ||
bandwidth > 1) {
throw new OutOfRangeException(LocalizedFormats.BANDWIDTH, bandwidth, 0, 1);
@@ -166,18 +170,24 @@ public class LoessInterpolator
* @param xval the arguments for the interpolation points
* @param yval the values for the interpolation points
* @return A cubic spline built upon a loess fit to the data at the original abscissae
- * @throws org.apache.commons.math3.exception.NonMonotonicSequenceException
- * if {@code xval} not sorted in strictly increasing order.
+ * @throws NonMonotonicSequenceException if {@code xval} not sorted in
+ * strictly increasing order.
* @throws DimensionMismatchException if {@code xval} and {@code yval} have
* different sizes.
* @throws NoDataException if {@code xval} or {@code yval} has zero size.
- * @throws org.apache.commons.math3.exception.NotFiniteNumberException if
- * any of the arguments and values are not finite real numbers.
+ * @throws NotFiniteNumberException if any of the arguments and values are
+ * not finite real numbers.
* @throws NumberIsTooSmallException if the bandwidth is too small to
* accomodate the size of the input data (i.e. the bandwidth must be
* larger than 2/n).
*/
- public final PolynomialSplineFunction interpolate(final double[] xval, final double[] yval) {
+ public final PolynomialSplineFunction interpolate(final double[] xval,
+ final double[] yval)
+ throws NonMonotonicSequenceException,
+ DimensionMismatchException,
+ NoDataException,
+ NotFiniteNumberException,
+ NumberIsTooSmallException {
return new SplineInterpolator().interpolate(xval, smooth(xval, yval));
}
@@ -189,20 +199,25 @@ public class LoessInterpolator
* @param weights point weights: coefficients by which the robustness weight
* of a point is multiplied.
* @return the values of the loess fit at corresponding original abscissae.
- * @throws org.apache.commons.math3.exception.NonMonotonicSequenceException
- * if {@code xval} not sorted in strictly increasing order.
+ * @throws NonMonotonicSequenceException if {@code xval} not sorted in
+ * strictly increasing order.
* @throws DimensionMismatchException if {@code xval} and {@code yval} have
* different sizes.
* @throws NoDataException if {@code xval} or {@code yval} has zero size.
- * @throws org.apache.commons.math3.exception.NotFiniteNumberException if
- * any of the arguments and values are not finite real numbers.
+ * @throws NotFiniteNumberException if any of the arguments and values are
+ not finite real numbers.
* @throws NumberIsTooSmallException if the bandwidth is too small to
* accomodate the size of the input data (i.e. the bandwidth must be
* larger than 2/n).
* @since 2.1
*/
public final double[] smooth(final double[] xval, final double[] yval,
- final double[] weights) {
+ final double[] weights)
+ throws NonMonotonicSequenceException,
+ DimensionMismatchException,
+ NoDataException,
+ NotFiniteNumberException,
+ NumberIsTooSmallException {
if (xval.length != yval.length) {
throw new DimensionMismatchException(xval.length, yval.length);
}
@@ -353,18 +368,23 @@ public class LoessInterpolator
* @param xval the arguments for the interpolation points
* @param yval the values for the interpolation points
* @return values of the loess fit at corresponding original abscissae
- * @throws org.apache.commons.math3.exception.NonMonotonicSequenceException
- * if {@code xval} not sorted in strictly increasing order.
+ * @throws NonMonotonicSequenceException if {@code xval} not sorted in
+ * strictly increasing order.
* @throws DimensionMismatchException if {@code xval} and {@code yval} have
* different sizes.
* @throws NoDataException if {@code xval} or {@code yval} has zero size.
- * @throws org.apache.commons.math3.exception.NotFiniteNumberException if
- * any of the arguments and values are not finite real numbers.
+ * @throws NotFiniteNumberException if any of the arguments and values are
+ * not finite real numbers.
* @throws NumberIsTooSmallException if the bandwidth is too small to
* accomodate the size of the input data (i.e. the bandwidth must be
* larger than 2/n).
*/
- public final double[] smooth(final double[] xval, final double[] yval) {
+ public final double[] smooth(final double[] xval, final double[] yval)
+ throws NonMonotonicSequenceException,
+ DimensionMismatchException,
+ NoDataException,
+ NotFiniteNumberException,
+ NumberIsTooSmallException {
if (xval.length != yval.length) {
throw new DimensionMismatchException(xval.length, yval.length);
}
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/interpolation/MicrosphereInterpolatingFunction.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/interpolation/MicrosphereInterpolatingFunction.java?rev=1379904&r1=1379903&r2=1379904&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/interpolation/MicrosphereInterpolatingFunction.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/interpolation/MicrosphereInterpolatingFunction.java Sat Sep 1 23:54:52 2012
@@ -125,13 +125,13 @@ public class MicrosphereInterpolatingFun
}
/**
- * @param xval the arguments for the interpolation points.
+ * @param xval Arguments for the interpolation points.
* {@code xval[i][0]} is the first component of interpolation point
* {@code i}, {@code xval[i][1]} is the second component, and so on
* until {@code xval[i][d-1]}, the last component of that interpolation
* point (where {@code dimension} is thus the dimension of the sampled
* space).
- * @param yval the values for the interpolation points
+ * @param yval Values for the interpolation points.
* @param brightnessExponent Brightness dimming factor.
* @param microsphereElements Number of surface elements of the
* microsphere.
@@ -147,7 +147,10 @@ public class MicrosphereInterpolatingFun
double[] yval,
int brightnessExponent,
int microsphereElements,
- UnitSphereRandomVectorGenerator rand) {
+ UnitSphereRandomVectorGenerator rand)
+ throws DimensionMismatchException,
+ NoDataException,
+ NullArgumentException {
if (xval == null ||
yval == null) {
throw new NullArgumentException();
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/interpolation/MicrosphereInterpolator.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/interpolation/MicrosphereInterpolator.java?rev=1379904&r1=1379903&r2=1379904&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/interpolation/MicrosphereInterpolator.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/interpolation/MicrosphereInterpolator.java Sat Sep 1 23:54:52 2012
@@ -19,6 +19,9 @@ package org.apache.commons.math3.analysi
import org.apache.commons.math3.analysis.MultivariateFunction;
import org.apache.commons.math3.exception.NotPositiveException;
import org.apache.commons.math3.exception.NotStrictlyPositiveException;
+import org.apache.commons.math3.exception.NoDataException;
+import org.apache.commons.math3.exception.DimensionMismatchException;
+import org.apache.commons.math3.exception.NullArgumentException;
import org.apache.commons.math3.random.UnitSphereRandomVectorGenerator;
/**
@@ -68,7 +71,9 @@ public class MicrosphereInterpolator
* @throws NotStrictlyPositiveException if {@code elements <= 0}.
*/
public MicrosphereInterpolator(final int elements,
- final int exponent) {
+ final int exponent)
+ throws NotPositiveException,
+ NotStrictlyPositiveException {
if (exponent < 0) {
throw new NotPositiveException(exponent);
}
@@ -84,7 +89,10 @@ public class MicrosphereInterpolator
* {@inheritDoc}
*/
public MultivariateFunction interpolate(final double[][] xval,
- final double[] yval) {
+ final double[] yval)
+ throws DimensionMismatchException,
+ NoDataException,
+ NullArgumentException {
final UnitSphereRandomVectorGenerator rand
= new UnitSphereRandomVectorGenerator(xval[0].length);
return new MicrosphereInterpolatingFunction(xval, yval,
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/interpolation/NevilleInterpolator.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/interpolation/NevilleInterpolator.java?rev=1379904&r1=1379903&r2=1379904&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/interpolation/NevilleInterpolator.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/interpolation/NevilleInterpolator.java Sat Sep 1 23:54:52 2012
@@ -19,6 +19,9 @@ package org.apache.commons.math3.analysi
import java.io.Serializable;
import org.apache.commons.math3.analysis.polynomials.PolynomialFunctionLagrangeForm;
+import org.apache.commons.math3.exception.DimensionMismatchException;
+import org.apache.commons.math3.exception.NumberIsTooSmallException;
+import org.apache.commons.math3.exception.NonMonotonicSequenceException;
/**
* Implements the <a href="http://mathworld.wolfram.com/NevillesAlgorithm.html">
@@ -41,17 +44,18 @@ public class NevilleInterpolator impleme
/**
* Computes an interpolating function for the data set.
*
- * @param x the interpolating points array
- * @param y the interpolating values array
+ * @param x Interpolating points.
+ * @param y Interpolating values.
* @return a function which interpolates the data set
- * @throws org.apache.commons.math3.exception.DimensionMismatchException if
- * the array lengths are different.
- * @throws org.apache.commons.math3.exception.NumberIsTooSmallException if
- * the number of points is less than 2.
- * @throws org.apache.commons.math3.exception.NonMonotonicSequenceException
- * if two abscissae have the same value.
+ * @throws DimensionMismatchException if the array lengths are different.
+ * @throws NumberIsTooSmallException if the number of points is less than 2.
+ * @throws NonMonotonicSequenceException if two abscissae have the same
+ * value.
*/
- public PolynomialFunctionLagrangeForm interpolate(double x[], double y[]) {
+ public PolynomialFunctionLagrangeForm interpolate(double x[], double y[])
+ throws DimensionMismatchException,
+ NumberIsTooSmallException,
+ NonMonotonicSequenceException {
return new PolynomialFunctionLagrangeForm(x, y);
}
}
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/interpolation/SmoothingPolynomialBicubicSplineInterpolator.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/interpolation/SmoothingPolynomialBicubicSplineInterpolator.java?rev=1379904&r1=1379903&r2=1379904&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/interpolation/SmoothingPolynomialBicubicSplineInterpolator.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/interpolation/SmoothingPolynomialBicubicSplineInterpolator.java Sat Sep 1 23:54:52 2012
@@ -70,7 +70,9 @@ public class SmoothingPolynomialBicubicS
@Override
public BicubicSplineInterpolatingFunction interpolate(final double[] xval,
final double[] yval,
- final double[][] fval) {
+ final double[][] fval)
+ throws NoDataException,
+ DimensionMismatchException {
if (xval.length == 0 || yval.length == 0 || fval.length == 0) {
throw new NoDataException();
}
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/interpolation/SplineInterpolator.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/interpolation/SplineInterpolator.java?rev=1379904&r1=1379903&r2=1379904&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/interpolation/SplineInterpolator.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/interpolation/SplineInterpolator.java Sat Sep 1 23:54:52 2012
@@ -19,6 +19,7 @@ package org.apache.commons.math3.analysi
import org.apache.commons.math3.exception.DimensionMismatchException;
import org.apache.commons.math3.exception.util.LocalizedFormats;
import org.apache.commons.math3.exception.NumberIsTooSmallException;
+import org.apache.commons.math3.exception.NonMonotonicSequenceException;
import org.apache.commons.math3.analysis.polynomials.PolynomialFunction;
import org.apache.commons.math3.analysis.polynomials.PolynomialSplineFunction;
import org.apache.commons.math3.util.MathArrays;
@@ -58,12 +59,15 @@ public class SplineInterpolator implemen
* @return a function which interpolates the data set
* @throws DimensionMismatchException if {@code x} and {@code y}
* have different sizes.
- * @throws org.apache.commons.math3.exception.NonMonotonicSequenceException
- * if {@code x} is not sorted in strict increasing order.
+ * @throws NonMonotonicSequenceException if {@code x} is not sorted in
+ * strict increasing order.
* @throws NumberIsTooSmallException if the size of {@code x} is smaller
* than 3.
*/
- public PolynomialSplineFunction interpolate(double x[], double y[]) {
+ public PolynomialSplineFunction interpolate(double x[], double y[])
+ throws DimensionMismatchException,
+ NumberIsTooSmallException,
+ NonMonotonicSequenceException {
if (x.length != y.length) {
throw new DimensionMismatchException(x.length, y.length);
}
@@ -122,5 +126,4 @@ public class SplineInterpolator implemen
return new PolynomialSplineFunction(x, polynomials);
}
-
}
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/interpolation/TricubicSplineInterpolatingFunction.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/interpolation/TricubicSplineInterpolatingFunction.java?rev=1379904&r1=1379903&r2=1379904&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/interpolation/TricubicSplineInterpolatingFunction.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/interpolation/TricubicSplineInterpolatingFunction.java Sat Sep 1 23:54:52 2012
@@ -20,6 +20,7 @@ import org.apache.commons.math3.analysis
import org.apache.commons.math3.exception.DimensionMismatchException;
import org.apache.commons.math3.exception.NoDataException;
import org.apache.commons.math3.exception.OutOfRangeException;
+import org.apache.commons.math3.exception.NonMonotonicSequenceException;
import org.apache.commons.math3.util.MathArrays;
/**
@@ -139,7 +140,7 @@ public class TricubicSplineInterpolating
* @throws NoDataException if any of the arrays has zero length.
* @throws DimensionMismatchException if the various arrays do not contain
* the expected number of elements.
- * @throws IllegalArgumentException if {@code x}, {@code y} or {@code z}
+ * @throws Exception if {@code x}, {@code y} or {@code z}
* are not strictly increasing.
*/
public TricubicSplineInterpolatingFunction(double[] x,
@@ -152,7 +153,10 @@ public class TricubicSplineInterpolating
double[][][] d2FdXdY,
double[][][] d2FdXdZ,
double[][][] d2FdYdZ,
- double[][][] d3FdXdYdZ) {
+ double[][][] d3FdXdYdZ)
+ throws NoDataException,
+ DimensionMismatchException,
+ NonMonotonicSequenceException {
final int xLen = x.length;
final int yLen = y.length;
final int zLen = z.length;
@@ -305,8 +309,12 @@ public class TricubicSplineInterpolating
/**
* {@inheritDoc}
+ *
+ * @throws OutOfRangeException if any of the variables is outside its
+ * interpolation range.
*/
- public double value(double x, double y, double z) {
+ public double value(double x, double y, double z)
+ throws OutOfRangeException {
final int i = searchIndex(x, xval);
if (i == -1) {
throw new OutOfRangeException(x, xval[0], xval[xval.length - 1]);
@@ -445,8 +453,11 @@ class TricubicSplineFunction
* @param y y-coordinate of the interpolation point.
* @param z z-coordinate of the interpolation point.
* @return the interpolated value.
+ * @throws OutOfRangeException if {@code x}, {@code y} or
+ * {@code z} are not in the interval {@code [0, 1]}.
*/
- public double value(double x, double y, double z) {
+ public double value(double x, double y, double z)
+ throws OutOfRangeException {
if (x < 0 || x > 1) {
throw new OutOfRangeException(x, 0, 1);
}
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/interpolation/TricubicSplineInterpolator.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/interpolation/TricubicSplineInterpolator.java?rev=1379904&r1=1379903&r2=1379904&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/interpolation/TricubicSplineInterpolator.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/interpolation/TricubicSplineInterpolator.java Sat Sep 1 23:54:52 2012
@@ -18,6 +18,7 @@ package org.apache.commons.math3.analysi
import org.apache.commons.math3.exception.DimensionMismatchException;
import org.apache.commons.math3.exception.NoDataException;
+import org.apache.commons.math3.exception.NonMonotonicSequenceException;
import org.apache.commons.math3.util.MathArrays;
/**
@@ -34,7 +35,10 @@ public class TricubicSplineInterpolator
public TricubicSplineInterpolatingFunction interpolate(final double[] xval,
final double[] yval,
final double[] zval,
- final double[][][] fval) {
+ final double[][][] fval)
+ throws NoDataException,
+ DimensionMismatchException,
+ NonMonotonicSequenceException {
if (xval.length == 0 || yval.length == 0 || zval.length == 0 || fval.length == 0) {
throw new NoDataException();
}
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/interpolation/TrivariateGridInterpolator.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/interpolation/TrivariateGridInterpolator.java?rev=1379904&r1=1379903&r2=1379904&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/interpolation/TrivariateGridInterpolator.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/interpolation/TrivariateGridInterpolator.java Sat Sep 1 23:54:52 2012
@@ -17,6 +17,8 @@
package org.apache.commons.math3.analysis.interpolation;
import org.apache.commons.math3.analysis.TrivariateFunction;
+import org.apache.commons.math3.exception.DimensionMismatchException;
+import org.apache.commons.math3.exception.NoDataException;
/**
* Interface representing a trivariate real interpolating function where the
@@ -38,11 +40,11 @@ public interface TrivariateGridInterpola
* @param fval the values of the interpolation points on all the grid knots:
* {@code fval[i][j][k] = f(xval[i], yval[j], zval[k])}.
* @return a function that interpolates the data set.
- * @throws org.apache.commons.math3.exception.NoDataException if any of
- * the arrays has zero length.
- * @throws org.apache.commons.math3.exception.DimensionMismatchException
- * if the array lengths are inconsistent.
+ * @throws NoDataException if any of the arrays has zero length.
+ * @throws DimensionMismatchException if the array lengths are inconsistent.
*/
TrivariateFunction interpolate(double[] xval, double[] yval, double[] zval,
- double[][][] fval);
+ double[][][] fval)
+ throws NoDataException,
+ DimensionMismatchException;
}
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/interpolation/UnivariatePeriodicInterpolator.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/interpolation/UnivariatePeriodicInterpolator.java?rev=1379904&r1=1379903&r2=1379904&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/interpolation/UnivariatePeriodicInterpolator.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/interpolation/UnivariatePeriodicInterpolator.java Sat Sep 1 23:54:52 2012
@@ -54,8 +54,8 @@ public class UnivariatePeriodicInterpola
* on each side of the interpolated point.
*/
public UnivariatePeriodicInterpolator(UnivariateInterpolator interpolator,
- double period,
- int extend) {
+ double period,
+ int extend) {
this.interpolator = interpolator;
this.period = period;
this.extend = extend;
@@ -70,7 +70,7 @@ public class UnivariatePeriodicInterpola
* @param period Period.
*/
public UnivariatePeriodicInterpolator(UnivariateInterpolator interpolator,
- double period) {
+ double period) {
this(interpolator, period, DEFAULT_EXTEND);
}
@@ -81,7 +81,8 @@ public class UnivariatePeriodicInterpola
* iss larger then the size of {@code xval}.
*/
public UnivariateFunction interpolate(double[] xval,
- double[] yval) {
+ double[] yval)
+ throws NumberIsTooSmallException {
if (xval.length < extend) {
throw new NumberIsTooSmallException(xval.length, extend, true);
}