Skip to content

KBE3D / KBCore / Cesium / TridiagonalSystemSolver / solve

函数: solve()

solve(diagonal: number[], lower: number[], upper: number[], right: Cartesian3[]): Cartesian3[]

Solves a tridiagonal system of linear equations.

参数

diagonal

number[]

An array with length <code>n</code> that contains the diagonal of the coefficient matrix.

lower

number[]

An array with length <code>n - 1</code> that contains the lower diagonal of the coefficient matrix.

upper

number[]

An array with length <code>n - 1</code> that contains the upper diagonal of the coefficient matrix.

Cartesian3[]

An array of Cartesians with length <code>n</code> that is the right side of the system of equations.

返回

Cartesian3[]

An array of Cartesians with length n that is the solution to the tridiagonal system of equations.

示例

ts
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);

KBE3D @3.0.0 Copyright © 2024-present KBE3D