Package org.esa.snap.core.util.math
Class LinEqSysSolver
java.lang.Object
org.esa.snap.core.util.math.LinEqSysSolver
A gauss-based solver for linear equation systems.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleangauss(double[][] a, double[] c, double[] x, int n, double eps) Solves a linear equation system using the gaussian algorithm.static booleangauss_debug(double[][] a, double[] c, double[] x, int n, double eps) Same as thegausssmethod, but prints extra debug information.static booleanpivotize(double[][] a, double[] c, int k, int n, double eps) Rearranges the matrixaby swapping linekwith a suitable pivot linek'.
-
Constructor Details
-
LinEqSysSolver
public LinEqSysSolver()
-
-
Method Details
-
gauss
public static boolean gauss(double[][] a, double[] c, double[] x, int n, double eps) throws SingularMatrixException Solves a linear equation system using the gaussian algorithm.- Parameters:
a- coefficient matrix [0..n-1][0..n-1] (left side of equation)c- the constant vector [0..n-1] (right side of equation)x- the result vector [0..n-1] (right side of equation)n- number of coefficientseps- the epsilon value, e.g. 1.0e-09- Throws:
SingularMatrixException- if the matrixais singular
-
gauss_debug
public static boolean gauss_debug(double[][] a, double[] c, double[] x, int n, double eps) Same as thegausssmethod, but prints extra debug information.- Parameters:
a- coefficient matrix [0..n-1][0..n-1] (left side of equation)c- the constant vector [0..n-1] (right side of equation)x- the result vector [0..n-1] (right side of equation)n- number of coefficientseps- the epsilon value, e.g. 1.0e-09- Throws:
SingularMatrixException- if the matrixais singular- See Also:
-
pivotize
public static boolean pivotize(double[][] a, double[] c, int k, int n, double eps) Rearranges the matrixaby swapping linekwith a suitable pivot linek'.- Parameters:
a- coefficient matrix [0..n-1][0..n-1] (left side of equation)c- the constant vector [0..n-1] (right side of equation)k- the current index of a diagonal element = current line and columnn- matrix sizeeps- the epsilon value, e.g. 1.0e-09- Throws:
SingularMatrixException- if the matrixais singular
-