findpiv.m

来自「it is a source code for geodesy」· M 代码 · 共 15 行

M
15
字号
function [k,p] = findpiv(A,k,p,tol)
%FINDPIV Used by PLU to find a pivot for Gaussian elimination.
%	      [r,p] = FINDPIV(A(k:m,p:n),k,p,tol) finds the first element in
%	      the specified submatrix which is larger than tol in absolute value.
%	      It returns indices r and p so that A(r,p) is the pivot.

[m,n] = size(A);
r = find(abs(A(:))>tol);
if isempty(r), return, end
r = r(1);
j = fix((r-1)/m)+1;
p = p+j-1;
k = k+r-(j-1)*m-1;
%%%%%%%%%%%%%%%%% end findpiv.m  %%%%%%%%%%%%%%%%%%%%

⌨️ 快捷键说明

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