使用三对角矩阵算法(也称为托马斯算法)来求解系数矩阵为三对角矩阵的线性方程组。 Uses the Tridiagonal Matrix Algorithm, also known as the Thomas Algorithm, to solve a system of linear equations where the coefficient matrix is a tridiagonal matrix.
方法 Methods
static Cesium.TridiagonalSystemSolver.solve(diagonal, lower, upper, right) → Array.<Cartesian3>
求解三对角线性方程组。 Solves a tridiagonal system of linear equations.
性能: Performance:
线性时间。 Linear time.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
diagonal |
Array.<number> |
有长度的数组 An array with length n 包含系数矩阵的对角线。 that contains the diagonal of the coefficient matrix. |
lower |
Array.<number> |
有长度的数组 An array with length n - 1 包含系数矩阵的下对角线。 that contains the lower diagonal of the coefficient matrix. |
upper |
Array.<number> |
有长度的数组 An array with length n - 1 包含系数矩阵的上对角线。 that contains the upper diagonal of the coefficient matrix. |
right |
Array.<Cartesian3> |
具有长度的笛卡尔数组 An array of Cartesians with length n 这是方程组的右侧。 that is the right side of the system of equations. |
返回: Returns:
具有长度的笛卡尔数组 An array of Cartesians with length
n 这就是三对角方程组的解。 that is the solution to the tridiagonal system of equations.
抛出: Throws:
-
DeveloperError :对角线和右侧必须具有相同的长度。 : diagonal and right must have the same lengths.
-
DeveloperError : lower and upper must have the same lengths.
-
DeveloperError :下和上必须比对角线长度小一。 : lower and upper must be one less than the length of diagonal.
示例: Example:
const lowerDiagonal = [1.0, 1.0, 1.0, 1.0];
const diagonal = [2.0, 4.0, 4.0, 4.0, 2.0];
const upperDiagonal = [1.0, 1.0, 1.0, 1.0];
const rightHandSide = [
new Cesium.Cartesian3(410757.0, -1595711.0, 1375302.0),
new Cesium.Cartesian3(-5986705.0, -2190640.0, 1099600.0),
new Cesium.Cartesian3(-12593180.0, 288588.0, -1755549.0),
new Cesium.Cartesian3(-5349898.0, 2457005.0, -2685438.0),
new Cesium.Cartesian3(845820.0, 1573488.0, -1205591.0)
];
const solution = Cesium.TridiagonalSystemSolver.solve(lowerDiagonal, diagonal, upperDiagonal, rightHandSide);
