DimensionMismatchException, NonMonotonicSequenceException {
if (xval.length == 0 || yval.length == 0 || zval.length == 0 || fval.length == 0) {
throw new NoDataException();
}
if (xval.length != fval.length) {
throw new DimensionMismatchException(xval.length, fval.length);
}
MathArrays.checkOrder(xval);
MathArrays.checkOrder(yval);
MathArrays.checkOrder(zval);
final int xLen = xval.length;
final int yLen = yval.length;
final int zLen = zval.length;
// Samples, re-ordered as (z, x, y) and (y, z, x) tuplets
// fvalXY[k][i][j] = f(xval[i], yval[j], zval[k])
// fvalZX[j][k][i] = f(xval[i], yval[j], zval[k])
final double[][][] fvalXY = new double[zLen][xLen][yLen];
final double[][][] fvalZX = new double[yLen][zLen][xLen];
for (int i = 0; i < xLen; i++) {
if (fval[i].length != yLen) {
throw new DimensionMismatchException(fval[i].length, yLen);
}
for (int j = 0; j < yLen; j++) {
if (fval[i][j].length != zLen) {
throw new DimensionMismatchException(fval[i][j].length, zLen);
}
for (int k = 0; k < zLen; k++) {
final double v = fval[i][j][k];
fvalXY[k][i][j] = v;