lu_pp_mult.m

来自「LU decomposition routines in matlab」· M 代码 · 共 48 行

M
48
字号
function [A] = lu_pp_mult( A, ipivt );% % LU_PP_MULT  uses the LU--decomposition with partial% pivoting of an N by N  matrix A  computed by lu_pp% and computes  P^T L U % % Usage%       [A] = lu_pp_mult( A, ipvt )% % input:%        A:     the LU-decomposition of  A, computed by LU_PP%               or LU_PP_FL% %        ipivt: pivot information% % output:%        A:     the product P^T L U% %%%  Matthias Heinkenschloss%  Department of Computational and Applied Mathematics%  Rice University%  Feb 22, 2001%[n,n] = size(A);for k = n-1:-1:1   % Apply M_k^(-1)   for i = k+1:n       A(i,k+1:n) = A(i,k+1:n) - A(i,k) * A(k,k+1:n);       A(i,k) = -A(i,k)*A(k,k);   end     % Apply P_k   l = ipivt(k);   % Interchange rows if necessary   if( k ~= l )        tmp      = A(k,k:n);       A(k,k:n) = A(l,k:n);       A(l,k:n) = tmp;   end end

⌨️ 快捷键说明

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