|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.esa.beam.util.math.FXYSum
public class FXYSum
The class FXYSum represents a sum of function terms sum(c[i] * f[i](x,y), i=0, n-1)
where the vector c is a double array of constant coefficients and the vector f
is an array of functions of type in x and y.
FXY
approximate(double[][], int[]) method.
After vector c is set, the actual function values z(x,y) are retrieved using the
computeZ(double, double) method.
| Nested Class Summary | |
|---|---|
static class |
FXYSum.BiCubic
Provides an optimized computeZ method for bi-cubic polynomials (order = 3+3). |
static class |
FXYSum.BiLinear
Provides an optimized computeZ method for bi-linear polynomials (order = 1+1). |
static class |
FXYSum.BiQuadric
Provides an optimized computeZ method for bi-quadric polynomials (order = 2+2). |
static class |
FXYSum.Cubic
Provides an optimized computeZ method for cubic polynomials (order = 3). |
static class |
FXYSum.Linear
Provides an optimized computeZ method for linear polynomials (order = 1). |
static class |
FXYSum.Quadric
Provides an optimized computeZ method for quadric polynomials (order = 2). |
| Field Summary | |
|---|---|
static FXY[] |
FXY_4TH
|
static FXY[] |
FXY_BI_4TH
|
static FXY[] |
FXY_BI_CUBIC
|
static FXY[] |
FXY_BI_LINEAR
|
static FXY[] |
FXY_BI_QUADRATIC
|
static FXY[] |
FXY_CUBIC
|
static FXY[] |
FXY_LINEAR
|
static FXY[] |
FXY_QUADRATIC
|
| Constructor Summary | |
|---|---|
FXYSum(FXY[] functions)
Constructs a new sum of terms sum(c[i] * f[i](x,y), i=0, n-1) for the given vector of functions. |
|
FXYSum(FXY[] functions,
int order)
Constructs a new sum of terms sum(c[i] * f[i](x,y), i=0, n-1) for the given vector of functions and a polynomial order. |
|
FXYSum(FXY[] functions,
int order,
double[] coefficients)
Constructs a new sum of terms sum(c[i] * f[i](x,y), i=0, n-1) for the given vector of functions and a polynomial order. |
|
| Method Summary | |
|---|---|
protected void |
appendCFunctionCodeBody(String fname,
String x,
String y,
StringBuffer sb)
|
protected void |
appendCFunctionCodeEnd(String fname,
String x,
String y,
StringBuffer sb)
|
protected void |
appendCFunctionCodePart(StringBuffer sb,
String part,
String x,
String y)
|
protected void |
appendCFunctionCodeStart(String fname,
String x,
String y,
StringBuffer sb)
|
void |
approximate(double[][] data,
int[] indices)
Approximates the given data points x,y,z by this sum of function terms so that z ~ sum(c[i] * f[i](x,y), i=0, n-1). |
double |
computeZ(double x,
double y)
Computes this sum of function terms z(x,y) = sum(c[i] * f[i](x,y), i=0, n-1). |
static double |
computeZ(FXY[] f,
double[] c,
double x,
double y)
Computes z(x,y) = sum(c[i] * f[i](x,y), i = 0, n - 1). |
String |
createCFunctionCode(String fname,
String x,
String y)
Returns this sum of function terms as human-readable C-code. |
static FXYSum |
createCopy(FXYSum fxySum)
Creates a copy of the given fxySum. |
static FXYSum |
createFXYSum(int order,
double[] coefficients)
Creates a FXYSum by the given order and coefficients. |
double[] |
getCoefficients()
Gets the vector c of coefficient elements c[i]. |
FXY[] |
getFunctions()
Gets the vector f of functions elements f[i](x,y). |
double |
getMaxError()
Gets the maximum, absolute error of the approximation. |
int |
getNumTerms()
Gets the number n of terms c[i] * f[i](x,y). |
int |
getOrder()
Gets the polynomial order, if any. |
double |
getRootMeanSquareError()
Gets the root mean square error. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final FXY[] FXY_LINEAR
public static final FXY[] FXY_BI_LINEAR
public static final FXY[] FXY_QUADRATIC
public static final FXY[] FXY_BI_QUADRATIC
public static final FXY[] FXY_CUBIC
public static final FXY[] FXY_BI_CUBIC
public static final FXY[] FXY_4TH
public static final FXY[] FXY_BI_4TH
| Constructor Detail |
|---|
public FXYSum(FXY[] functions)
approximate(double[][], int[])
is performed with given data on this function sum.
functions - the vector F of functions
public FXYSum(FXY[] functions,
int order)
approximate(double[][], int[])
is performed with given data on this function sum.
functions - the vector F of functionsorder - the polynomial order (for descriptive purpose only), -1 if unknown
public FXYSum(FXY[] functions,
int order,
double[] coefficients)
coefficients parameter. The coefficients will be recalculated if
the method approximate(double[][], int[]) is called.
functions - the vector F of functionsorder - the polynomial order (for descriptive purpose only), -1 if unknowncoefficients - the vector c| Method Detail |
|---|
public static FXYSum createFXYSum(int order,
double[] coefficients)
FXYSum by the given order and coefficients.
Note: This factory method supprots only the creation of instances of the following FXYSum classes:
FXYSum.Linear - order = 1 ; number of coefficients = 3FXYSum.BiLinear - order = 2 ; number of coefficients = 4FXYSum.Quadric - order = 2 ; number of coefficients = 6FXYSum.BiQuadric - order = 4 ; number of coefficients = 9FXYSum.Cubic - order = 3 ; number of coefficients = 10FXYSum.BiCubic - order = 6 ; number of coefficients = 16
order - the order of the sumcoefficients - the coefficients
null if the resulting instance is one of the supported.public static FXYSum createCopy(FXYSum fxySum)
fxySum.
fxySum - the FXYSum to copy
FXYSumpublic final int getNumTerms()
public final FXY[] getFunctions()
public final double[] getCoefficients()
public int getOrder()
public double getRootMeanSquareError()
public double getMaxError()
public double computeZ(double x,
double y)
approximate(double[][], int[]) is called in order to set
the coefficient vector c.
x - the x valuey - the y value
computeZ(FXY[], double[], double, double)
public static double computeZ(FXY[] f,
double[] c,
double x,
double y)
f - the function vectorc - the coeffcient vectorx - the x valuey - the y value
public void approximate(double[][] data,
int[] indices)
getRootMeanSquareError() and getMaxError() methods.
data - an array of values of the form {{x1,y1,z1}, {x2,y2,z2}, {x3,y3,z3}, ...} indices - an array of coordinate indices, determining the indices of x, y and z within a data element. If
null then indices defaults to the array {0, 1, 2}.Approximator.approximateFXY(double[][], int[], FXY[], double[]),
Approximator.computeErrorStatistics(double[][], int[], FXY[], double[]),
computeZ(double, double)
public String createCFunctionCode(String fname,
String x,
String y)
fname - the name of the function z(x,y) = sum(C[i]*F[i](x,y), i, n)x - the name of the x variabley - the name of the y variable
protected void appendCFunctionCodeStart(String fname,
String x,
String y,
StringBuffer sb)
protected void appendCFunctionCodeBody(String fname,
String x,
String y,
StringBuffer sb)
protected void appendCFunctionCodeEnd(String fname,
String x,
String y,
StringBuffer sb)
protected void appendCFunctionCodePart(StringBuffer sb,
String part,
String x,
String y)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||