List of usage examples for org.apache.commons.math3.analysis BivariateFunction BivariateFunction
BivariateFunction
From source file:au.gov.ga.conn4d.utils.BicubicSplineInterpolatingFunction.java
/** * Compute all partial derivatives functions. *///from ww w .ja v a 2 s .c o m private void computePartialDerivatives() { final double[][] aX = new double[N][N]; final double[][] aY = new double[N][N]; final double[][] aXX = new double[N][N]; final double[][] aYY = new double[N][N]; final double[][] aXY = new double[N][N]; for (int i = 0; i < N; i++) { for (int j = 0; j < N; j++) { final double c = a[i][j]; aX[i][j] = i * c; aY[i][j] = j * c; aXX[i][j] = (i - 1) * aX[i][j]; aYY[i][j] = (j - 1) * aY[i][j]; aXY[i][j] = j * aX[i][j]; } } partialDerivativeX = new BivariateFunction() { public double value(double x, double y) { final double x2 = x * x; final double[] pX = { 0, 1, x, x2 }; final double y2 = y * y; final double y3 = y2 * y; final double[] pY = { 1, y, y2, y3 }; return apply(pX, pY, aX); } }; partialDerivativeY = new BivariateFunction() { public double value(double x, double y) { final double x2 = x * x; final double x3 = x2 * x; final double[] pX = { 1, x, x2, x3 }; final double y2 = y * y; final double[] pY = { 0, 1, y, y2 }; return apply(pX, pY, aY); } }; partialDerivativeXX = new BivariateFunction() { public double value(double x, double y) { final double[] pX = { 0, 0, 1, x }; final double y2 = y * y; final double y3 = y2 * y; final double[] pY = { 1, y, y2, y3 }; return apply(pX, pY, aXX); } }; partialDerivativeYY = new BivariateFunction() { public double value(double x, double y) { final double x2 = x * x; final double x3 = x2 * x; final double[] pX = { 1, x, x2, x3 }; final double[] pY = { 0, 0, 1, y }; return apply(pX, pY, aYY); } }; partialDerivativeXY = new BivariateFunction() { public double value(double x, double y) { final double x2 = x * x; final double[] pX = { 0, 1, x, x2 }; final double y2 = y * y; final double[] pY = { 0, 1, y, y2 }; return apply(pX, pY, aXY); } }; }