factortri.m
来自「计算水声传播的快速场(FFP)程序」· M 代码 · 共 27 行
M
27 行
function [ mults, dt, et ] = factor( N, d, e )
% [ mults, dt, et ] = factor( N, d, e )
% Gaussian elimination to factor a symmetric tridiagonal linear system
%
% N is the order of the matrix
% d contains the diagonal elements of the input matrix
% e subdiagonal in its last N-1 positions
% dt contains the diagonal after reduction
% et contains the upper diagonal
% mults contains the multipliers used during elimination
% LU decomposition without interchanges
dt = zeros( N, 1 );
mults = zeros( N, 1 );
dt( 1 ) = d( 1 );
if N >= 2
for I = 1 : N-1
mults( I ) = e( I+1 ) / dt( I ); % multiplier
dt( I+1 ) = d( I+1 ) - mults( I ) * e( I+1 ); % new diagonal
end
end
et = e;
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?