Package org.esa.snap.core.util.math
Class Approximator
java.lang.Object
org.esa.snap.core.util.math.Approximator
A utility class which can be used to find approximation functions for a given dataset.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidapproximateFX(double[][] data, int[] indices, FX[] f, double[] c) Solves a linear equation system with each term having the form c * f(x).static voidapproximateFXY(double[][] data, int[] indices, FXY[] f, double[] c) Solves a linear equation system with each term having the form c * f(x,y).static double[]computeErrorStatistics(double[][] data, int[] indices, FXY[] f, double[] c) Returns the root mean square error (RMSE) for the approximation of the given data with a function given by z(x,y) =c[0]*f[0](x,y) + c[1]*f[1](x,y) + c[2]*f[2](x,y) + ...static doublecomputeRMSE(double[][] data, int[] indices, FXY[] f, double[] c) Returns the root mean square error (RMSE) for the approximation of the given data with a function given by z(x,y) =c[0]*f[0](x,y) + c[1]*f[1](x,y) + c[2]*f[2](x,y) + ...static doubleComputes y(x) = sum(c[i] * f[i](x), i = 0, n - 1).static doubleComputes z(x,y) = sum(c[i] * f[i](x,y), i = 0, n - 1).static doubleReturns the root mean square error (RMSE) for the approximation of the given data with a function given by y'(x) =c[0]*f[0](x) + c[1]*f[1](x) + c[2]*f[2](x) + ...static voidsolve1(double[][] a, double[] b, double[] c) Solves the matrix equation A * C = B for given A,B by performing the operation C = A.solve(B).
-
Constructor Details
-
Approximator
public Approximator()
-
-
Method Details
-
approximateFX
Solves a linear equation system with each term having the form c * f(x). The method finds the coefficientsc[0]toc[n-1]withn = f.lengthfor an approximation function y'(x) =c[0]*f[0](x) + c[1]*f[1](x) + c[2]*f[2](x) + ... + c[n-1]*f[n-1](x)which approximates the given data vector xi=data[i][0], yi=data[i][1]with i =0todata.length-1.- Parameters:
data- an array of values of the form{{x1,y1}, {x2,y2}, {x3,y3}, ...}indices- the co-ordinate indices vector, determining the indices of x,y within data. Ifnullthenindicesdefaults to{0, 1}.f- the function vector, each function has the form y=f(x)c- the resulting coefficient vector, must have the same size as the function vector
-
approximateFXY
Solves a linear equation system with each term having the form c * f(x,y). The method finds the coefficientsc[0]toc[n-1]withn = f.lengthfor an approximation function z'(x,y) =c[0]*f[0](x,y) + c[1]*f[1](x,y) + c[2]*f[2](x,y) + ... + c[n-1]*f[n-1](x,y)which approximates the given data vector xi=data[i][0], yi=data[i][1], zi=data[i][2]with i =0todata.length-1.- Parameters:
data- an array of values of the form{{x1,y1,z1}, {x2,y2,z2}, {x3,y3,z3}, ...}indices- the co-ordinate indices vector, determining the indices of x,y,z withindata. Ifnullthenindicesdefaults to{0, 1, 2}.f- the function vector, each function has the form z=f(x,y)c- the resulting coefficient vector, must have the same size as the function vector
-
getRMSE
Returns the root mean square error (RMSE) for the approximation of the given data with a function given by y'(x) =c[0]*f[0](x) + c[1]*f[1](x) + c[2]*f[2](x) + ... + c[n-1]*f[n-1](x).- Parameters:
data- an array of values of the form{{x1,y1}, {x2,y2}, {x3,y3}, ...}indices- the co-ordinate indices vector, determining the indices of x,y withindata. Ifnullthenindicesdefaults to{0, 1}.f- the function vector, each function has the form y=f(x)c- the coefficient vector, must have the same size as the function vector
-
computeRMSE
Returns the root mean square error (RMSE) for the approximation of the given data with a function given by z(x,y) =c[0]*f[0](x,y) + c[1]*f[1](x,y) + c[2]*f[2](x,y) + ... + c[n-1]*f[n-1](x,y).- Parameters:
data- an array of values of the form{{x1,y1,z1}, {x2,y2,z1}, {x3,y3,z1}, ...}indices- the co-ordinate indices vector, determining the indices of x,y,z withindata. Ifnullthenindicesdefaults to{0, 1, 2}.f- the function vector, each function has the form z=f(x,y)c- the coefficient vector, must have the same size as the function vector
-
computeErrorStatistics
Returns the root mean square error (RMSE) for the approximation of the given data with a function given by z(x,y) =c[0]*f[0](x,y) + c[1]*f[1](x,y) + c[2]*f[2](x,y) + ... + c[n-1]*f[n-1](x,y).- Parameters:
data- an array of values of the form{{x1,y1,z1}, {x2,y2,z1}, {x3,y3,z1}, ...}indices- the co-ordinate indices vector, determining the indices of x,y,z withindata. Ifnullthenindicesdefaults to{0, 1, 2}.f- the function vector, each function has the form z=f(x,y)c- the coefficient vector, must have the same size as the function vector
-
computeY
Computes y(x) = sum(c[i] * f[i](x), i = 0, n - 1).- Parameters:
f- the function vectorc- the coeffcient vectorx- the x value- Returns:
- the y value
-
computeZ
Computes z(x,y) = sum(c[i] * f[i](x,y), i = 0, n - 1).- Parameters:
f- the function vectorc- the coeffcient vectorx- the x valuey- the y value- Returns:
- the z value
-
solve1
public static void solve1(double[][] a, double[] b, double[] c) Solves the matrix equation A * C = B for given A,B by performing the operation C = A.solve(B).- Parameters:
a- matrix Ab- matrix Bc- result matrix C
-