⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tridiagldlsl.m

📁 Interpolation routines in matlab
💻 M
字号:
%% tridiagLDLsl.m%% Compute the solution of the symmetric tridiagonal linear system %      A x = b% The LDL^T decomposition without pivoting of the symmetric tridiagonal% matrix A has to be computed by tridiagLDL.m. %%% function [b, iflag] = tridiagLDLsl( d, e, b )%% input:%        e:     subdiagonal of L%%        d:     diagonal of U%% output:%        b:     solution of the linear system%%        iflag: error flag%               iflag = 0  LU decomposition could be computed%               iflag = 1  dimension of b does not match dimension of A%               iflag > 1  zero pivot element detected in row iflag+1%function [b, iflag] = tridiagLDLsl( d, e, b );iflag = 0;% get size of A and check dimensionsn  = size(d(:),1);if ( n ~= size(b(:),1) )   iflag = 1;   returnend% Solve  L y = b  (overwite b with result)for i = 2:n    b(i) = b(i) - e(i-1) * b(i-1);end% Solve  D L^T x = y  (overwite b with result)b(n) = b(n) / d(n);for i = n-1:-1:1    b(i) = b(i)/d(i) - e(i) * b(i+1);end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -